From ce17ae5a6159d8ce3a5d2cc98f804a2debb860e5 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 16 Sep 2009 09:55:52 +0200 Subject: qdoc: Added the "All Functions" link back into the header. --- tools/qdoc3/test/qt-html-templates.qdocconf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/qdoc3/test/qt-html-templates.qdocconf b/tools/qdoc3/test/qt-html-templates.qdocconf index f9e3c35..7ceacb2 100644 --- a/tools/qdoc3/test/qt-html-templates.qdocconf +++ b/tools/qdoc3/test/qt-html-templates.qdocconf @@ -10,6 +10,8 @@ HTML.postheader = "Home ·" \ " " \ "All Classes ·" \ + " " \ + "All Functions ·" \ " " \ "Overviews" \ "" \ -- cgit v0.12 From 120329adb47dba60f532c1c2fd2ad0f37b812437 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Wed, 16 Sep 2009 09:51:00 +0200 Subject: Separate the copy of JavaScriptCore that QtScript uses from the copy that QtWebKit uses. This is needed to decouple QtScript from QtWebKit, as discussed in the WebKit team. Reviewed-by: Kent Hansen --- .../javascriptcore/JavaScriptCore/API/APICast.h | 133 + .../javascriptcore/JavaScriptCore/API/JSBase.cpp | 116 + .../javascriptcore/JavaScriptCore/API/JSBase.h | 144 + .../JavaScriptCore/API/JSBasePrivate.h | 52 + .../JavaScriptCore/API/JSCallbackConstructor.cpp | 86 + .../JavaScriptCore/API/JSCallbackConstructor.h | 57 + .../JavaScriptCore/API/JSCallbackFunction.cpp | 78 + .../JavaScriptCore/API/JSCallbackFunction.h | 58 + .../JavaScriptCore/API/JSCallbackObject.cpp | 41 + .../JavaScriptCore/API/JSCallbackObject.h | 114 + .../JavaScriptCore/API/JSCallbackObjectFunctions.h | 570 + .../JavaScriptCore/API/JSClassRef.cpp | 244 + .../javascriptcore/JavaScriptCore/API/JSClassRef.h | 122 + .../JavaScriptCore/API/JSContextRef.cpp | 154 + .../JavaScriptCore/API/JSContextRef.h | 132 + .../JavaScriptCore/API/JSObjectRef.cpp | 517 + .../JavaScriptCore/API/JSObjectRef.h | 695 + .../JavaScriptCore/API/JSProfilerPrivate.cpp | 46 + .../JavaScriptCore/API/JSProfilerPrivate.h | 63 + .../JavaScriptCore/API/JSRetainPtr.h | 173 + .../JavaScriptCore/API/JSStringRef.cpp | 112 + .../JavaScriptCore/API/JSStringRef.h | 144 + .../JavaScriptCore/API/JSStringRefBSTR.cpp | 42 + .../JavaScriptCore/API/JSStringRefBSTR.h | 62 + .../JavaScriptCore/API/JSStringRefCF.cpp | 57 + .../JavaScriptCore/API/JSStringRefCF.h | 60 + .../JavaScriptCore/API/JSValueRef.cpp | 322 + .../javascriptcore/JavaScriptCore/API/JSValueRef.h | 278 + .../javascriptcore/JavaScriptCore/API/JavaScript.h | 36 + .../JavaScriptCore/API/JavaScriptCore.h | 32 + .../JavaScriptCore/API/OpaqueJSString.cpp | 55 + .../JavaScriptCore/API/OpaqueJSString.h | 81 + .../JavaScriptCore/API/WebKitAvailability.h | 764 + src/3rdparty/javascriptcore/JavaScriptCore/AUTHORS | 2 + .../javascriptcore/JavaScriptCore/COPYING.LIB | 488 + .../javascriptcore/JavaScriptCore/ChangeLog | 2726 ++ .../JavaScriptCore/ChangeLog-2002-12-03 | 2271 ++ .../JavaScriptCore/ChangeLog-2003-10-25 | 1483 + .../JavaScriptCore/ChangeLog-2007-10-14 | 26221 ++++++++++++ .../JavaScriptCore/ChangeLog-2008-08-10 | 31482 +++++++++++++++ .../JavaScriptCore/ChangeLog-2009-06-16 | 39978 +++++++++++++++++++ .../JavaScriptCore/DerivedSources.make | 76 + .../ForwardingHeaders/JavaScriptCore/APICast.h | 1 + .../ForwardingHeaders/JavaScriptCore/JSBase.h | 1 + .../JavaScriptCore/JSContextRef.h | 1 + .../ForwardingHeaders/JavaScriptCore/JSObjectRef.h | 1 + .../ForwardingHeaders/JavaScriptCore/JSRetainPtr.h | 1 + .../ForwardingHeaders/JavaScriptCore/JSStringRef.h | 1 + .../JavaScriptCore/JSStringRefCF.h | 1 + .../ForwardingHeaders/JavaScriptCore/JSValueRef.h | 1 + .../ForwardingHeaders/JavaScriptCore/JavaScript.h | 1 + .../JavaScriptCore/JavaScriptCore.h | 1 + .../JavaScriptCore/OpaqueJSString.h | 1 + .../JavaScriptCore/WebKitAvailability.h | 1 + .../javascriptcore/JavaScriptCore/Info.plist | 24 + .../JavaScriptCore/JavaScriptCore.gypi | 452 + .../JavaScriptCore/JavaScriptCore.order | 1965 + .../JavaScriptCore/JavaScriptCore.pri | 254 + .../JavaScriptCore/JavaScriptCore.pro | 73 + .../JavaScriptCore/JavaScriptCorePrefix.h | 35 + src/3rdparty/javascriptcore/JavaScriptCore/THANKS | 8 + .../JavaScriptCore/assembler/ARMAssembler.cpp | 353 + .../JavaScriptCore/assembler/ARMAssembler.h | 706 + .../JavaScriptCore/assembler/ARMv7Assembler.h | 1759 + .../assembler/AbstractMacroAssembler.h | 541 + .../JavaScriptCore/assembler/AssemblerBuffer.h | 173 + .../assembler/AssemblerBufferWithConstantPool.h | 305 + .../JavaScriptCore/assembler/CodeLocation.h | 186 + .../JavaScriptCore/assembler/LinkBuffer.h | 195 + .../JavaScriptCore/assembler/MacroAssembler.h | 347 + .../JavaScriptCore/assembler/MacroAssemblerARM.h | 797 + .../JavaScriptCore/assembler/MacroAssemblerARMv7.h | 1082 + .../assembler/MacroAssemblerCodeRef.h | 188 + .../JavaScriptCore/assembler/MacroAssemblerX86.h | 191 + .../assembler/MacroAssemblerX86Common.h | 780 + .../assembler/MacroAssemblerX86_64.h | 480 + .../JavaScriptCore/assembler/RepatchBuffer.h | 136 + .../JavaScriptCore/assembler/X86Assembler.h | 1926 + .../JavaScriptCore/bytecode/CodeBlock.cpp | 1755 + .../JavaScriptCore/bytecode/CodeBlock.h | 580 + .../JavaScriptCore/bytecode/EvalCodeCache.h | 87 + .../JavaScriptCore/bytecode/Instruction.h | 167 + .../JavaScriptCore/bytecode/JumpTable.cpp | 45 + .../JavaScriptCore/bytecode/JumpTable.h | 103 + .../JavaScriptCore/bytecode/Opcode.cpp | 186 + .../JavaScriptCore/bytecode/Opcode.h | 238 + .../JavaScriptCore/bytecode/SamplingTool.cpp | 406 + .../JavaScriptCore/bytecode/SamplingTool.h | 412 + .../JavaScriptCore/bytecode/StructureStubInfo.cpp | 80 + .../JavaScriptCore/bytecode/StructureStubInfo.h | 156 + .../bytecompiler/BytecodeGenerator.cpp | 1961 + .../bytecompiler/BytecodeGenerator.h | 492 + .../JavaScriptCore/bytecompiler/Label.h | 92 + .../JavaScriptCore/bytecompiler/LabelScope.h | 79 + .../JavaScriptCore/bytecompiler/RegisterID.h | 121 + .../javascriptcore/JavaScriptCore/config.h | 76 + .../JavaScriptCore/create_hash_table | 274 + .../JavaScriptCore/debugger/Debugger.cpp | 70 + .../JavaScriptCore/debugger/Debugger.h | 110 + .../JavaScriptCore/debugger/DebuggerActivation.cpp | 103 + .../JavaScriptCore/debugger/DebuggerActivation.h | 63 + .../JavaScriptCore/debugger/DebuggerCallFrame.cpp | 92 + .../JavaScriptCore/debugger/DebuggerCallFrame.h | 70 + .../JavaScriptCore/docs/make-bytecode-docs.pl | 42 + .../JavaScriptCore/generated/ArrayPrototype.lut.h | 34 + .../JavaScriptCore/generated/DatePrototype.lut.h | 59 + .../JavaScriptCore/generated/Grammar.cpp | 5597 +++ .../JavaScriptCore/generated/Grammar.h | 173 + .../JavaScriptCore/generated/JSONObject.lut.h | 15 + .../JavaScriptCore/generated/Lexer.lut.h | 49 + .../JavaScriptCore/generated/MathObject.lut.h | 31 + .../generated/NumberConstructor.lut.h | 18 + .../generated/RegExpConstructor.lut.h | 34 + .../JavaScriptCore/generated/RegExpObject.lut.h | 18 + .../JavaScriptCore/generated/StringPrototype.lut.h | 45 + .../JavaScriptCore/generated/chartables.c | 96 + .../javascriptcore/JavaScriptCore/headers.pri | 9 + .../JavaScriptCore/interpreter/CachedCall.h | 70 + .../JavaScriptCore/interpreter/CallFrame.cpp | 52 + .../JavaScriptCore/interpreter/CallFrame.h | 150 + .../JavaScriptCore/interpreter/CallFrameClosure.h | 60 + .../JavaScriptCore/interpreter/Interpreter.cpp | 3995 ++ .../JavaScriptCore/interpreter/Interpreter.h | 166 + .../JavaScriptCore/interpreter/Register.h | 241 + .../JavaScriptCore/interpreter/RegisterFile.cpp | 59 + .../JavaScriptCore/interpreter/RegisterFile.h | 257 + .../JavaScriptCore/jit/ExecutableAllocator.cpp | 38 + .../JavaScriptCore/jit/ExecutableAllocator.h | 249 + .../jit/ExecutableAllocatorFixedVMPool.cpp | 447 + .../jit/ExecutableAllocatorPosix.cpp | 82 + .../JavaScriptCore/jit/ExecutableAllocatorWin.cpp | 60 + .../javascriptcore/JavaScriptCore/jit/JIT.cpp | 942 + .../javascriptcore/JavaScriptCore/jit/JIT.h | 728 + .../JavaScriptCore/jit/JITArithmetic.cpp | 1378 + .../javascriptcore/JavaScriptCore/jit/JITCall.cpp | 323 + .../javascriptcore/JavaScriptCore/jit/JITCode.h | 122 + .../JavaScriptCore/jit/JITInlineMethods.h | 475 + .../JavaScriptCore/jit/JITOpcodes.cpp | 1187 + .../JavaScriptCore/jit/JITPropertyAccess.cpp | 839 + .../JavaScriptCore/jit/JITStubCall.h | 170 + .../javascriptcore/JavaScriptCore/jit/JITStubs.cpp | 2801 ++ .../javascriptcore/JavaScriptCore/jit/JITStubs.h | 346 + src/3rdparty/javascriptcore/JavaScriptCore/jsc.cpp | 590 + src/3rdparty/javascriptcore/JavaScriptCore/jsc.pro | 31 + .../JavaScriptCore/make-generated-sources.sh | 11 + .../JavaScriptCore/os-win32/stdbool.h | 45 + .../JavaScriptCore/os-win32/stdint.h | 66 + .../JavaScriptCore/os-wince/ce_time.cpp | 677 + .../JavaScriptCore/os-wince/ce_time.h | 16 + .../javascriptcore/JavaScriptCore/parser/Grammar.y | 2093 + .../JavaScriptCore/parser/Keywords.table | 72 + .../javascriptcore/JavaScriptCore/parser/Lexer.cpp | 997 + .../javascriptcore/JavaScriptCore/parser/Lexer.h | 149 + .../JavaScriptCore/parser/NodeConstructors.h | 900 + .../JavaScriptCore/parser/NodeInfo.h | 63 + .../javascriptcore/JavaScriptCore/parser/Nodes.cpp | 2215 + .../javascriptcore/JavaScriptCore/parser/Nodes.h | 1734 + .../JavaScriptCore/parser/Parser.cpp | 108 + .../javascriptcore/JavaScriptCore/parser/Parser.h | 122 + .../JavaScriptCore/parser/ParserArena.cpp | 78 + .../JavaScriptCore/parser/ParserArena.h | 64 + .../JavaScriptCore/parser/ResultType.h | 182 + .../JavaScriptCore/parser/SourceCode.h | 99 + .../JavaScriptCore/parser/SourcePoolQt.cpp | 109 + .../JavaScriptCore/parser/SourcePoolQt.h | 93 + .../JavaScriptCore/parser/SourceProvider.h | 85 + .../javascriptcore/JavaScriptCore/pcre/AUTHORS | 12 + .../javascriptcore/JavaScriptCore/pcre/COPYING | 35 + .../javascriptcore/JavaScriptCore/pcre/dftables | 272 + .../javascriptcore/JavaScriptCore/pcre/pcre.h | 68 + .../javascriptcore/JavaScriptCore/pcre/pcre.pri | 35 + .../JavaScriptCore/pcre/pcre_compile.cpp | 2706 ++ .../JavaScriptCore/pcre/pcre_exec.cpp | 2177 + .../JavaScriptCore/pcre/pcre_internal.h | 455 + .../JavaScriptCore/pcre/pcre_tables.cpp | 72 + .../JavaScriptCore/pcre/pcre_ucp_searchfuncs.cpp | 99 + .../JavaScriptCore/pcre/pcre_xclass.cpp | 115 + .../JavaScriptCore/pcre/ucpinternal.h | 126 + .../JavaScriptCore/pcre/ucptable.cpp | 2968 ++ .../JavaScriptCore/profiler/CallIdentifier.h | 98 + .../JavaScriptCore/profiler/HeavyProfile.cpp | 0 .../JavaScriptCore/profiler/HeavyProfile.h | 0 .../JavaScriptCore/profiler/Profile.cpp | 136 + .../JavaScriptCore/profiler/Profile.h | 72 + .../JavaScriptCore/profiler/ProfileGenerator.cpp | 169 + .../JavaScriptCore/profiler/ProfileGenerator.h | 77 + .../JavaScriptCore/profiler/ProfileNode.cpp | 346 + .../JavaScriptCore/profiler/ProfileNode.h | 168 + .../JavaScriptCore/profiler/Profiler.cpp | 159 + .../JavaScriptCore/profiler/Profiler.h | 75 + .../JavaScriptCore/profiler/ProfilerServer.h | 35 + .../JavaScriptCore/profiler/ProfilerServer.mm | 115 + .../JavaScriptCore/profiler/TreeProfile.cpp | 0 .../JavaScriptCore/profiler/TreeProfile.h | 0 .../JavaScriptCore/runtime/ArgList.cpp | 83 + .../JavaScriptCore/runtime/ArgList.h | 230 + .../JavaScriptCore/runtime/Arguments.cpp | 284 + .../JavaScriptCore/runtime/Arguments.h | 247 + .../JavaScriptCore/runtime/ArrayConstructor.cpp | 85 + .../JavaScriptCore/runtime/ArrayConstructor.h | 40 + .../JavaScriptCore/runtime/ArrayPrototype.cpp | 1055 + .../JavaScriptCore/runtime/ArrayPrototype.h | 41 + .../runtime/BatchedTransitionOptimizer.h | 55 + .../JavaScriptCore/runtime/BooleanConstructor.cpp | 78 + .../JavaScriptCore/runtime/BooleanConstructor.h | 44 + .../JavaScriptCore/runtime/BooleanObject.cpp | 35 + .../JavaScriptCore/runtime/BooleanObject.h | 46 + .../JavaScriptCore/runtime/BooleanPrototype.cpp | 83 + .../JavaScriptCore/runtime/BooleanPrototype.h | 35 + .../JavaScriptCore/runtime/CallData.cpp | 65 + .../JavaScriptCore/runtime/CallData.h | 91 + .../JavaScriptCore/runtime/ClassInfo.h | 62 + .../JavaScriptCore/runtime/Collector.cpp | 1376 + .../JavaScriptCore/runtime/Collector.h | 287 + .../JavaScriptCore/runtime/CollectorHeapIterator.h | 90 + .../JavaScriptCore/runtime/CommonIdentifiers.cpp | 39 + .../JavaScriptCore/runtime/CommonIdentifiers.h | 91 + .../JavaScriptCore/runtime/Completion.cpp | 86 + .../JavaScriptCore/runtime/Completion.h | 63 + .../JavaScriptCore/runtime/ConstructData.cpp | 65 + .../JavaScriptCore/runtime/ConstructData.h | 96 + .../JavaScriptCore/runtime/DateConstructor.cpp | 183 + .../JavaScriptCore/runtime/DateConstructor.h | 43 + .../JavaScriptCore/runtime/DateConversion.cpp | 101 + .../JavaScriptCore/runtime/DateConversion.h | 60 + .../JavaScriptCore/runtime/DateInstance.cpp | 118 + .../JavaScriptCore/runtime/DateInstance.h | 67 + .../JavaScriptCore/runtime/DatePrototype.cpp | 1105 + .../JavaScriptCore/runtime/DatePrototype.h | 47 + .../JavaScriptCore/runtime/Error.cpp | 128 + .../javascriptcore/JavaScriptCore/runtime/Error.h | 73 + .../JavaScriptCore/runtime/ErrorConstructor.cpp | 73 + .../JavaScriptCore/runtime/ErrorConstructor.h | 44 + .../JavaScriptCore/runtime/ErrorInstance.cpp | 33 + .../JavaScriptCore/runtime/ErrorInstance.h | 38 + .../JavaScriptCore/runtime/ErrorPrototype.cpp | 68 + .../JavaScriptCore/runtime/ErrorPrototype.h | 37 + .../JavaScriptCore/runtime/ExceptionHelpers.cpp | 211 + .../JavaScriptCore/runtime/ExceptionHelpers.h | 57 + .../JavaScriptCore/runtime/FunctionConstructor.cpp | 133 + .../JavaScriptCore/runtime/FunctionConstructor.h | 48 + .../JavaScriptCore/runtime/FunctionPrototype.cpp | 148 + .../JavaScriptCore/runtime/FunctionPrototype.h | 46 + .../JavaScriptCore/runtime/GetterSetter.cpp | 84 + .../JavaScriptCore/runtime/GetterSetter.h | 75 + .../JavaScriptCore/runtime/GlobalEvalFunction.cpp | 49 + .../JavaScriptCore/runtime/GlobalEvalFunction.h | 46 + .../JavaScriptCore/runtime/Identifier.cpp | 268 + .../JavaScriptCore/runtime/Identifier.h | 144 + .../JavaScriptCore/runtime/InitializeThreading.cpp | 72 + .../JavaScriptCore/runtime/InitializeThreading.h | 40 + .../JavaScriptCore/runtime/InternalFunction.cpp | 71 + .../JavaScriptCore/runtime/InternalFunction.h | 66 + .../JavaScriptCore/runtime/JSActivation.cpp | 184 + .../JavaScriptCore/runtime/JSActivation.h | 98 + .../JavaScriptCore/runtime/JSArray.cpp | 1073 + .../JavaScriptCore/runtime/JSArray.h | 130 + .../JavaScriptCore/runtime/JSByteArray.cpp | 97 + .../JavaScriptCore/runtime/JSByteArray.h | 115 + .../JavaScriptCore/runtime/JSCell.cpp | 210 + .../javascriptcore/JavaScriptCore/runtime/JSCell.h | 300 + .../JavaScriptCore/runtime/JSFunction.cpp | 215 + .../JavaScriptCore/runtime/JSFunction.h | 138 + .../JavaScriptCore/runtime/JSGlobalData.cpp | 254 + .../JavaScriptCore/runtime/JSGlobalData.h | 164 + .../JavaScriptCore/runtime/JSGlobalObject.cpp | 464 + .../JavaScriptCore/runtime/JSGlobalObject.h | 426 + .../runtime/JSGlobalObjectFunctions.cpp | 439 + .../runtime/JSGlobalObjectFunctions.h | 60 + .../JavaScriptCore/runtime/JSImmediate.cpp | 103 + .../JavaScriptCore/runtime/JSImmediate.h | 790 + .../JavaScriptCore/runtime/JSLock.cpp | 254 + .../javascriptcore/JavaScriptCore/runtime/JSLock.h | 104 + .../JavaScriptCore/runtime/JSNotAnObject.cpp | 124 + .../JavaScriptCore/runtime/JSNotAnObject.h | 97 + .../JavaScriptCore/runtime/JSNumberCell.cpp | 137 + .../JavaScriptCore/runtime/JSNumberCell.h | 480 + .../JavaScriptCore/runtime/JSONObject.cpp | 766 + .../JavaScriptCore/runtime/JSONObject.h | 58 + .../JavaScriptCore/runtime/JSObject.cpp | 546 + .../JavaScriptCore/runtime/JSObject.h | 629 + .../runtime/JSPropertyNameIterator.cpp | 90 + .../runtime/JSPropertyNameIterator.h | 116 + .../JavaScriptCore/runtime/JSStaticScopeObject.cpp | 79 + .../JavaScriptCore/runtime/JSStaticScopeObject.h | 68 + .../JavaScriptCore/runtime/JSString.cpp | 171 + .../JavaScriptCore/runtime/JSString.h | 218 + .../javascriptcore/JavaScriptCore/runtime/JSType.h | 42 + .../JavaScriptCore/runtime/JSTypeInfo.h | 72 + .../JavaScriptCore/runtime/JSValue.cpp | 87 + .../JavaScriptCore/runtime/JSValue.h | 420 + .../JavaScriptCore/runtime/JSVariableObject.cpp | 70 + .../JavaScriptCore/runtime/JSVariableObject.h | 164 + .../JavaScriptCore/runtime/JSWrapperObject.cpp | 36 + .../JavaScriptCore/runtime/JSWrapperObject.h | 59 + .../JavaScriptCore/runtime/LiteralParser.cpp | 449 + .../JavaScriptCore/runtime/LiteralParser.h | 110 + .../JavaScriptCore/runtime/Lookup.cpp | 82 + .../javascriptcore/JavaScriptCore/runtime/Lookup.h | 265 + .../JavaScriptCore/runtime/MathObject.cpp | 242 + .../JavaScriptCore/runtime/MathObject.h | 45 + .../runtime/NativeErrorConstructor.cpp | 73 + .../runtime/NativeErrorConstructor.h | 51 + .../runtime/NativeErrorPrototype.cpp | 43 + .../JavaScriptCore/runtime/NativeErrorPrototype.h | 44 + .../JavaScriptCore/runtime/NativeFunctionWrapper.h | 39 + .../JavaScriptCore/runtime/NumberConstructor.cpp | 123 + .../JavaScriptCore/runtime/NumberConstructor.h | 55 + .../JavaScriptCore/runtime/NumberObject.cpp | 51 + .../JavaScriptCore/runtime/NumberObject.h | 44 + .../JavaScriptCore/runtime/NumberPrototype.cpp | 445 + .../JavaScriptCore/runtime/NumberPrototype.h | 35 + .../JavaScriptCore/runtime/ObjectConstructor.cpp | 73 + .../JavaScriptCore/runtime/ObjectConstructor.h | 41 + .../JavaScriptCore/runtime/ObjectPrototype.cpp | 135 + .../JavaScriptCore/runtime/ObjectPrototype.h | 37 + .../JavaScriptCore/runtime/Operations.cpp | 121 + .../JavaScriptCore/runtime/Operations.h | 334 + .../JavaScriptCore/runtime/PropertyMapHashTable.h | 90 + .../JavaScriptCore/runtime/PropertyNameArray.cpp | 50 + .../JavaScriptCore/runtime/PropertyNameArray.h | 113 + .../JavaScriptCore/runtime/PropertySlot.cpp | 45 + .../JavaScriptCore/runtime/PropertySlot.h | 203 + .../JavaScriptCore/runtime/Protect.h | 215 + .../JavaScriptCore/runtime/PrototypeFunction.cpp | 57 + .../JavaScriptCore/runtime/PrototypeFunction.h | 45 + .../JavaScriptCore/runtime/PutPropertySlot.h | 77 + .../JavaScriptCore/runtime/RegExp.cpp | 283 + .../javascriptcore/JavaScriptCore/runtime/RegExp.h | 89 + .../JavaScriptCore/runtime/RegExpConstructor.cpp | 392 + .../JavaScriptCore/runtime/RegExpConstructor.h | 82 + .../JavaScriptCore/runtime/RegExpMatchesArray.h | 87 + .../JavaScriptCore/runtime/RegExpObject.cpp | 168 + .../JavaScriptCore/runtime/RegExpObject.h | 83 + .../JavaScriptCore/runtime/RegExpPrototype.cpp | 123 + .../JavaScriptCore/runtime/RegExpPrototype.h | 38 + .../JavaScriptCore/runtime/ScopeChain.cpp | 68 + .../JavaScriptCore/runtime/ScopeChain.h | 240 + .../JavaScriptCore/runtime/ScopeChainMark.h | 39 + .../JavaScriptCore/runtime/SmallStrings.cpp | 128 + .../JavaScriptCore/runtime/SmallStrings.h | 74 + .../JavaScriptCore/runtime/StringConstructor.cpp | 91 + .../JavaScriptCore/runtime/StringConstructor.h | 40 + .../JavaScriptCore/runtime/StringObject.cpp | 112 + .../JavaScriptCore/runtime/StringObject.h | 73 + .../StringObjectThatMasqueradesAsUndefined.h | 55 + .../JavaScriptCore/runtime/StringPrototype.cpp | 895 + .../JavaScriptCore/runtime/StringPrototype.h | 42 + .../JavaScriptCore/runtime/Structure.cpp | 1156 + .../JavaScriptCore/runtime/Structure.h | 242 + .../JavaScriptCore/runtime/StructureChain.cpp | 66 + .../JavaScriptCore/runtime/StructureChain.h | 52 + .../runtime/StructureTransitionTable.h | 73 + .../JavaScriptCore/runtime/SymbolTable.h | 126 + .../JavaScriptCore/runtime/TimeoutChecker.cpp | 159 + .../JavaScriptCore/runtime/TimeoutChecker.h | 76 + .../JavaScriptCore/runtime/Tracing.d | 40 + .../JavaScriptCore/runtime/Tracing.h | 50 + .../JavaScriptCore/runtime/UString.cpp | 1781 + .../JavaScriptCore/runtime/UString.h | 604 + .../JavaScriptCore/wrec/CharacterClass.cpp | 140 + .../JavaScriptCore/wrec/CharacterClass.h | 68 + .../wrec/CharacterClassConstructor.cpp | 257 + .../wrec/CharacterClassConstructor.h | 99 + .../javascriptcore/JavaScriptCore/wrec/Escapes.h | 150 + .../JavaScriptCore/wrec/Quantifier.h | 66 + .../javascriptcore/JavaScriptCore/wrec/WREC.cpp | 86 + .../javascriptcore/JavaScriptCore/wrec/WREC.h | 54 + .../JavaScriptCore/wrec/WRECFunctors.cpp | 80 + .../JavaScriptCore/wrec/WRECFunctors.h | 109 + .../JavaScriptCore/wrec/WRECGenerator.cpp | 653 + .../JavaScriptCore/wrec/WRECGenerator.h | 128 + .../JavaScriptCore/wrec/WRECParser.cpp | 643 + .../JavaScriptCore/wrec/WRECParser.h | 214 + .../javascriptcore/JavaScriptCore/wtf/ASCIICType.h | 166 + .../javascriptcore/JavaScriptCore/wtf/AVLTree.h | 959 + .../JavaScriptCore/wtf/AlwaysInline.h | 63 + .../JavaScriptCore/wtf/Assertions.cpp | 207 + .../javascriptcore/JavaScriptCore/wtf/Assertions.h | 249 + .../JavaScriptCore/wtf/ByteArray.cpp | 38 + .../javascriptcore/JavaScriptCore/wtf/ByteArray.h | 80 + .../JavaScriptCore/wtf/CONTRIBUTORS.pthreads-win32 | 137 + .../JavaScriptCore/wtf/CrossThreadRefCounted.h | 169 + .../JavaScriptCore/wtf/CurrentTime.cpp | 232 + .../JavaScriptCore/wtf/CurrentTime.h | 47 + .../javascriptcore/JavaScriptCore/wtf/DateMath.cpp | 917 + .../javascriptcore/JavaScriptCore/wtf/DateMath.h | 192 + .../javascriptcore/JavaScriptCore/wtf/Deque.h | 669 + .../JavaScriptCore/wtf/DisallowCType.h | 74 + .../JavaScriptCore/wtf/FastAllocBase.h | 403 + .../JavaScriptCore/wtf/FastMalloc.cpp | 4148 ++ .../javascriptcore/JavaScriptCore/wtf/FastMalloc.h | 193 + .../javascriptcore/JavaScriptCore/wtf/Forward.h | 43 + .../javascriptcore/JavaScriptCore/wtf/GOwnPtr.cpp | 65 + .../javascriptcore/JavaScriptCore/wtf/GOwnPtr.h | 98 + .../javascriptcore/JavaScriptCore/wtf/GetPtr.h | 33 + .../JavaScriptCore/wtf/HashCountedSet.h | 205 + .../JavaScriptCore/wtf/HashFunctions.h | 186 + .../JavaScriptCore/wtf/HashIterators.h | 216 + .../javascriptcore/JavaScriptCore/wtf/HashMap.h | 337 + .../javascriptcore/JavaScriptCore/wtf/HashSet.h | 278 + .../JavaScriptCore/wtf/HashTable.cpp | 69 + .../javascriptcore/JavaScriptCore/wtf/HashTable.h | 1158 + .../javascriptcore/JavaScriptCore/wtf/HashTraits.h | 115 + .../JavaScriptCore/wtf/ListHashSet.h | 616 + .../javascriptcore/JavaScriptCore/wtf/ListRefPtr.h | 61 + .../javascriptcore/JavaScriptCore/wtf/Locker.h | 47 + .../JavaScriptCore/wtf/MainThread.cpp | 133 + .../javascriptcore/JavaScriptCore/wtf/MainThread.h | 59 + .../JavaScriptCore/wtf/MallocZoneSupport.h | 65 + .../javascriptcore/JavaScriptCore/wtf/MathExtras.h | 178 + .../JavaScriptCore/wtf/MessageQueue.h | 183 + .../JavaScriptCore/wtf/Noncopyable.h | 52 + .../javascriptcore/JavaScriptCore/wtf/NotFound.h | 37 + .../JavaScriptCore/wtf/OwnArrayPtr.h | 75 + .../JavaScriptCore/wtf/OwnFastMallocPtr.h | 52 + .../javascriptcore/JavaScriptCore/wtf/OwnPtr.h | 142 + .../JavaScriptCore/wtf/OwnPtrCommon.h | 61 + .../JavaScriptCore/wtf/OwnPtrWin.cpp | 76 + .../javascriptcore/JavaScriptCore/wtf/PassOwnPtr.h | 177 + .../javascriptcore/JavaScriptCore/wtf/PassRefPtr.h | 195 + .../javascriptcore/JavaScriptCore/wtf/Platform.h | 787 + .../JavaScriptCore/wtf/PtrAndFlags.h | 64 + .../JavaScriptCore/wtf/RandomNumber.cpp | 102 + .../JavaScriptCore/wtf/RandomNumber.h | 42 + .../JavaScriptCore/wtf/RandomNumberSeed.h | 89 + .../javascriptcore/JavaScriptCore/wtf/RefCounted.h | 137 + .../JavaScriptCore/wtf/RefCountedLeakCounter.cpp | 100 + .../JavaScriptCore/wtf/RefCountedLeakCounter.h | 48 + .../javascriptcore/JavaScriptCore/wtf/RefPtr.h | 206 + .../JavaScriptCore/wtf/RefPtrHashMap.h | 350 + .../javascriptcore/JavaScriptCore/wtf/RetainPtr.h | 203 + .../JavaScriptCore/wtf/SegmentedVector.h | 252 + .../JavaScriptCore/wtf/StdLibExtras.h | 63 + .../JavaScriptCore/wtf/StringExtras.h | 88 + .../JavaScriptCore/wtf/TCPackedCache.h | 234 + .../javascriptcore/JavaScriptCore/wtf/TCPageMap.h | 316 + .../javascriptcore/JavaScriptCore/wtf/TCSpinLock.h | 239 + .../JavaScriptCore/wtf/TCSystemAlloc.cpp | 469 + .../JavaScriptCore/wtf/TCSystemAlloc.h | 75 + .../JavaScriptCore/wtf/ThreadSpecific.h | 266 + .../JavaScriptCore/wtf/ThreadSpecificWin.cpp | 54 + .../JavaScriptCore/wtf/Threading.cpp | 97 + .../javascriptcore/JavaScriptCore/wtf/Threading.h | 332 + .../JavaScriptCore/wtf/ThreadingNone.cpp | 59 + .../JavaScriptCore/wtf/ThreadingPthreads.cpp | 375 + .../JavaScriptCore/wtf/ThreadingWin.cpp | 493 + .../JavaScriptCore/wtf/TypeTraits.cpp | 120 + .../javascriptcore/JavaScriptCore/wtf/TypeTraits.h | 339 + .../JavaScriptCore/wtf/UnusedParam.h | 29 + .../javascriptcore/JavaScriptCore/wtf/VMTags.h | 55 + .../javascriptcore/JavaScriptCore/wtf/Vector.h | 1014 + .../JavaScriptCore/wtf/VectorTraits.h | 102 + .../javascriptcore/JavaScriptCore/wtf/dtoa.cpp | 2379 ++ .../javascriptcore/JavaScriptCore/wtf/dtoa.h | 37 + .../JavaScriptCore/wtf/qt/MainThreadQt.cpp | 74 + .../JavaScriptCore/wtf/qt/ThreadingQt.cpp | 271 + .../JavaScriptCore/wtf/unicode/Collator.h | 67 + .../JavaScriptCore/wtf/unicode/CollatorDefault.cpp | 75 + .../JavaScriptCore/wtf/unicode/UTF8.cpp | 303 + .../JavaScriptCore/wtf/unicode/UTF8.h | 75 + .../JavaScriptCore/wtf/unicode/Unicode.h | 39 + .../wtf/unicode/glib/UnicodeGLib.cpp | 214 + .../JavaScriptCore/wtf/unicode/glib/UnicodeGLib.h | 238 + .../wtf/unicode/glib/UnicodeMacrosFromICU.h | 69 + .../JavaScriptCore/wtf/unicode/icu/CollatorICU.cpp | 150 + .../JavaScriptCore/wtf/unicode/icu/UnicodeIcu.h | 230 + .../JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h | 545 + .../JavaScriptCore/wtf/wince/FastMallocWince.h | 177 + .../JavaScriptCore/wtf/wince/MemoryManager.cpp | 171 + .../JavaScriptCore/wtf/wince/MemoryManager.h | 80 + .../JavaScriptCore/wtf/wince/mt19937ar.c | 170 + .../JavaScriptCore/yarr/RegexCompiler.cpp | 728 + .../JavaScriptCore/yarr/RegexCompiler.h | 45 + .../JavaScriptCore/yarr/RegexInterpreter.cpp | 1638 + .../JavaScriptCore/yarr/RegexInterpreter.h | 337 + .../JavaScriptCore/yarr/RegexJIT.cpp | 1418 + .../javascriptcore/JavaScriptCore/yarr/RegexJIT.h | 91 + .../JavaScriptCore/yarr/RegexParser.h | 854 + .../JavaScriptCore/yarr/RegexPattern.h | 356 + src/script/script.pro | 2 +- 481 files changed, 238766 insertions(+), 1 deletion(-) create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/APICast.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/JSBase.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/JSBase.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/JSBasePrivate.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackConstructor.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackConstructor.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackFunction.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackFunction.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackObject.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackObject.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackObjectFunctions.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/JSClassRef.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/JSClassRef.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/JSContextRef.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/JSContextRef.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/JSObjectRef.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/JSObjectRef.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/JSProfilerPrivate.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/JSProfilerPrivate.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/JSRetainPtr.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/JSStringRef.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/JSStringRef.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/JSStringRefBSTR.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/JSStringRefBSTR.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/JSStringRefCF.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/JSStringRefCF.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/JSValueRef.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/JSValueRef.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/JavaScript.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/JavaScriptCore.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/OpaqueJSString.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/OpaqueJSString.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/WebKitAvailability.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/AUTHORS create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/COPYING.LIB create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/ChangeLog create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/ChangeLog-2002-12-03 create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/ChangeLog-2003-10-25 create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/ChangeLog-2007-10-14 create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/ChangeLog-2008-08-10 create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/ChangeLog-2009-06-16 create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/DerivedSources.make create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/ForwardingHeaders/JavaScriptCore/APICast.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSBase.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSContextRef.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSObjectRef.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSRetainPtr.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSStringRef.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSStringRefCF.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSValueRef.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JavaScript.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JavaScriptCore.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/ForwardingHeaders/JavaScriptCore/OpaqueJSString.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/ForwardingHeaders/JavaScriptCore/WebKitAvailability.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/Info.plist create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/JavaScriptCore.gypi create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/JavaScriptCore.order create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/JavaScriptCore.pri create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/JavaScriptCore.pro create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/JavaScriptCorePrefix.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/THANKS create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/assembler/ARMAssembler.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/assembler/ARMAssembler.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/assembler/ARMv7Assembler.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/assembler/AbstractMacroAssembler.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/assembler/AssemblerBuffer.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/assembler/AssemblerBufferWithConstantPool.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/assembler/CodeLocation.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/assembler/LinkBuffer.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssembler.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssemblerARM.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssemblerARMv7.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssemblerCodeRef.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssemblerX86.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssemblerX86Common.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssemblerX86_64.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/assembler/RepatchBuffer.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/assembler/X86Assembler.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/bytecode/CodeBlock.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/bytecode/CodeBlock.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/bytecode/EvalCodeCache.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/bytecode/Instruction.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/bytecode/JumpTable.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/bytecode/JumpTable.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/bytecode/Opcode.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/bytecode/Opcode.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/bytecode/SamplingTool.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/bytecode/SamplingTool.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/bytecode/StructureStubInfo.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/bytecode/StructureStubInfo.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/bytecompiler/BytecodeGenerator.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/bytecompiler/Label.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/bytecompiler/LabelScope.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/bytecompiler/RegisterID.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/config.h create mode 100755 src/3rdparty/javascriptcore/JavaScriptCore/create_hash_table create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/debugger/Debugger.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/debugger/Debugger.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/debugger/DebuggerActivation.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/debugger/DebuggerActivation.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/debugger/DebuggerCallFrame.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/debugger/DebuggerCallFrame.h create mode 100755 src/3rdparty/javascriptcore/JavaScriptCore/docs/make-bytecode-docs.pl create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/generated/ArrayPrototype.lut.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/generated/DatePrototype.lut.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/generated/Grammar.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/generated/Grammar.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/generated/JSONObject.lut.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/generated/Lexer.lut.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/generated/MathObject.lut.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/generated/NumberConstructor.lut.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/generated/RegExpConstructor.lut.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/generated/RegExpObject.lut.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/generated/StringPrototype.lut.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/generated/chartables.c create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/headers.pri create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/interpreter/CachedCall.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/interpreter/CallFrame.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/interpreter/CallFrame.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/interpreter/CallFrameClosure.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/interpreter/Interpreter.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/interpreter/Interpreter.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/interpreter/Register.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/interpreter/RegisterFile.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/interpreter/RegisterFile.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/jit/ExecutableAllocator.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/jit/ExecutableAllocator.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/jit/ExecutableAllocatorFixedVMPool.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/jit/ExecutableAllocatorPosix.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/jit/ExecutableAllocatorWin.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/jit/JIT.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/jit/JIT.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/jit/JITArithmetic.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/jit/JITCall.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/jit/JITCode.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/jit/JITInlineMethods.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/jit/JITOpcodes.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/jit/JITPropertyAccess.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/jit/JITStubCall.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/jsc.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/jsc.pro create mode 100755 src/3rdparty/javascriptcore/JavaScriptCore/make-generated-sources.sh create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/os-win32/stdbool.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/os-win32/stdint.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/os-wince/ce_time.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/os-wince/ce_time.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/parser/Grammar.y create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/parser/Keywords.table create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/parser/Lexer.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/parser/Lexer.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/parser/NodeConstructors.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/parser/NodeInfo.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/parser/Nodes.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/parser/Nodes.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/parser/Parser.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/parser/Parser.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/parser/ParserArena.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/parser/ParserArena.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/parser/ResultType.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/parser/SourceCode.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/parser/SourcePoolQt.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/parser/SourcePoolQt.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/parser/SourceProvider.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/pcre/AUTHORS create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/pcre/COPYING create mode 100755 src/3rdparty/javascriptcore/JavaScriptCore/pcre/dftables create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/pcre/pcre.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/pcre/pcre.pri create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/pcre/pcre_compile.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/pcre/pcre_exec.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/pcre/pcre_internal.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/pcre/pcre_tables.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/pcre/pcre_ucp_searchfuncs.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/pcre/pcre_xclass.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/pcre/ucpinternal.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/pcre/ucptable.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/profiler/CallIdentifier.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/profiler/HeavyProfile.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/profiler/HeavyProfile.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/profiler/Profile.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/profiler/Profile.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/profiler/ProfileGenerator.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/profiler/ProfileGenerator.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/profiler/ProfileNode.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/profiler/ProfileNode.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/profiler/Profiler.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/profiler/Profiler.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/profiler/ProfilerServer.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/profiler/ProfilerServer.mm create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/profiler/TreeProfile.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/profiler/TreeProfile.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/ArgList.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/ArgList.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/Arguments.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/Arguments.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/ArrayConstructor.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/ArrayConstructor.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/ArrayPrototype.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/ArrayPrototype.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/BatchedTransitionOptimizer.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/BooleanConstructor.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/BooleanConstructor.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/BooleanObject.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/BooleanObject.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/BooleanPrototype.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/BooleanPrototype.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/CallData.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/CallData.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/ClassInfo.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/CollectorHeapIterator.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/CommonIdentifiers.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/CommonIdentifiers.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/Completion.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/Completion.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/ConstructData.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/ConstructData.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/DateConstructor.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/DateConstructor.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/DateConversion.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/DateConversion.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/DateInstance.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/DateInstance.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/DatePrototype.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/DatePrototype.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/Error.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/Error.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/ErrorConstructor.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/ErrorConstructor.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/ErrorInstance.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/ErrorInstance.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/ErrorPrototype.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/ErrorPrototype.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/ExceptionHelpers.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/ExceptionHelpers.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/FunctionConstructor.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/FunctionConstructor.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/FunctionPrototype.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/FunctionPrototype.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/GetterSetter.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/GetterSetter.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/GlobalEvalFunction.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/GlobalEvalFunction.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/Identifier.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/Identifier.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/InitializeThreading.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/InitializeThreading.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/InternalFunction.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/InternalFunction.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSActivation.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSActivation.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSArray.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSArray.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSByteArray.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSByteArray.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSCell.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSCell.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSFunction.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSFunction.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSGlobalData.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSGlobalData.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSGlobalObject.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSGlobalObject.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSGlobalObjectFunctions.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSImmediate.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSImmediate.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSLock.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSLock.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSNotAnObject.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSNotAnObject.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSNumberCell.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSNumberCell.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSONObject.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSONObject.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSObject.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSObject.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSPropertyNameIterator.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSPropertyNameIterator.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSStaticScopeObject.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSStaticScopeObject.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSString.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSString.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSType.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSTypeInfo.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSValue.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSValue.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSVariableObject.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSVariableObject.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSWrapperObject.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSWrapperObject.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/LiteralParser.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/LiteralParser.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/Lookup.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/Lookup.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/MathObject.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/MathObject.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/NativeErrorConstructor.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/NativeErrorConstructor.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/NativeErrorPrototype.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/NativeErrorPrototype.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/NativeFunctionWrapper.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/NumberConstructor.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/NumberConstructor.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/NumberObject.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/NumberObject.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/NumberPrototype.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/NumberPrototype.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/ObjectConstructor.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/ObjectConstructor.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/ObjectPrototype.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/ObjectPrototype.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/Operations.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/Operations.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/PropertyMapHashTable.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/PropertyNameArray.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/PropertyNameArray.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/PropertySlot.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/PropertySlot.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/Protect.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/PrototypeFunction.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/PrototypeFunction.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/PutPropertySlot.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/RegExp.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/RegExp.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/RegExpConstructor.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/RegExpConstructor.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/RegExpMatchesArray.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/RegExpObject.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/RegExpObject.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/RegExpPrototype.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/RegExpPrototype.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/ScopeChain.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/ScopeChain.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/ScopeChainMark.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/SmallStrings.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/SmallStrings.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/StringConstructor.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/StringConstructor.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/StringObject.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/StringObject.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/StringObjectThatMasqueradesAsUndefined.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/StringPrototype.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/StringPrototype.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/Structure.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/Structure.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/StructureChain.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/StructureChain.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/StructureTransitionTable.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/SymbolTable.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/TimeoutChecker.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/TimeoutChecker.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/Tracing.d create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/Tracing.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/UString.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/UString.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wrec/CharacterClass.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wrec/CharacterClass.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wrec/CharacterClassConstructor.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wrec/CharacterClassConstructor.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wrec/Escapes.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wrec/Quantifier.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wrec/WREC.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wrec/WREC.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wrec/WRECFunctors.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wrec/WRECFunctors.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wrec/WRECGenerator.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wrec/WRECGenerator.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wrec/WRECParser.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wrec/WRECParser.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/ASCIICType.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/AVLTree.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/AlwaysInline.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/ByteArray.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/ByteArray.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/CONTRIBUTORS.pthreads-win32 create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/CrossThreadRefCounted.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/CurrentTime.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/CurrentTime.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/DateMath.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/DateMath.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/Deque.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/DisallowCType.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/FastAllocBase.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/FastMalloc.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/FastMalloc.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/Forward.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/GOwnPtr.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/GOwnPtr.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/GetPtr.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/HashCountedSet.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/HashFunctions.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/HashIterators.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/HashMap.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/HashSet.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/HashTable.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/HashTable.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/HashTraits.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/ListHashSet.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/ListRefPtr.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/Locker.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/MainThread.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/MainThread.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/MallocZoneSupport.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/MathExtras.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/MessageQueue.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/Noncopyable.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/NotFound.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/OwnArrayPtr.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/OwnFastMallocPtr.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/OwnPtr.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/OwnPtrCommon.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/OwnPtrWin.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/PassOwnPtr.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/PassRefPtr.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/PtrAndFlags.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/RandomNumber.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/RandomNumber.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/RandomNumberSeed.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/RefCounted.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/RefCountedLeakCounter.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/RefCountedLeakCounter.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/RefPtr.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/RefPtrHashMap.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/RetainPtr.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/SegmentedVector.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/StdLibExtras.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/StringExtras.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/TCPackedCache.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/TCPageMap.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/TCSpinLock.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/TCSystemAlloc.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/TCSystemAlloc.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/ThreadSpecific.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/ThreadSpecificWin.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/ThreadingNone.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/ThreadingPthreads.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/ThreadingWin.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/TypeTraits.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/TypeTraits.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/UnusedParam.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/VMTags.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/Vector.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/VectorTraits.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/dtoa.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/dtoa.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/qt/MainThreadQt.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/qt/ThreadingQt.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/unicode/Collator.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/unicode/CollatorDefault.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/unicode/UTF8.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/unicode/UTF8.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/unicode/Unicode.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/unicode/glib/UnicodeGLib.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/unicode/glib/UnicodeGLib.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/unicode/glib/UnicodeMacrosFromICU.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/unicode/icu/CollatorICU.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/unicode/icu/UnicodeIcu.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/wince/FastMallocWince.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/wince/MemoryManager.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/wince/MemoryManager.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/wince/mt19937ar.c create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/yarr/RegexCompiler.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/yarr/RegexCompiler.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/yarr/RegexInterpreter.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/yarr/RegexInterpreter.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/yarr/RegexJIT.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/yarr/RegexJIT.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/yarr/RegexParser.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/yarr/RegexPattern.h diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/APICast.h b/src/3rdparty/javascriptcore/JavaScriptCore/API/APICast.h new file mode 100644 index 0000000..762a15e --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/APICast.h @@ -0,0 +1,133 @@ +/* + * 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 "JSNumberCell.h" +#include "JSValue.h" +#include +#include + +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) +{ + return reinterpret_cast(const_cast(c)); +} + +inline JSC::ExecState* toJS(JSGlobalContextRef c) +{ + return reinterpret_cast(c); +} + +inline JSC::JSValue toJS(JSC::ExecState* exec, JSValueRef v) +{ + JSC::JSValue jsValue = JSC::JSValue::decode(reinterpret_cast(const_cast(v))); +#if USE(ALTERNATE_JSIMMEDIATE) + UNUSED_PARAM(exec); +#else + if (jsValue && jsValue.isNumber()) { + ASSERT(jsValue.isAPIMangledNumber()); + return JSC::jsNumber(exec, jsValue.uncheckedGetNumber()); + } +#endif + return jsValue; +} + +inline JSC::JSObject* toJS(JSObjectRef o) +{ + return reinterpret_cast(o); +} + +inline JSC::PropertyNameArray* toJS(JSPropertyNameAccumulatorRef a) +{ + return reinterpret_cast(a); +} + +inline JSC::JSGlobalData* toJS(JSContextGroupRef g) +{ + return reinterpret_cast(const_cast(g)); +} + +inline JSValueRef toRef(JSC::ExecState* exec, JSC::JSValue v) +{ +#if USE(ALTERNATE_JSIMMEDIATE) + UNUSED_PARAM(exec); +#else + if (v && v.isNumber()) { + ASSERT(!v.isAPIMangledNumber()); + return reinterpret_cast(JSC::JSValue::encode(JSC::jsAPIMangledNumber(exec, v.uncheckedGetNumber()))); + } +#endif + return reinterpret_cast(JSC::JSValue::encode(v)); +} + +inline JSObjectRef toRef(JSC::JSObject* o) +{ + return reinterpret_cast(o); +} + +inline JSObjectRef toRef(const JSC::JSObject* o) +{ + return reinterpret_cast(const_cast(o)); +} + +inline JSContextRef toRef(JSC::ExecState* e) +{ + return reinterpret_cast(e); +} + +inline JSGlobalContextRef toGlobalRef(JSC::ExecState* e) +{ + return reinterpret_cast(e); +} + +inline JSPropertyNameAccumulatorRef toRef(JSC::PropertyNameArray* l) +{ + return reinterpret_cast(l); +} + +inline JSContextGroupRef toRef(JSC::JSGlobalData* g) +{ + return reinterpret_cast(g); +} + +#endif // APICast_h diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSBase.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSBase.cpp new file mode 100644 index 0000000..4a32d35 --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSBase.cpp @@ -0,0 +1,116 @@ +/* + * 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 "Completion.h" +#include "OpaqueJSString.h" +#include "SourceCode.h" +#include +#include +#include +#include +#include +#include + +using namespace JSC; + +JSValueRef JSEvaluateScript(JSContextRef ctx, JSStringRef script, JSObjectRef thisObject, JSStringRef sourceURL, int startingLineNumber, JSValueRef* exception) +{ + ExecState* exec = toJS(ctx); + exec->globalData().heap.registerThread(); + JSLock lock(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); + exec->globalData().heap.registerThread(); + JSLock lock(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); + JSGlobalData& globalData = exec->globalData(); + + JSLock lock(globalData.isSharedInstance ? LockForReal : SilenceAssertionsOnly); + + if (!globalData.heap.isBusy()) + globalData.heap.collect(); + + // 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); + exec->globalData().heap.registerThread(); + JSLock lock(exec); + + exec->globalData().heap.reportExtraMemoryCost(size); +} diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSBase.h b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSBase.h new file mode 100644 index 0000000..9f3d88e --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSBase.h @@ -0,0 +1,144 @@ +/* + * 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 +#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(BUILDING_WX__) + #define JS_EXPORT +#elif defined(__GNUC__) + #define JS_EXPORT __attribute__((visibility("default"))) +#elif defined(_WIN32_WCE) + #if defined(JS_BUILDING_JS) + #define JS_EXPORT __declspec(dllexport) + #elif defined(JS_IMPORT_JS) + #define JS_EXPORT __declspec(dllimport) + #else + #define JS_EXPORT + #endif +#elif defined(WIN32) || defined(_WIN32) + /* + * TODO: Export symbols with JS_EXPORT when using MSVC. + * See http://bugs.webkit.org/show_bug.cgi?id=16227 + */ + #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/javascriptcore/JavaScriptCore/API/JSBasePrivate.h b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSBasePrivate.h new file mode 100644 index 0000000..befa316 --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSBasePrivate.h @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2008 Apple Computer, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef JSBasePrivate_h +#define JSBasePrivate_h + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/*! +@function +@abstract Reports an object's non-GC memory payload to the garbage collector. +@param ctx The execution context to use. +@param size The payload's size, in bytes. +@discussion Use this function to notify the garbage collector that a GC object +owns a large non-GC memory region. Calling this function will encourage the +garbage collector to collect soon, hoping to reclaim that large non-GC memory +region. +*/ +JS_EXPORT void JSReportExtraMemoryCost(JSContextRef ctx, size_t size) AVAILABLE_IN_WEBKIT_VERSION_4_0; + +#ifdef __cplusplus +} +#endif + +#endif /* JSBasePrivate_h */ diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackConstructor.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackConstructor.cpp new file mode 100644 index 0000000..64c83cb --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackConstructor.cpp @@ -0,0 +1,86 @@ +/* + * 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 "APICast.h" +#include +#include +#include +#include + +namespace JSC { + +const ClassInfo JSCallbackConstructor::info = { "CallbackConstructor", 0, 0, 0 }; + +JSCallbackConstructor::JSCallbackConstructor(PassRefPtr 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(constructor)->callback(); + if (callback) { + int argumentCount = static_cast(args.size()); + Vector arguments(argumentCount); + for (int i = 0; i < argumentCount; i++) + arguments[i] = toRef(exec, args.at(i)); + + JSValueRef exception = 0; + JSObjectRef result; + { + JSLock::DropAllLocks dropAllLocks(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(constructor)->classRef(), 0)); +} + +ConstructType JSCallbackConstructor::getConstructData(ConstructData& constructData) +{ + constructData.native.function = constructJSCallback; + return ConstructTypeHost; +} + +} // namespace JSC diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackConstructor.h b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackConstructor.h new file mode 100644 index 0000000..1f06249 --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackConstructor.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 JSCallbackConstructor_h +#define JSCallbackConstructor_h + +#include "JSObjectRef.h" +#include + +namespace JSC { + +class JSCallbackConstructor : public JSObject { +public: + JSCallbackConstructor(PassRefPtr, JSClassRef, JSObjectCallAsConstructorCallback); + virtual ~JSCallbackConstructor(); + JSClassRef classRef() const { return m_class; } + JSObjectCallAsConstructorCallback callback() const { return m_callback; } + static const ClassInfo info; + + static PassRefPtr createStructure(JSValue proto) + { + return Structure::create(proto, TypeInfo(ObjectType, ImplementsHasInstance | HasStandardGetOwnPropertySlot)); + } + +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/javascriptcore/JavaScriptCore/API/JSCallbackFunction.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackFunction.cpp new file mode 100644 index 0000000..1b3217b --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackFunction.cpp @@ -0,0 +1,78 @@ +/* + * 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 +#include "JSCallbackFunction.h" + +#include "APICast.h" +#include "JSFunction.h" +#include "FunctionPrototype.h" +#include +#include +#include + +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(args.size()); + Vector arguments(argumentCount); + for (int i = 0; i < argumentCount; i++) + arguments[i] = toRef(exec, args.at(i)); + + JSValueRef exception = 0; + JSValueRef result; + { + JSLock::DropAllLocks dropAllLocks(exec); + result = static_cast(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/javascriptcore/JavaScriptCore/API/JSCallbackFunction.h b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackFunction.h new file mode 100644 index 0000000..7dd87b5 --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackFunction.h @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef JSCallbackFunction_h +#define JSCallbackFunction_h + +#include "InternalFunction.h" +#include "JSObjectRef.h" + +namespace JSC { + +class JSCallbackFunction : public InternalFunction { +public: + JSCallbackFunction(ExecState*, 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 createStructure(JSValue proto) + { + return Structure::create(proto, TypeInfo(ObjectType, HasStandardGetOwnPropertySlot)); + } + +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/javascriptcore/JavaScriptCore/API/JSCallbackObject.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackObject.cpp new file mode 100644 index 0000000..2fde0f8 --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackObject.cpp @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2007 Eric Seidel + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this 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); +ASSERT_CLASS_FITS_IN_CELL(JSCallbackObject); + +// Define the two types of JSCallbackObjects we support. +template <> const ClassInfo JSCallbackObject::info = { "CallbackObject", 0, 0, 0 }; +template <> const ClassInfo JSCallbackObject::info = { "CallbackGlobalObject", 0, 0, 0 }; + +} // namespace JSC diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackObject.h b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackObject.h new file mode 100644 index 0000000..4360baa --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackObject.h @@ -0,0 +1,114 @@ +/* + * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2007 Eric Seidel + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this 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 { + +template +class JSCallbackObject : public Base { +public: + JSCallbackObject(ExecState*, PassRefPtr, 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 createStructure(JSValue proto) + { + return Structure::create(proto, TypeInfo(ObjectType, ImplementsHasInstance | OverridesHasInstance)); + } + +private: + virtual UString className() const; + + virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&); + virtual bool getOwnPropertySlot(ExecState*, unsigned, PropertySlot&); + + virtual void put(ExecState*, const Identifier&, JSValue, PutPropertySlot&); + + virtual bool deleteProperty(ExecState*, const Identifier&, bool checkDontDelete = true); + virtual bool deleteProperty(ExecState*, unsigned, bool checkDontDelete = true); + + virtual bool hasInstance(ExecState* exec, JSValue value, JSValue proto); + + virtual void getPropertyNames(ExecState*, PropertyNameArray&, unsigned listedAttributes = Structure::Prototype); + + 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; } + + 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*, const Identifier&, const PropertySlot&); + static JSValue staticFunctionGetter(ExecState*, const Identifier&, const PropertySlot&); + static JSValue callbackGetter(ExecState*, const Identifier&, const PropertySlot&); + + struct JSCallbackObjectData { + JSCallbackObjectData(void* privateData, JSClassRef jsClass) + : privateData(privateData) + , jsClass(jsClass) + { + JSClassRetain(jsClass); + } + + ~JSCallbackObjectData() + { + JSClassRelease(jsClass); + } + + void* privateData; + JSClassRef jsClass; + }; + + OwnPtr m_callbackObjectData; +}; + +} // namespace JSC + +// include the actual template class implementation +#include "JSCallbackObjectFunctions.h" + +#endif // JSCallbackObject_h diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackObjectFunctions.h b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackObjectFunctions.h new file mode 100644 index 0000000..669b3cd --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackObjectFunctions.h @@ -0,0 +1,570 @@ +/* + * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2007 Eric Seidel + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this 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 "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 + +namespace JSC { + +template +inline JSCallbackObject* JSCallbackObject::asCallbackObject(JSValue value) +{ + ASSERT(asObject(value)->inherits(&info)); + return static_cast(asObject(value)); +} + +template +JSCallbackObject::JSCallbackObject(ExecState* exec, PassRefPtr 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 +JSCallbackObject::JSCallbackObject(JSClassRef jsClass) + : Base() + , m_callbackObjectData(new JSCallbackObjectData(0, jsClass)) +{ + ASSERT(Base::isGlobalObject()); + init(static_cast(this)->globalExec()); +} + +template +void JSCallbackObject::init(ExecState* exec) +{ + ASSERT(exec); + + Vector 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(initRoutines.size()) - 1; i >= 0; i--) { + JSLock::DropAllLocks dropAllLocks(exec); + JSObjectInitializeCallback initialize = initRoutines[i]; + initialize(toRef(exec), toRef(this)); + } +} + +template +JSCallbackObject::~JSCallbackObject() +{ + JSObjectRef thisRef = toRef(this); + + for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass) + if (JSObjectFinalizeCallback finalize = jsClass->finalize) + finalize(thisRef); +} + +template +UString JSCallbackObject::className() const +{ + UString thisClassName = classRef()->className(); + if (!thisClassName.isEmpty()) + return thisClassName; + + return Base::className(); +} + +template +bool JSCallbackObject::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +{ + JSContextRef ctx = toRef(exec); + JSObjectRef thisRef = toRef(this); + RefPtr 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()); + JSLock::DropAllLocks dropAllLocks(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; + { + JSLock::DropAllLocks dropAllLocks(exec); + value = getProperty(ctx, thisRef, propertyNameRef.get(), &exception); + } + exec->setException(toJS(exec, exception)); + if (value) { + slot.setValue(toJS(exec, value)); + return true; + } + if (exception) { + slot.setValue(jsUndefined()); + 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 +bool JSCallbackObject::getOwnPropertySlot(ExecState* exec, unsigned propertyName, PropertySlot& slot) +{ + return getOwnPropertySlot(exec, Identifier::from(exec, propertyName), slot); +} + +template +void JSCallbackObject::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) +{ + JSContextRef ctx = toRef(exec); + JSObjectRef thisRef = toRef(this); + RefPtr 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; + { + JSLock::DropAllLocks dropAllLocks(exec); + result = setProperty(ctx, thisRef, propertyNameRef.get(), valueRef, &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; + { + JSLock::DropAllLocks dropAllLocks(exec); + result = setProperty(ctx, thisRef, propertyNameRef.get(), valueRef, &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::putDirect(propertyName, value); // put as override property + return; + } + } + } + + return Base::put(exec, propertyName, value, slot); +} + +template +bool JSCallbackObject::deleteProperty(ExecState* exec, const Identifier& propertyName, bool checkDontDelete) +{ + JSContextRef ctx = toRef(exec); + JSObjectRef thisRef = toRef(this); + RefPtr 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; + { + JSLock::DropAllLocks dropAllLocks(exec); + result = deleteProperty(ctx, thisRef, propertyNameRef.get(), &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, checkDontDelete); +} + +template +bool JSCallbackObject::deleteProperty(ExecState* exec, unsigned propertyName, bool checkDontDelete) +{ + return deleteProperty(exec, Identifier::from(exec, propertyName), checkDontDelete); +} + +template +ConstructType JSCallbackObject::getConstructData(ConstructData& constructData) +{ + for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass) { + if (jsClass->callAsConstructor) { + constructData.native.function = construct; + return ConstructTypeHost; + } + } + return ConstructTypeNone; +} + +template +JSObject* JSCallbackObject::construct(ExecState* exec, JSObject* constructor, const ArgList& args) +{ + JSContextRef execRef = toRef(exec); + JSObjectRef constructorRef = toRef(constructor); + + for (JSClassRef jsClass = static_cast*>(constructor)->classRef(); jsClass; jsClass = jsClass->parentClass) { + if (JSObjectCallAsConstructorCallback callAsConstructor = jsClass->callAsConstructor) { + int argumentCount = static_cast(args.size()); + Vector arguments(argumentCount); + for (int i = 0; i < argumentCount; i++) + arguments[i] = toRef(exec, args.at(i)); + JSValueRef exception = 0; + JSObject* result; + { + JSLock::DropAllLocks dropAllLocks(exec); + result = toJS(callAsConstructor(execRef, constructorRef, argumentCount, arguments.data(), &exception)); + } + exec->setException(toJS(exec, exception)); + return result; + } + } + + ASSERT_NOT_REACHED(); // getConstructData should prevent us from reaching here + return 0; +} + +template +bool JSCallbackObject::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 exception = 0; + bool result; + { + JSLock::DropAllLocks dropAllLocks(exec); + result = hasInstance(execRef, thisRef, toRef(exec, value), &exception); + } + exec->setException(toJS(exec, exception)); + return result; + } + } + return false; +} + +template +CallType JSCallbackObject::getCallData(CallData& callData) +{ + for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass) { + if (jsClass->callAsFunction) { + callData.native.function = call; + return CallTypeHost; + } + } + return CallTypeNone; +} + +template +JSValue JSCallbackObject::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*>(functionObject)->classRef(); jsClass; jsClass = jsClass->parentClass) { + if (JSObjectCallAsFunctionCallback callAsFunction = jsClass->callAsFunction) { + int argumentCount = static_cast(args.size()); + Vector arguments(argumentCount); + for (int i = 0; i < argumentCount; i++) + arguments[i] = toRef(exec, args.at(i)); + JSValueRef exception = 0; + JSValue result; + { + JSLock::DropAllLocks dropAllLocks(exec); + result = toJS(exec, callAsFunction(execRef, functionRef, thisObjRef, argumentCount, arguments.data(), &exception)); + } + exec->setException(toJS(exec, exception)); + return result; + } + } + + ASSERT_NOT_REACHED(); // getCallData should prevent us from reaching here + return JSValue(); +} + +template +void JSCallbackObject::getPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, unsigned listedAttributes) +{ + JSContextRef execRef = toRef(exec); + JSObjectRef thisRef = toRef(this); + + for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass) { + if (JSObjectGetPropertyNamesCallback getPropertyNames = jsClass->getPropertyNames) { + JSLock::DropAllLocks dropAllLocks(exec); + getPropertyNames(execRef, thisRef, toRef(&propertyNames), listedAttributes); + } + + 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)) + 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)) + propertyNames.add(Identifier(exec, name)); + } + } + } + + Base::getPropertyNames(exec, propertyNames, listedAttributes); +} + +template +double JSCallbackObject::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; + { + JSLock::DropAllLocks dropAllLocks(exec); + value = convertToType(ctx, thisRef, kJSTypeNumber, &exception); + } + exec->setException(toJS(exec, exception)); + if (value) { + double dValue; + return toJS(exec, value).getNumber(dValue) ? dValue : NaN; + } + } + + return Base::toNumber(exec); +} + +template +UString JSCallbackObject::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; + { + JSLock::DropAllLocks dropAllLocks(exec); + value = convertToType(ctx, thisRef, kJSTypeString, &exception); + } + exec->setException(toJS(exec, exception)); + if (value) + return toJS(exec, value).getString(); + if (exception) + return ""; + } + + return Base::toString(exec); +} + +template +void JSCallbackObject::setPrivate(void* data) +{ + m_callbackObjectData->privateData = data; +} + +template +void* JSCallbackObject::getPrivate() +{ + return m_callbackObjectData->privateData; +} + +template +bool JSCallbackObject::inherits(JSClassRef c) const +{ + for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass) + if (jsClass == c) + return true; + + return false; +} + +template +JSValue JSCallbackObject::staticValueGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot) +{ + JSCallbackObject* thisObj = asCallbackObject(slot.slotBase()); + + JSObjectRef thisRef = toRef(thisObj); + RefPtr 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; + { + JSLock::DropAllLocks dropAllLocks(exec); + value = getProperty(toRef(exec), thisRef, propertyNameRef.get(), &exception); + } + exec->setException(toJS(exec, exception)); + if (value) + return toJS(exec, value); + if (exception) + return jsUndefined(); + } + + return throwError(exec, ReferenceError, "Static value property defined with NULL getProperty callback."); +} + +template +JSValue JSCallbackObject::staticFunctionGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot) +{ + JSCallbackObject* thisObj = asCallbackObject(slot.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 +JSValue JSCallbackObject::callbackGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot) +{ + JSCallbackObject* thisObj = asCallbackObject(slot.slotBase()); + + JSObjectRef thisRef = toRef(thisObj); + RefPtr 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; + { + JSLock::DropAllLocks dropAllLocks(exec); + value = getProperty(toRef(exec), thisRef, propertyNameRef.get(), &exception); + } + exec->setException(toJS(exec, exception)); + if (value) + return toJS(exec, value); + if (exception) + return jsUndefined(); + } + + return throwError(exec, ReferenceError, "hasProperty callback returned true for a property that doesn't exist."); +} + +} // namespace JSC diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSClassRef.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSClassRef.cpp new file mode 100644 index 0000000..afde7ce --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSClassRef.cpp @@ -0,0 +1,244 @@ +/* + * 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 +#include +#include +#include + +using namespace JSC; + +const JSClassDefinition kJSClassDefinitionEmpty = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + +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(UString::Rep::createFromUTF8(definition->className)) + , m_staticValues(0) + , m_staticFunctions(0) +{ + initializeThreading(); + + if (const JSStaticValue* staticValue = definition->staticValues) { + m_staticValues = new OpaqueJSClassStaticValuesTable(); + while (staticValue->name) { + m_staticValues->add(UString::Rep::createFromUTF8(staticValue->name), + new StaticValueEntry(staticValue->getProperty, staticValue->setProperty, staticValue->attributes)); + ++staticValue; + } + } + + if (const JSStaticFunction* staticFunction = definition->staticFunctions) { + m_staticFunctions = new OpaqueJSClassStaticFunctionsTable(); + while (staticFunction->name) { + m_staticFunctions->add(UString::Rep::createFromUTF8(staticFunction->name), + new StaticFunctionEntry(staticFunction->callAsFunction, staticFunction->attributes)); + ++staticFunction; + } + } + + if (protoClass) + prototypeClass = JSClassRetain(protoClass); +} + +OpaqueJSClass::~OpaqueJSClass() +{ + ASSERT(!m_className.rep()->identifierTable()); + + if (m_staticValues) { + OpaqueJSClassStaticValuesTable::const_iterator end = m_staticValues->end(); + for (OpaqueJSClassStaticValuesTable::const_iterator it = m_staticValues->begin(); it != end; ++it) { + ASSERT(!it->first->identifierTable()); + 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->identifierTable()); + delete it->second; + } + delete m_staticFunctions; + } + + if (prototypeClass) + JSClassRelease(prototypeClass); +} + +PassRefPtr OpaqueJSClass::createNoAutomaticPrototype(const JSClassDefinition* definition) +{ + return adoptRef(new OpaqueJSClass(definition, 0)); +} + +static void clearReferenceToPrototype(JSObjectRef prototype) +{ + OpaqueJSClassContextData* jsClassData = static_cast(JSObjectGetPrivate(prototype)); + ASSERT(jsClassData); + jsClassData->cachedPrototype = 0; +} + +PassRefPtr OpaqueJSClass::create(const JSClassDefinition* definition) +{ + if (const JSStaticFunction* staticFunctions = definition->staticFunctions) { + // copy functions into a prototype class + JSClassDefinition protoDefinition = kJSClassDefinitionEmpty; + protoDefinition.staticFunctions = staticFunctions; + protoDefinition.finalize = clearReferenceToPrototype; + + // 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 protoClass = adoptRef(new OpaqueJSClass(&protoDefinition, 0)); + + // remove functions from the original class + JSClassDefinition objectDefinition = *definition; + objectDefinition.staticFunctions = 0; + + return adoptRef(new OpaqueJSClass(&objectDefinition, protoClass.get())); + } + + return adoptRef(new OpaqueJSClass(definition, 0)); +} + +OpaqueJSClassContextData::OpaqueJSClassContextData(OpaqueJSClass* jsClass) + : m_class(jsClass) + , cachedPrototype(0) +{ + 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->identifierTable()); + staticValues->add(UString::Rep::createCopying(it->first->data(), it->first->size()), + new StaticValueEntry(it->second->getProperty, it->second->setProperty, it->second->attributes)); + } + + } 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->identifierTable()); + staticFunctions->add(UString::Rep::createCopying(it->first->data(), it->first->size()), + new StaticFunctionEntry(it->second->callAsFunction, it->second->attributes)); + } + + } 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(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; +} diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSClassRef.h b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSClassRef.h new file mode 100644 index 0000000..c742d96 --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSClassRef.h @@ -0,0 +1,122 @@ +/* + * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef JSClassRef_h +#define JSClassRef_h + +#include "JSObjectRef.h" + +#include +#include +#include +#include +#include + +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, StaticValueEntry*> OpaqueJSClassStaticValuesTable; +typedef HashMap, StaticFunctionEntry*> OpaqueJSClassStaticFunctionsTable; + +class 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 m_class; + + OpaqueJSClassStaticValuesTable* staticValues; + OpaqueJSClassStaticFunctionsTable* staticFunctions; + JSC::JSObject* cachedPrototype; +}; + +struct OpaqueJSClass : public ThreadSafeShared { + static PassRefPtr create(const JSClassDefinition*); + static PassRefPtr 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/javascriptcore/JavaScriptCore/API/JSContextRef.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSContextRef.cpp new file mode 100644 index 0000000..c358a84 --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSContextRef.cpp @@ -0,0 +1,154 @@ +/* + * 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 "APICast.h" +#include "InitializeThreading.h" +#include "JSCallbackObject.h" +#include "JSClassRef.h" +#include "JSGlobalObject.h" +#include "JSObject.h" +#include + +#if PLATFORM(DARWIN) +#include + +static const int32_t webkitFirstVersionWithConcurrentGlobalContexts = 0x2100500; // 528.5.0 +#endif + +using namespace JSC; + +JSContextGroupRef JSContextGroupCreate() +{ + initializeThreading(); + return toRef(JSGlobalData::create().releaseRef()); +} + +JSContextGroupRef JSContextGroupRetain(JSContextGroupRef group) +{ + toJS(group)->ref(); + return group; +} + +void JSContextGroupRelease(JSContextGroupRef group) +{ + toJS(group)->deref(); +} + +JSGlobalContextRef JSGlobalContextCreate(JSClassRef globalObjectClass) +{ + initializeThreading(); +#if PLATFORM(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 // PLATFORM(DARWIN) + + return JSGlobalContextCreateInGroup(0, globalObjectClass); +} + +JSGlobalContextRef JSGlobalContextCreateInGroup(JSContextGroupRef group, JSClassRef globalObjectClass) +{ + initializeThreading(); + + JSLock lock(LockForReal); + + RefPtr globalData = group ? PassRefPtr(toJS(group)) : JSGlobalData::create(); + +#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(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); + JSLock lock(exec); + + JSGlobalData& globalData = exec->globalData(); + + globalData.heap.registerThread(); + + gcProtect(exec->dynamicGlobalObject()); + globalData.ref(); + return ctx; +} + +void JSGlobalContextRelease(JSGlobalContextRef ctx) +{ + ExecState* exec = toJS(ctx); + JSLock lock(exec); + + gcUnprotect(exec->dynamicGlobalObject()); + + JSGlobalData& globalData = exec->globalData(); + if (globalData.refCount() == 2) { // One reference is held by JSGlobalObject, another added by JSGlobalContextRetain(). + // The last reference was released, this is our last chance to collect. + ASSERT(!globalData.heap.protectedObjectCount()); + ASSERT(!globalData.heap.isBusy()); + globalData.heap.destroy(); + } else + globalData.heap.collect(); + + globalData.deref(); +} + +JSObjectRef JSContextGetGlobalObject(JSContextRef ctx) +{ + ExecState* exec = toJS(ctx); + exec->globalData().heap.registerThread(); + JSLock lock(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()); +} diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSContextRef.h b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSContextRef.h new file mode 100644 index 0000000..c5c8a71 --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSContextRef.h @@ -0,0 +1,132 @@ +/* + * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef JSContextRef_h +#define JSContextRef_h + +#include +#include +#include + +#ifndef __cplusplus +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/*! +@function +@abstract Creates a JavaScript context group. +@discussion A JSContextGroup associates JavaScript contexts with one another. + Contexts in the same group may share and exchange JavaScript objects. Sharing and/or exchanging + JavaScript objects between contexts in different groups will produce undefined behavior. + When objects from the same context group are used in multiple threads, explicit + synchronization is required. +@result The created JSContextGroup. +*/ +JS_EXPORT JSContextGroupRef JSContextGroupCreate() AVAILABLE_IN_WEBKIT_VERSION_4_0; + +/*! +@function +@abstract Retains a JavaScript context group. +@param group The JSContextGroup to retain. +@result A JSContextGroup that is the same as group. +*/ +JS_EXPORT JSContextGroupRef JSContextGroupRetain(JSContextGroupRef group) AVAILABLE_IN_WEBKIT_VERSION_4_0; + +/*! +@function +@abstract Releases a JavaScript context group. +@param group The JSContextGroup to release. +*/ +JS_EXPORT void JSContextGroupRelease(JSContextGroupRef group) AVAILABLE_IN_WEBKIT_VERSION_4_0; + +/*! +@function +@abstract Creates a global JavaScript execution context. +@discussion JSGlobalContextCreate allocates a global object and populates it with all the + built-in JavaScript objects, such as Object, Function, String, and Array. + + In WebKit version 4.0 and later, the context is created in a unique context group. + Therefore, scripts may execute in it concurrently with scripts executing in other contexts. + However, you may not use values created in the context in other contexts. +@param globalObjectClass The class to use when creating the global object. Pass + NULL to use the default object class. +@result A JSGlobalContext with a global object of class globalObjectClass. +*/ +JS_EXPORT JSGlobalContextRef JSGlobalContextCreate(JSClassRef globalObjectClass) AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; + +/*! +@function +@abstract Creates a global JavaScript execution context in the context group provided. +@discussion JSGlobalContextCreateInGroup allocates a global object and populates it with + all the built-in JavaScript objects, such as Object, Function, String, and Array. +@param globalObjectClass The class to use when creating the global object. Pass + NULL to use the default object class. +@param group The context group to use. The created global context retains the group. + Pass NULL to create a unique group for the context. +@result A JSGlobalContext with a global object of class globalObjectClass and a context + group equal to group. +*/ +JS_EXPORT JSGlobalContextRef JSGlobalContextCreateInGroup(JSContextGroupRef group, JSClassRef globalObjectClass) AVAILABLE_IN_WEBKIT_VERSION_4_0; + +/*! +@function +@abstract Retains a global JavaScript execution context. +@param ctx The JSGlobalContext to retain. +@result A JSGlobalContext that is the same as ctx. +*/ +JS_EXPORT JSGlobalContextRef JSGlobalContextRetain(JSGlobalContextRef ctx); + +/*! +@function +@abstract Releases a global JavaScript execution context. +@param ctx The JSGlobalContext to release. +*/ +JS_EXPORT void JSGlobalContextRelease(JSGlobalContextRef ctx); + +/*! +@function +@abstract Gets the global object of a JavaScript execution context. +@param ctx The JSContext whose global object you want to get. +@result ctx's global object. +*/ +JS_EXPORT JSObjectRef JSContextGetGlobalObject(JSContextRef ctx); + +/*! +@function +@abstract Gets the context group to which a JavaScript execution context belongs. +@param ctx The JSContext whose group you want to get. +@result ctx's group. +*/ +JS_EXPORT JSContextGroupRef JSContextGetGroup(JSContextRef ctx) AVAILABLE_IN_WEBKIT_VERSION_4_0; + +#ifdef __cplusplus +} +#endif + +#endif /* JSContextRef_h */ diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSObjectRef.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSObjectRef.cpp new file mode 100644 index 0000000..87d36ec --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSObjectRef.cpp @@ -0,0 +1,517 @@ +/* + * 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 "APICast.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" +#include + +using namespace JSC; + +JSClassRef JSClassCreate(const JSClassDefinition* definition) +{ + initializeThreading(); + RefPtr 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); + exec->globalData().heap.registerThread(); + JSLock lock(exec); + + if (!jsClass) + return toRef(new (exec) JSObject(exec->lexicalGlobalObject()->emptyObjectStructure())); // slightly more efficient + + JSCallbackObject* object = new (exec) JSCallbackObject(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); + exec->globalData().heap.registerThread(); + JSLock lock(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); + exec->globalData().heap.registerThread(); + JSLock lock(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); + exec->globalData().heap.registerThread(); + JSLock lock(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); + exec->globalData().heap.registerThread(); + JSLock lock(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); + exec->globalData().heap.registerThread(); + JSLock lock(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); + exec->globalData().heap.registerThread(); + JSLock lock(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); + exec->globalData().heap.registerThread(); + JSLock lock(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); + exec->globalData().heap.registerThread(); + JSLock lock(exec); + + JSObject* jsObject = toJS(object); + return toRef(exec, jsObject->prototype()); +} + +void JSObjectSetPrototype(JSContextRef ctx, JSObjectRef object, JSValueRef value) +{ + ExecState* exec = toJS(ctx); + exec->globalData().heap.registerThread(); + JSLock lock(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); + exec->globalData().heap.registerThread(); + JSLock lock(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); + exec->globalData().heap.registerThread(); + JSLock lock(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); + exec->globalData().heap.registerThread(); + JSLock lock(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); + exec->globalData().heap.registerThread(); + JSLock lock(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); + exec->globalData().heap.registerThread(); + JSLock lock(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); + exec->globalData().heap.registerThread(); + JSLock lock(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::info)) + return static_cast*>(jsObject)->getPrivate(); + else if (jsObject->inherits(&JSCallbackObject::info)) + return static_cast*>(jsObject)->getPrivate(); + + return 0; +} + +bool JSObjectSetPrivate(JSObjectRef object, void* data) +{ + JSObject* jsObject = toJS(object); + + if (jsObject->inherits(&JSCallbackObject::info)) { + static_cast*>(jsObject)->setPrivate(data); + return true; + } else if (jsObject->inherits(&JSCallbackObject::info)) { + static_cast*>(jsObject)->setPrivate(data); + 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); + exec->globalData().heap.registerThread(); + JSLock lock(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); + exec->globalData().heap.registerThread(); + JSLock lock(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 > array; +}; + +JSPropertyNameArrayRef JSObjectCopyPropertyNames(JSContextRef ctx, JSObjectRef object) +{ + JSObject* jsObject = toJS(object); + ExecState* exec = toJS(ctx); + exec->globalData().heap.registerThread(); + JSLock lock(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(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) { + JSLock lock(array->globalData->isSharedInstance ? LockForReal : SilenceAssertionsOnly); + delete array; + } +} + +size_t JSPropertyNameArrayGetCount(JSPropertyNameArrayRef array) +{ + return array->array.size(); +} + +JSStringRef JSPropertyNameArrayGetNameAtIndex(JSPropertyNameArrayRef array, size_t index) +{ + return array->array[static_cast(index)].get(); +} + +void JSPropertyNameAccumulatorAddName(JSPropertyNameAccumulatorRef array, JSStringRef propertyName) +{ + PropertyNameArray* propertyNames = toJS(array); + + propertyNames->globalData()->heap.registerThread(); + JSLock lock(propertyNames->globalData()->isSharedInstance ? LockForReal : SilenceAssertionsOnly); + + propertyNames->add(propertyName->identifier(propertyNames->globalData())); +} diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSObjectRef.h b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSObjectRef.h new file mode 100644 index 0000000..86921bd --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSObjectRef.h @@ -0,0 +1,695 @@ +/* + * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. + * Copyright (C) 2008 Kelvin W Sherlock (ksherlock@gmail.com) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef JSObjectRef_h +#define JSObjectRef_h + +#include +#include +#include + +#ifndef __cplusplus +#include +#endif +#include /* for size_t */ + +#ifdef __cplusplus +extern "C" { +#endif + +/*! +@enum JSPropertyAttribute +@constant kJSPropertyAttributeNone Specifies that a property has no special attributes. +@constant kJSPropertyAttributeReadOnly Specifies that a property is read-only. +@constant kJSPropertyAttributeDontEnum Specifies that a property should not be enumerated by JSPropertyEnumerators and JavaScript for...in loops. +@constant kJSPropertyAttributeDontDelete Specifies that the delete operation should fail on a property. +*/ +enum { + kJSPropertyAttributeNone = 0, + kJSPropertyAttributeReadOnly = 1 << 1, + kJSPropertyAttributeDontEnum = 1 << 2, + kJSPropertyAttributeDontDelete = 1 << 3 +}; + +/*! +@typedef JSPropertyAttributes +@abstract A set of JSPropertyAttributes. Combine multiple attributes by logically ORing them together. +*/ +typedef unsigned JSPropertyAttributes; + +/*! +@enum JSClassAttribute +@constant kJSClassAttributeNone Specifies that a class has no special attributes. +@constant kJSClassAttributeNoAutomaticPrototype Specifies that a class should not automatically generate a shared prototype for its instance objects. Use kJSClassAttributeNoAutomaticPrototype in combination with JSObjectSetPrototype to manage prototypes manually. +*/ +enum { + kJSClassAttributeNone = 0, + kJSClassAttributeNoAutomaticPrototype = 1 << 1 +}; + +/*! +@typedef JSClassAttributes +@abstract A set of JSClassAttributes. Combine multiple attributes by logically ORing them together. +*/ +typedef unsigned JSClassAttributes; + +/*! +@typedef JSObjectInitializeCallback +@abstract The callback invoked when an object is first created. +@param ctx The execution context to use. +@param object The JSObject being created. +@discussion If you named your function Initialize, you would declare it like this: + +void Initialize(JSContextRef ctx, JSObjectRef object); + +Unlike the other object callbacks, the initialize callback is called on the least +derived class (the parent class) first, and the most derived class last. +*/ +typedef void +(*JSObjectInitializeCallback) (JSContextRef ctx, JSObjectRef object); + +/*! +@typedef JSObjectFinalizeCallback +@abstract The callback invoked when an object is finalized (prepared for garbage collection). An object may be finalized on any thread. +@param object The JSObject being finalized. +@discussion If you named your function Finalize, you would declare it like this: + +void Finalize(JSObjectRef object); + +The finalize callback is called on the most derived class first, and the least +derived class (the parent class) last. + +You must not call any function that may cause a garbage collection or an allocation +of a garbage collected object from within a JSObjectFinalizeCallback. This includes +all functions that have a JSContextRef parameter. +*/ +typedef void +(*JSObjectFinalizeCallback) (JSObjectRef object); + +/*! +@typedef JSObjectHasPropertyCallback +@abstract The callback invoked when determining whether an object has a property. +@param ctx The execution context to use. +@param object The JSObject to search for the property. +@param propertyName A JSString containing the name of the property look up. +@result true if object has the property, otherwise false. +@discussion If you named your function HasProperty, you would declare it like this: + +bool HasProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName); + +If this function returns false, the hasProperty request forwards to object's statically declared properties, then its parent class chain (which includes the default object class), then its prototype chain. + +This callback enables optimization in cases where only a property's existence needs to be known, not its value, and computing its value would be expensive. + +If this callback is NULL, the getProperty callback will be used to service hasProperty requests. +*/ +typedef bool +(*JSObjectHasPropertyCallback) (JSContextRef ctx, JSObjectRef object, JSStringRef propertyName); + +/*! +@typedef JSObjectGetPropertyCallback +@abstract The callback invoked when getting a property's value. +@param ctx The execution context to use. +@param object The JSObject to search for the property. +@param propertyName A JSString containing the name of the property to get. +@param exception A pointer to a JSValueRef in which to return an exception, if any. +@result The property's value if object has the property, otherwise NULL. +@discussion If you named your function GetProperty, you would declare it like this: + +JSValueRef GetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception); + +If this function returns NULL, the get request forwards to object's statically declared properties, then its parent class chain (which includes the default object class), then its prototype chain. +*/ +typedef JSValueRef +(*JSObjectGetPropertyCallback) (JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception); + +/*! +@typedef JSObjectSetPropertyCallback +@abstract The callback invoked when setting a property's value. +@param ctx The execution context to use. +@param object The JSObject on which to set the property's value. +@param propertyName A JSString containing the name of the property to set. +@param value A JSValue to use as the property's value. +@param exception A pointer to a JSValueRef in which to return an exception, if any. +@result true if the property was set, otherwise false. +@discussion If you named your function SetProperty, you would declare it like this: + +bool SetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef* exception); + +If this function returns false, the set request forwards to object's statically declared properties, then its parent class chain (which includes the default object class). +*/ +typedef bool +(*JSObjectSetPropertyCallback) (JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef* exception); + +/*! +@typedef JSObjectDeletePropertyCallback +@abstract The callback invoked when deleting a property. +@param ctx The execution context to use. +@param object The JSObject in which to delete the property. +@param propertyName A JSString containing the name of the property to delete. +@param exception A pointer to a JSValueRef in which to return an exception, if any. +@result true if propertyName was successfully deleted, otherwise false. +@discussion If you named your function DeleteProperty, you would declare it like this: + +bool DeleteProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception); + +If this function returns false, the delete request forwards to object's statically declared properties, then its parent class chain (which includes the default object class). +*/ +typedef bool +(*JSObjectDeletePropertyCallback) (JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception); + +/*! +@typedef JSObjectGetPropertyNamesCallback +@abstract The callback invoked when collecting the names of an object's properties. +@param ctx The execution context to use. +@param object The JSObject whose property names are being collected. +@param accumulator A JavaScript property name accumulator in which to accumulate the names of object's properties. +@param flag Specify which property should be included +@discussion If you named your function GetPropertyNames, you would declare it like this: + +void GetPropertyNames(JSContextRef ctx, JSObjectRef object, JSPropertyNameAccumulatorRef propertyNames); + +Property name accumulators are used by JSObjectCopyPropertyNames and JavaScript for...in loops. + +Use JSPropertyNameAccumulatorAddName to add property names to accumulator. A class's getPropertyNames callback only needs to provide the names of properties that the class vends through a custom getProperty or setProperty callback. Other properties, including statically declared properties, properties vended by other classes, and properties belonging to object's prototype, are added independently. +*/ +typedef void +(*JSObjectGetPropertyNamesCallback) (JSContextRef ctx, JSObjectRef object, JSPropertyNameAccumulatorRef propertyNames, unsigned flag); + +/*! +@typedef JSObjectCallAsFunctionCallback +@abstract The callback invoked when an object is called as a function. +@param ctx The execution context to use. +@param function A JSObject that is the function being called. +@param thisObject A JSObject that is the 'this' variable in the function's scope. +@param argumentCount An integer count of the number of arguments in arguments. +@param arguments A JSValue array of the arguments passed to the function. +@param exception A pointer to a JSValueRef in which to return an exception, if any. +@result A JSValue that is the function's return value. +@discussion If you named your function CallAsFunction, you would declare it like this: + +JSValueRef CallAsFunction(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception); + +If your callback were invoked by the JavaScript expression 'myObject.myFunction()', function would be set to myFunction, and thisObject would be set to myObject. + +If this callback is NULL, calling your object as a function will throw an exception. +*/ +typedef JSValueRef +(*JSObjectCallAsFunctionCallback) (JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception); + +/*! +@typedef JSObjectCallAsConstructorCallback +@abstract The callback invoked when an object is used as a constructor in a 'new' expression. +@param ctx The execution context to use. +@param constructor A JSObject that is the constructor being called. +@param argumentCount An integer count of the number of arguments in arguments. +@param arguments A JSValue array of the arguments passed to the function. +@param exception A pointer to a JSValueRef in which to return an exception, if any. +@result A JSObject that is the constructor's return value. +@discussion If you named your function CallAsConstructor, you would declare it like this: + +JSObjectRef CallAsConstructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception); + +If your callback were invoked by the JavaScript expression 'new myConstructor()', constructor would be set to myConstructor. + +If this callback is NULL, using your object as a constructor in a 'new' expression will throw an exception. +*/ +typedef JSObjectRef +(*JSObjectCallAsConstructorCallback) (JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception); + +/*! +@typedef JSObjectHasInstanceCallback +@abstract hasInstance The callback invoked when an object is used as the target of an 'instanceof' expression. +@param ctx The execution context to use. +@param constructor The JSObject that is the target of the 'instanceof' expression. +@param possibleInstance The JSValue being tested to determine if it is an instance of constructor. +@param exception A pointer to a JSValueRef in which to return an exception, if any. +@result true if possibleInstance is an instance of constructor, otherwise false. +@discussion If you named your function HasInstance, you would declare it like this: + +bool HasInstance(JSContextRef ctx, JSObjectRef constructor, JSValueRef possibleInstance, JSValueRef* exception); + +If your callback were invoked by the JavaScript expression 'someValue instanceof myObject', constructor would be set to myObject and possibleInstance would be set to someValue. + +If this callback is NULL, 'instanceof' expressions that target your object will return false. + +Standard JavaScript practice calls for objects that implement the callAsConstructor callback to implement the hasInstance callback as well. +*/ +typedef bool +(*JSObjectHasInstanceCallback) (JSContextRef ctx, JSObjectRef constructor, JSValueRef possibleInstance, JSValueRef* exception); + +/*! +@typedef JSObjectConvertToTypeCallback +@abstract The callback invoked when converting an object to a particular JavaScript type. +@param ctx The execution context to use. +@param object The JSObject to convert. +@param type A JSType specifying the JavaScript type to convert to. +@param exception A pointer to a JSValueRef in which to return an exception, if any. +@result The objects's converted value, or NULL if the object was not converted. +@discussion If you named your function ConvertToType, you would declare it like this: + +JSValueRef ConvertToType(JSContextRef ctx, JSObjectRef object, JSType type, JSValueRef* exception); + +If this function returns false, the conversion request forwards to object's parent class chain (which includes the default object class). + +This function is only invoked when converting an object to number or string. An object converted to boolean is 'true.' An object converted to object is itself. +*/ +typedef JSValueRef +(*JSObjectConvertToTypeCallback) (JSContextRef ctx, JSObjectRef object, JSType type, JSValueRef* exception); + +/*! +@struct JSStaticValue +@abstract This structure describes a statically declared value property. +@field name A null-terminated UTF8 string containing the property's name. +@field getProperty A JSObjectGetPropertyCallback to invoke when getting the property's value. +@field setProperty A JSObjectSetPropertyCallback to invoke when setting the property's value. May be NULL if the ReadOnly attribute is set. +@field attributes A logically ORed set of JSPropertyAttributes to give to the property. +*/ +typedef struct { + const char* const name; + JSObjectGetPropertyCallback getProperty; + JSObjectSetPropertyCallback setProperty; + JSPropertyAttributes attributes; +} JSStaticValue; + +/*! +@struct JSStaticFunction +@abstract This structure describes a statically declared function property. +@field name A null-terminated UTF8 string containing the property's name. +@field callAsFunction A JSObjectCallAsFunctionCallback to invoke when the property is called as a function. +@field attributes A logically ORed set of JSPropertyAttributes to give to the property. +*/ +typedef struct { + const char* const name; + JSObjectCallAsFunctionCallback callAsFunction; + JSPropertyAttributes attributes; +} JSStaticFunction; + +/*! +@struct JSClassDefinition +@abstract This structure contains properties and callbacks that define a type of object. All fields other than the version field are optional. Any pointer may be NULL. +@field version The version number of this structure. The current version is 0. +@field attributes A logically ORed set of JSClassAttributes to give to the class. +@field className A null-terminated UTF8 string containing the class's name. +@field parentClass A JSClass to set as the class's parent class. Pass NULL use the default object class. +@field staticValues A JSStaticValue array containing the class's statically declared value properties. Pass NULL to specify no statically declared value properties. The array must be terminated by a JSStaticValue whose name field is NULL. +@field staticFunctions A JSStaticFunction array containing the class's statically declared function properties. Pass NULL to specify no statically declared function properties. The array must be terminated by a JSStaticFunction whose name field is NULL. +@field initialize The callback invoked when an object is first created. Use this callback to initialize the object. +@field finalize The callback invoked when an object is finalized (prepared for garbage collection). Use this callback to release resources allocated for the object, and perform other cleanup. +@field hasProperty The callback invoked when determining whether an object has a property. If this field is NULL, getProperty is called instead. The hasProperty callback enables optimization in cases where only a property's existence needs to be known, not its value, and computing its value is expensive. +@field getProperty The callback invoked when getting a property's value. +@field setProperty The callback invoked when setting a property's value. +@field deleteProperty The callback invoked when deleting a property. +@field getPropertyNames The callback invoked when collecting the names of an object's properties. +@field callAsFunction The callback invoked when an object is called as a function. +@field hasInstance The callback invoked when an object is used as the target of an 'instanceof' expression. +@field callAsConstructor The callback invoked when an object is used as a constructor in a 'new' expression. +@field convertToType The callback invoked when converting an object to a particular JavaScript type. +@discussion The staticValues and staticFunctions arrays are the simplest and most efficient means for vending custom properties. Statically declared properties autmatically service requests like getProperty, setProperty, and getPropertyNames. Property access callbacks are required only to implement unusual properties, like array indexes, whose names are not known at compile-time. + +If you named your getter function "GetX" and your setter function "SetX", you would declare a JSStaticValue array containing "X" like this: + +JSStaticValue StaticValueArray[] = { + { "X", GetX, SetX, kJSPropertyAttributeNone }, + { 0, 0, 0, 0 } +}; + +Standard JavaScript practice calls for storing function objects in prototypes, so they can be shared. The default JSClass created by JSClassCreate follows this idiom, instantiating objects with a shared, automatically generating prototype containing the class's function objects. The kJSClassAttributeNoAutomaticPrototype attribute specifies that a JSClass should not automatically generate such a prototype. The resulting JSClass instantiates objects with the default object prototype, and gives each instance object its own copy of the class's function objects. + +A NULL callback specifies that the default object callback should substitute, except in the case of hasProperty, where it specifies that getProperty should substitute. +*/ +typedef struct { + int version; /* current (and only) version is 0 */ + JSClassAttributes attributes; + + const char* className; + JSClassRef parentClass; + + const JSStaticValue* staticValues; + const JSStaticFunction* staticFunctions; + + JSObjectInitializeCallback initialize; + JSObjectFinalizeCallback finalize; + JSObjectHasPropertyCallback hasProperty; + JSObjectGetPropertyCallback getProperty; + JSObjectSetPropertyCallback setProperty; + JSObjectDeletePropertyCallback deleteProperty; + JSObjectGetPropertyNamesCallback getPropertyNames; + JSObjectCallAsFunctionCallback callAsFunction; + JSObjectCallAsConstructorCallback callAsConstructor; + JSObjectHasInstanceCallback hasInstance; + JSObjectConvertToTypeCallback convertToType; +} JSClassDefinition; + +/*! +@const kJSClassDefinitionEmpty +@abstract A JSClassDefinition structure of the current version, filled with NULL pointers and having no attributes. +@discussion Use this constant as a convenience when creating class definitions. For example, to create a class definition with only a finalize method: + +JSClassDefinition definition = kJSClassDefinitionEmpty; +definition.finalize = Finalize; +*/ +JS_EXPORT extern const JSClassDefinition kJSClassDefinitionEmpty; + +/*! +@function +@abstract Creates a JavaScript class suitable for use with JSObjectMake. +@param definition A JSClassDefinition that defines the class. +@result A JSClass with the given definition. Ownership follows the Create Rule. +*/ +JS_EXPORT JSClassRef JSClassCreate(const JSClassDefinition* definition); + +/*! +@function +@abstract Retains a JavaScript class. +@param jsClass The JSClass to retain. +@result A JSClass that is the same as jsClass. +*/ +JS_EXPORT JSClassRef JSClassRetain(JSClassRef jsClass); + +/*! +@function +@abstract Releases a JavaScript class. +@param jsClass The JSClass to release. +*/ +JS_EXPORT void JSClassRelease(JSClassRef jsClass); + +/*! +@function +@abstract Creates a JavaScript object. +@param ctx The execution context to use. +@param jsClass The JSClass to assign to the object. Pass NULL to use the default object class. +@param data A void* to set as the object's private data. Pass NULL to specify no private data. +@result A JSObject with the given class and private data. +@discussion The default object class does not allocate storage for private data, so you must provide a non-NULL jsClass to JSObjectMake if you want your object to be able to store private data. + +data is set on the created object before the intialize methods in its class chain are called. This enables the initialize methods to retrieve and manipulate data through JSObjectGetPrivate. +*/ +JS_EXPORT JSObjectRef JSObjectMake(JSContextRef ctx, JSClassRef jsClass, void* data); + +/*! +@function +@abstract Convenience method for creating a JavaScript function with a given callback as its implementation. +@param ctx The execution context to use. +@param name A JSString containing the function's name. This will be used when converting the function to string. Pass NULL to create an anonymous function. +@param callAsFunction The JSObjectCallAsFunctionCallback to invoke when the function is called. +@result A JSObject that is a function. The object's prototype will be the default function prototype. +*/ +JS_EXPORT JSObjectRef JSObjectMakeFunctionWithCallback(JSContextRef ctx, JSStringRef name, JSObjectCallAsFunctionCallback callAsFunction); + +/*! +@function +@abstract Convenience method for creating a JavaScript constructor. +@param ctx The execution context to use. +@param jsClass A JSClass that is the class your constructor will assign to the objects its constructs. jsClass will be used to set the constructor's .prototype property, and to evaluate 'instanceof' expressions. Pass NULL to use the default object class. +@param callAsConstructor A JSObjectCallAsConstructorCallback to invoke when your constructor is used in a 'new' expression. Pass NULL to use the default object constructor. +@result A JSObject that is a constructor. The object's prototype will be the default object prototype. +@discussion The default object constructor takes no arguments and constructs an object of class jsClass with no private data. +*/ +JS_EXPORT JSObjectRef JSObjectMakeConstructor(JSContextRef ctx, JSClassRef jsClass, JSObjectCallAsConstructorCallback callAsConstructor); + +/*! + @function + @abstract Creates a JavaScript Array object. + @param ctx The execution context to use. + @param argumentCount An integer count of the number of arguments in arguments. + @param arguments A JSValue array of data to populate the Array with. Pass NULL if argumentCount is 0. + @param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. + @result A JSObject that is an Array. + @discussion The behavior of this function does not exactly match the behavior of the built-in Array constructor. Specifically, if one argument + is supplied, this function returns an array with one element. + */ +JS_EXPORT JSObjectRef JSObjectMakeArray(JSContextRef ctx, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) AVAILABLE_IN_WEBKIT_VERSION_4_0; + +/*! + @function + @abstract Creates a JavaScript Date object, as if by invoking the built-in Date constructor. + @param ctx The execution context to use. + @param argumentCount An integer count of the number of arguments in arguments. + @param arguments A JSValue array of arguments to pass to the Date Constructor. Pass NULL if argumentCount is 0. + @param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. + @result A JSObject that is a Date. + */ +JS_EXPORT JSObjectRef JSObjectMakeDate(JSContextRef ctx, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) AVAILABLE_IN_WEBKIT_VERSION_4_0; + +/*! + @function + @abstract Creates a JavaScript Error object, as if by invoking the built-in Error constructor. + @param ctx The execution context to use. + @param argumentCount An integer count of the number of arguments in arguments. + @param arguments A JSValue array of arguments to pass to the Error Constructor. Pass NULL if argumentCount is 0. + @param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. + @result A JSObject that is a Error. + */ +JS_EXPORT JSObjectRef JSObjectMakeError(JSContextRef ctx, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) AVAILABLE_IN_WEBKIT_VERSION_4_0; + +/*! + @function + @abstract Creates a JavaScript RegExp object, as if by invoking the built-in RegExp constructor. + @param ctx The execution context to use. + @param argumentCount An integer count of the number of arguments in arguments. + @param arguments A JSValue array of arguments to pass to the RegExp Constructor. Pass NULL if argumentCount is 0. + @param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. + @result A JSObject that is a RegExp. + */ +JS_EXPORT JSObjectRef JSObjectMakeRegExp(JSContextRef ctx, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) AVAILABLE_IN_WEBKIT_VERSION_4_0; + +/*! +@function +@abstract Creates a function with a given script as its body. +@param ctx The execution context to use. +@param name A JSString containing the function's name. This will be used when converting the function to string. Pass NULL to create an anonymous function. +@param parameterCount An integer count of the number of parameter names in parameterNames. +@param parameterNames A JSString array containing the names of the function's parameters. Pass NULL if parameterCount is 0. +@param body A JSString containing the script to use as the function's body. +@param sourceURL A JSString containing a URL for the script's source file. This is only used when reporting exceptions. Pass NULL if you do not care to include source file information in exceptions. +@param startingLineNumber An integer value specifying the script's starting line number in the file located at sourceURL. This is only used when reporting exceptions. +@param exception A pointer to a JSValueRef in which to store a syntax error exception, if any. Pass NULL if you do not care to store a syntax error exception. +@result A JSObject that is a function, or NULL if either body or parameterNames contains a syntax error. The object's prototype will be the default function prototype. +@discussion Use this method when you want to execute a script repeatedly, to avoid the cost of re-parsing the script before each execution. +*/ +JS_EXPORT JSObjectRef JSObjectMakeFunction(JSContextRef ctx, JSStringRef name, unsigned parameterCount, const JSStringRef parameterNames[], JSStringRef body, JSStringRef sourceURL, int startingLineNumber, JSValueRef* exception); + +/*! +@function +@abstract Gets an object's prototype. +@param ctx The execution context to use. +@param object A JSObject whose prototype you want to get. +@result A JSValue that is the object's prototype. +*/ +JS_EXPORT JSValueRef JSObjectGetPrototype(JSContextRef ctx, JSObjectRef object); + +/*! +@function +@abstract Sets an object's prototype. +@param ctx The execution context to use. +@param object The JSObject whose prototype you want to set. +@param value A JSValue to set as the object's prototype. +*/ +JS_EXPORT void JSObjectSetPrototype(JSContextRef ctx, JSObjectRef object, JSValueRef value); + +/*! +@function +@abstract Tests whether an object has a given property. +@param object The JSObject to test. +@param propertyName A JSString containing the property's name. +@result true if the object has a property whose name matches propertyName, otherwise false. +*/ +JS_EXPORT bool JSObjectHasProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName); + +/*! +@function +@abstract Gets a property from an object. +@param ctx The execution context to use. +@param object The JSObject whose property you want to get. +@param propertyName A JSString containing the property's name. +@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. +@result The property's value if object has the property, otherwise the undefined value. +*/ +JS_EXPORT JSValueRef JSObjectGetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception); + +/*! +@function +@abstract Sets a property on an object. +@param ctx The execution context to use. +@param object The JSObject whose property you want to set. +@param propertyName A JSString containing the property's name. +@param value A JSValue to use as the property's value. +@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. +@param attributes A logically ORed set of JSPropertyAttributes to give to the property. +*/ +JS_EXPORT void JSObjectSetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSPropertyAttributes attributes, JSValueRef* exception); + +/*! +@function +@abstract Deletes a property from an object. +@param ctx The execution context to use. +@param object The JSObject whose property you want to delete. +@param propertyName A JSString containing the property's name. +@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. +@result true if the delete operation succeeds, otherwise false (for example, if the property has the kJSPropertyAttributeDontDelete attribute set). +*/ +JS_EXPORT bool JSObjectDeleteProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception); + +/*! +@function +@abstract Gets a property from an object by numeric index. +@param ctx The execution context to use. +@param object The JSObject whose property you want to get. +@param propertyIndex An integer value that is the property's name. +@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. +@result The property's value if object has the property, otherwise the undefined value. +@discussion Calling JSObjectGetPropertyAtIndex is equivalent to calling JSObjectGetProperty with a string containing propertyIndex, but JSObjectGetPropertyAtIndex provides optimized access to numeric properties. +*/ +JS_EXPORT JSValueRef JSObjectGetPropertyAtIndex(JSContextRef ctx, JSObjectRef object, unsigned propertyIndex, JSValueRef* exception); + +/*! +@function +@abstract Sets a property on an object by numeric index. +@param ctx The execution context to use. +@param object The JSObject whose property you want to set. +@param propertyIndex The property's name as a number. +@param value A JSValue to use as the property's value. +@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. +@discussion Calling JSObjectSetPropertyAtIndex is equivalent to calling JSObjectSetProperty with a string containing propertyIndex, but JSObjectSetPropertyAtIndex provides optimized access to numeric properties. +*/ +JS_EXPORT void JSObjectSetPropertyAtIndex(JSContextRef ctx, JSObjectRef object, unsigned propertyIndex, JSValueRef value, JSValueRef* exception); + +/*! +@function +@abstract Gets an object's private data. +@param object A JSObject whose private data you want to get. +@result A void* that is the object's private data, if the object has private data, otherwise NULL. +*/ +JS_EXPORT void* JSObjectGetPrivate(JSObjectRef object); + +/*! +@function +@abstract Sets a pointer to private data on an object. +@param object The JSObject whose private data you want to set. +@param data A void* to set as the object's private data. +@result true if object can store private data, otherwise false. +@discussion The default object class does not allocate storage for private data. Only objects created with a non-NULL JSClass can store private data. +*/ +JS_EXPORT bool JSObjectSetPrivate(JSObjectRef object, void* data); + +/*! +@function +@abstract Tests whether an object can be called as a function. +@param ctx The execution context to use. +@param object The JSObject to test. +@result true if the object can be called as a function, otherwise false. +*/ +JS_EXPORT bool JSObjectIsFunction(JSContextRef ctx, JSObjectRef object); + +/*! +@function +@abstract Calls an object as a function. +@param ctx The execution context to use. +@param object The JSObject to call as a function. +@param thisObject The object to use as "this," or NULL to use the global object as "this." +@param argumentCount An integer count of the number of arguments in arguments. +@param arguments A JSValue array of arguments to pass to the function. Pass NULL if argumentCount is 0. +@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. +@result The JSValue that results from calling object as a function, or NULL if an exception is thrown or object is not a function. +*/ +JS_EXPORT JSValueRef JSObjectCallAsFunction(JSContextRef ctx, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception); + +/*! +@function +@abstract Tests whether an object can be called as a constructor. +@param ctx The execution context to use. +@param object The JSObject to test. +@result true if the object can be called as a constructor, otherwise false. +*/ +JS_EXPORT bool JSObjectIsConstructor(JSContextRef ctx, JSObjectRef object); + +/*! +@function +@abstract Calls an object as a constructor. +@param ctx The execution context to use. +@param object The JSObject to call as a constructor. +@param argumentCount An integer count of the number of arguments in arguments. +@param arguments A JSValue array of arguments to pass to the constructor. Pass NULL if argumentCount is 0. +@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. +@result The JSObject that results from calling object as a constructor, or NULL if an exception is thrown or object is not a constructor. +*/ +JS_EXPORT JSObjectRef JSObjectCallAsConstructor(JSContextRef ctx, JSObjectRef object, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception); + +/*! +@function +@abstract Gets the names of an object's enumerable properties. +@param ctx The execution context to use. +@param object The object whose property names you want to get. +@result A JSPropertyNameArray containing the names object's enumerable properties. Ownership follows the Create Rule. +*/ +JS_EXPORT JSPropertyNameArrayRef JSObjectCopyPropertyNames(JSContextRef ctx, JSObjectRef object); + +/*! +@function +@abstract Retains a JavaScript property name array. +@param array The JSPropertyNameArray to retain. +@result A JSPropertyNameArray that is the same as array. +*/ +JS_EXPORT JSPropertyNameArrayRef JSPropertyNameArrayRetain(JSPropertyNameArrayRef array); + +/*! +@function +@abstract Releases a JavaScript property name array. +@param array The JSPropetyNameArray to release. +*/ +JS_EXPORT void JSPropertyNameArrayRelease(JSPropertyNameArrayRef array); + +/*! +@function +@abstract Gets a count of the number of items in a JavaScript property name array. +@param array The array from which to retrieve the count. +@result An integer count of the number of names in array. +*/ +JS_EXPORT size_t JSPropertyNameArrayGetCount(JSPropertyNameArrayRef array); + +/*! +@function +@abstract Gets a property name at a given index in a JavaScript property name array. +@param array The array from which to retrieve the property name. +@param index The index of the property name to retrieve. +@result A JSStringRef containing the property name. +*/ +JS_EXPORT JSStringRef JSPropertyNameArrayGetNameAtIndex(JSPropertyNameArrayRef array, size_t index); + +/*! +@function +@abstract Adds a property name to a JavaScript property name accumulator. +@param accumulator The accumulator object to which to add the property name. +@param propertyName The property name to add. +*/ +JS_EXPORT void JSPropertyNameAccumulatorAddName(JSPropertyNameAccumulatorRef accumulator, JSStringRef propertyName); + +#ifdef __cplusplus +} +#endif + +#endif /* JSObjectRef_h */ diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSProfilerPrivate.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSProfilerPrivate.cpp new file mode 100644 index 0000000..ea277f0 --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSProfilerPrivate.cpp @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2008 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "JSProfilerPrivate.h" + +#include "APICast.h" +#include "OpaqueJSString.h" +#include "Profiler.h" + +using namespace JSC; + +void JSStartProfiling(JSContextRef ctx, JSStringRef title) +{ + Profiler::profiler()->startProfiling(toJS(ctx), title->ustring()); +} + +void JSEndProfiling(JSContextRef ctx, JSStringRef title) +{ + ExecState* exec = toJS(ctx); + Profiler* profiler = Profiler::profiler(); + profiler->stopProfiling(exec, title->ustring()); +} + diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSProfilerPrivate.h b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSProfilerPrivate.h new file mode 100644 index 0000000..b3fe533 --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSProfilerPrivate.h @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2008 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef JSProfiler_h +#define JSProfiler_h + +#include + +#ifndef __cplusplus +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/*! +@function JSStartProfiling +@abstract Enables the profler. +@param ctx The execution context to use. +@param title The title of the profile. +@result The profiler is turned on. +*/ +JS_EXPORT void JSStartProfiling(JSContextRef ctx, JSStringRef title); + +/*! +@function JSEndProfiling +@abstract Disables the profler. +@param ctx The execution context to use. +@param title The title of the profile. +@result The profiler is turned off. If there is no name, the most recently started + profile is stopped. If the name does not match any profile then no profile + is stopped. +*/ +JS_EXPORT void JSEndProfiling(JSContextRef ctx, JSStringRef title); + +#ifdef __cplusplus +} +#endif + +#endif /* JSProfiler_h */ diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSRetainPtr.h b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSRetainPtr.h new file mode 100644 index 0000000..69c6de1 --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSRetainPtr.h @@ -0,0 +1,173 @@ +/* + * 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 +#include + +inline void JSRetain(JSStringRef string) { JSStringRetain(string); } +inline void JSRelease(JSStringRef string) { JSStringRelease(string); } + +enum AdoptTag { Adopt }; + +template 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 JSRetainPtr(const JSRetainPtr& 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 JSRetainPtr& operator=(const JSRetainPtr&); + JSRetainPtr& operator=(T); + template JSRetainPtr& operator=(U*); + + void adopt(T); + + void swap(JSRetainPtr&); + +private: + T m_ptr; +}; + +template inline JSRetainPtr& JSRetainPtr::operator=(const JSRetainPtr& o) +{ + T optr = o.get(); + if (optr) + JSRetain(optr); + T ptr = m_ptr; + m_ptr = optr; + if (ptr) + JSRelease(ptr); + return *this; +} + +template template inline JSRetainPtr& JSRetainPtr::operator=(const JSRetainPtr& o) +{ + T optr = o.get(); + if (optr) + JSRetain(optr); + T ptr = m_ptr; + m_ptr = optr; + if (ptr) + JSRelease(ptr); + return *this; +} + +template inline JSRetainPtr& JSRetainPtr::operator=(T optr) +{ + if (optr) + JSRetain(optr); + T ptr = m_ptr; + m_ptr = optr; + if (ptr) + JSRelease(ptr); + return *this; +} + +template inline void JSRetainPtr::adopt(T optr) +{ + T ptr = m_ptr; + m_ptr = optr; + if (ptr) + JSRelease(ptr); +} + +template template inline JSRetainPtr& JSRetainPtr::operator=(U* optr) +{ + if (optr) + JSRetain(optr); + T ptr = m_ptr; + m_ptr = optr; + if (ptr) + JSRelease(ptr); + return *this; +} + +template inline void JSRetainPtr::swap(JSRetainPtr& o) +{ + std::swap(m_ptr, o.m_ptr); +} + +template inline void swap(JSRetainPtr& a, JSRetainPtr& b) +{ + a.swap(b); +} + +template inline bool operator==(const JSRetainPtr& a, const JSRetainPtr& b) +{ + return a.get() == b.get(); +} + +template inline bool operator==(const JSRetainPtr& a, U* b) +{ + return a.get() == b; +} + +template inline bool operator==(T* a, const JSRetainPtr& b) +{ + return a == b.get(); +} + +template inline bool operator!=(const JSRetainPtr& a, const JSRetainPtr& b) +{ + return a.get() != b.get(); +} + +template inline bool operator!=(const JSRetainPtr& a, U* b) +{ + return a.get() != b; +} + +template inline bool operator!=(T* a, const JSRetainPtr& b) +{ + return a != b.get(); +} + + +#endif // JSRetainPtr_h diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSStringRef.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSStringRef.cpp new file mode 100644 index 0000000..8e236e4 --- /dev/null +++ b/src/3rdparty/javascriptcore/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 + +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 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/javascriptcore/JavaScriptCore/API/JSStringRef.h b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSStringRef.h new file mode 100644 index 0000000..8b17ee2 --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSStringRef.h @@ -0,0 +1,144 @@ +/* + * 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 + +#ifndef __cplusplus +#include +#endif +#include /* for size_t */ + +#ifdef __cplusplus +extern "C" { +#endif + +#if !defined(WIN32) && !defined(_WIN32) +/*! +@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/javascriptcore/JavaScriptCore/API/JSStringRefBSTR.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSStringRefBSTR.cpp new file mode 100644 index 0000000..a7d3e99 --- /dev/null +++ b/src/3rdparty/javascriptcore/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/javascriptcore/JavaScriptCore/API/JSStringRefBSTR.h b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSStringRefBSTR.h new file mode 100644 index 0000000..59f19b7 --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSStringRefBSTR.h @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2007 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef JSStringRefBSTR_h +#define JSStringRefBSTR_h + +#include "JSBase.h" + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* COM convenience methods */ + +/*! +@function +@abstract Creates a JavaScript string from a BSTR. +@param string The BSTR to copy into the new JSString. +@result A JSString containing string. Ownership follows the Create Rule. +*/ +JS_EXPORT JSStringRef JSStringCreateWithBSTR(const BSTR string); + +/*! +@function +@abstract Creates a BSTR from a JavaScript string. +@param string The JSString to copy into the new BSTR. +@result A BSTR containing string. Ownership follows the Create Rule. +*/ +JS_EXPORT BSTR JSStringCopyBSTR(const JSStringRef string); + +#ifdef __cplusplus +} +#endif + +#endif /* JSStringRefBSTR_h */ diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSStringRefCF.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSStringRefCF.cpp new file mode 100644 index 0000000..d1f6fe3 --- /dev/null +++ b/src/3rdparty/javascriptcore/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 +#include +#include + +JSStringRef JSStringCreateWithCFString(CFStringRef string) +{ + JSC::initializeThreading(); + + // We cannot use CFIndex here since CFStringGetLength can return values larger than + // it can hold. () + size_t length = CFStringGetLength(string); + if (length) { + OwnArrayPtr 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(buffer.get()), length).releaseRef(); + } else { + return OpaqueJSString::create(0, 0).releaseRef(); + } +} + +CFStringRef JSStringCopyCFString(CFAllocatorRef alloc, JSStringRef string) +{ + return CFStringCreateWithCharacters(alloc, reinterpret_cast(string->characters()), string->length()); +} diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSStringRefCF.h b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSStringRefCF.h new file mode 100644 index 0000000..a424765 --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSStringRefCF.h @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2006, 2007 Apple Computer, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef JSStringRefCF_h +#define JSStringRefCF_h + +#include "JSBase.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* CFString convenience methods */ + +/*! +@function +@abstract Creates a JavaScript string from a CFString. +@discussion This function is optimized to take advantage of cases when + CFStringGetCharactersPtr returns a valid pointer. +@param string The CFString to copy into the new JSString. +@result A JSString containing string. Ownership follows the Create Rule. +*/ +JS_EXPORT JSStringRef JSStringCreateWithCFString(CFStringRef string); +/*! +@function +@abstract Creates a CFString from a JavaScript string. +@param alloc The alloc parameter to pass to CFStringCreate. +@param string The JSString to copy into the new CFString. +@result A CFString containing string. Ownership follows the Create Rule. +*/ +JS_EXPORT CFStringRef JSStringCopyCFString(CFAllocatorRef alloc, JSStringRef string); + +#ifdef __cplusplus +} +#endif + +#endif /* JSStringRefCF_h */ diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSValueRef.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSValueRef.cpp new file mode 100644 index 0000000..2207181 --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSValueRef.cpp @@ -0,0 +1,322 @@ +/* + * 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 +#include "APICast.h" +#include "JSCallbackObject.h" + +#include +#include +#include +#include +#include +#include + +#include + +#include // for std::min + +JSType JSValueGetType(JSContextRef ctx, JSValueRef value) +{ + JSC::ExecState* exec = toJS(ctx); + exec->globalData().heap.registerThread(); + JSC::JSLock lock(exec); + + JSC::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; +} + +using namespace JSC; // placed here to avoid conflict between JSC::JSType and JSType, above. + +bool JSValueIsUndefined(JSContextRef ctx, JSValueRef value) +{ + ExecState* exec = toJS(ctx); + exec->globalData().heap.registerThread(); + JSLock lock(exec); + + JSValue jsValue = toJS(exec, value); + return jsValue.isUndefined(); +} + +bool JSValueIsNull(JSContextRef ctx, JSValueRef value) +{ + ExecState* exec = toJS(ctx); + exec->globalData().heap.registerThread(); + JSLock lock(exec); + + JSValue jsValue = toJS(exec, value); + return jsValue.isNull(); +} + +bool JSValueIsBoolean(JSContextRef ctx, JSValueRef value) +{ + ExecState* exec = toJS(ctx); + exec->globalData().heap.registerThread(); + JSLock lock(exec); + + JSValue jsValue = toJS(exec, value); + return jsValue.isBoolean(); +} + +bool JSValueIsNumber(JSContextRef ctx, JSValueRef value) +{ + ExecState* exec = toJS(ctx); + exec->globalData().heap.registerThread(); + JSLock lock(exec); + + JSValue jsValue = toJS(exec, value); + return jsValue.isNumber(); +} + +bool JSValueIsString(JSContextRef ctx, JSValueRef value) +{ + ExecState* exec = toJS(ctx); + exec->globalData().heap.registerThread(); + JSLock lock(exec); + + JSValue jsValue = toJS(exec, value); + return jsValue.isString(); +} + +bool JSValueIsObject(JSContextRef ctx, JSValueRef value) +{ + ExecState* exec = toJS(ctx); + exec->globalData().heap.registerThread(); + JSLock lock(exec); + + JSValue jsValue = toJS(exec, value); + return jsValue.isObject(); +} + +bool JSValueIsObjectOfClass(JSContextRef ctx, JSValueRef value, JSClassRef jsClass) +{ + ExecState* exec = toJS(ctx); + exec->globalData().heap.registerThread(); + JSLock lock(exec); + + JSValue jsValue = toJS(exec, value); + + if (JSObject* o = jsValue.getObject()) { + if (o->inherits(&JSCallbackObject::info)) + return static_cast*>(o)->inherits(jsClass); + else if (o->inherits(&JSCallbackObject::info)) + return static_cast*>(o)->inherits(jsClass); + } + return false; +} + +bool JSValueIsEqual(JSContextRef ctx, JSValueRef a, JSValueRef b, JSValueRef* exception) +{ + ExecState* exec = toJS(ctx); + exec->globalData().heap.registerThread(); + JSLock lock(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); + exec->globalData().heap.registerThread(); + JSLock lock(exec); + + JSValue jsA = toJS(exec, a); + JSValue jsB = toJS(exec, b); + + return JSValue::strictEqual(jsA, jsB); +} + +bool JSValueIsInstanceOfConstructor(JSContextRef ctx, JSValueRef value, JSObjectRef constructor, JSValueRef* exception) +{ + ExecState* exec = toJS(ctx); + exec->globalData().heap.registerThread(); + JSLock lock(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); + exec->globalData().heap.registerThread(); + JSLock lock(exec); + + return toRef(exec, jsUndefined()); +} + +JSValueRef JSValueMakeNull(JSContextRef ctx) +{ + ExecState* exec = toJS(ctx); + exec->globalData().heap.registerThread(); + JSLock lock(exec); + + return toRef(exec, jsNull()); +} + +JSValueRef JSValueMakeBoolean(JSContextRef ctx, bool value) +{ + ExecState* exec = toJS(ctx); + exec->globalData().heap.registerThread(); + JSLock lock(exec); + + return toRef(exec, jsBoolean(value)); +} + +JSValueRef JSValueMakeNumber(JSContextRef ctx, double value) +{ + ExecState* exec = toJS(ctx); + exec->globalData().heap.registerThread(); + JSLock lock(exec); + + return toRef(exec, jsNumber(exec, value)); +} + +JSValueRef JSValueMakeString(JSContextRef ctx, JSStringRef string) +{ + ExecState* exec = toJS(ctx); + exec->globalData().heap.registerThread(); + JSLock lock(exec); + + return toRef(exec, jsString(exec, string->ustring())); +} + +bool JSValueToBoolean(JSContextRef ctx, JSValueRef value) +{ + ExecState* exec = toJS(ctx); + exec->globalData().heap.registerThread(); + JSLock lock(exec); + + JSValue jsValue = toJS(exec, value); + return jsValue.toBoolean(exec); +} + +double JSValueToNumber(JSContextRef ctx, JSValueRef value, JSValueRef* exception) +{ + ExecState* exec = toJS(ctx); + exec->globalData().heap.registerThread(); + JSLock lock(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); + exec->globalData().heap.registerThread(); + JSLock lock(exec); + + JSValue jsValue = toJS(exec, value); + + RefPtr 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); + exec->globalData().heap.registerThread(); + JSLock lock(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); + exec->globalData().heap.registerThread(); + JSLock lock(exec); + + JSValue jsValue = toJS(exec, value); + gcProtect(jsValue); +} + +void JSValueUnprotect(JSContextRef ctx, JSValueRef value) +{ + ExecState* exec = toJS(ctx); + exec->globalData().heap.registerThread(); + JSLock lock(exec); + + JSValue jsValue = toJS(exec, value); + gcUnprotect(jsValue); +} diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSValueRef.h b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSValueRef.h new file mode 100644 index 0000000..7a7bf93 --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSValueRef.h @@ -0,0 +1,278 @@ +/* + * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef JSValueRef_h +#define JSValueRef_h + +#include + +#ifndef __cplusplus +#include +#endif + +/*! +@enum JSType +@abstract A constant identifying the type of a JSValue. +@constant kJSTypeUndefined The unique undefined value. +@constant kJSTypeNull The unique null value. +@constant kJSTypeBoolean A primitive boolean value, one of true or false. +@constant kJSTypeNumber A primitive number value. +@constant kJSTypeString A primitive string value. +@constant kJSTypeObject An object value (meaning that this JSValueRef is a JSObjectRef). +*/ +typedef enum { + kJSTypeUndefined, + kJSTypeNull, + kJSTypeBoolean, + kJSTypeNumber, + kJSTypeString, + kJSTypeObject +} JSType; + +#ifdef __cplusplus +extern "C" { +#endif + +/*! +@function +@abstract Returns a JavaScript value's type. +@param ctx The execution context to use. +@param value The JSValue whose type you want to obtain. +@result A value of type JSType that identifies value's type. +*/ +JS_EXPORT JSType JSValueGetType(JSContextRef ctx, JSValueRef value); + +/*! +@function +@abstract Tests whether a JavaScript value's type is the undefined type. +@param ctx The execution context to use. +@param value The JSValue to test. +@result true if value's type is the undefined type, otherwise false. +*/ +JS_EXPORT bool JSValueIsUndefined(JSContextRef ctx, JSValueRef value); + +/*! +@function +@abstract Tests whether a JavaScript value's type is the null type. +@param ctx The execution context to use. +@param value The JSValue to test. +@result true if value's type is the null type, otherwise false. +*/ +JS_EXPORT bool JSValueIsNull(JSContextRef ctx, JSValueRef value); + +/*! +@function +@abstract Tests whether a JavaScript value's type is the boolean type. +@param ctx The execution context to use. +@param value The JSValue to test. +@result true if value's type is the boolean type, otherwise false. +*/ +JS_EXPORT bool JSValueIsBoolean(JSContextRef ctx, JSValueRef value); + +/*! +@function +@abstract Tests whether a JavaScript value's type is the number type. +@param ctx The execution context to use. +@param value The JSValue to test. +@result true if value's type is the number type, otherwise false. +*/ +JS_EXPORT bool JSValueIsNumber(JSContextRef ctx, JSValueRef value); + +/*! +@function +@abstract Tests whether a JavaScript value's type is the string type. +@param ctx The execution context to use. +@param value The JSValue to test. +@result true if value's type is the string type, otherwise false. +*/ +JS_EXPORT bool JSValueIsString(JSContextRef ctx, JSValueRef value); + +/*! +@function +@abstract Tests whether a JavaScript value's type is the object type. +@param ctx The execution context to use. +@param value The JSValue to test. +@result true if value's type is the object type, otherwise false. +*/ +JS_EXPORT bool JSValueIsObject(JSContextRef ctx, JSValueRef value); + +/*! +@function +@abstract Tests whether a JavaScript value is an object with a given class in its class chain. +@param ctx The execution context to use. +@param value The JSValue to test. +@param jsClass The JSClass to test against. +@result true if value is an object and has jsClass in its class chain, otherwise false. +*/ +JS_EXPORT bool JSValueIsObjectOfClass(JSContextRef ctx, JSValueRef value, JSClassRef jsClass); + +/* Comparing values */ + +/*! +@function +@abstract Tests whether two JavaScript values are equal, as compared by the JS == operator. +@param ctx The execution context to use. +@param a The first value to test. +@param b The second value to test. +@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. +@result true if the two values are equal, false if they are not equal or an exception is thrown. +*/ +JS_EXPORT bool JSValueIsEqual(JSContextRef ctx, JSValueRef a, JSValueRef b, JSValueRef* exception); + +/*! +@function +@abstract Tests whether two JavaScript values are strict equal, as compared by the JS === operator. +@param ctx The execution context to use. +@param a The first value to test. +@param b The second value to test. +@result true if the two values are strict equal, otherwise false. +*/ +JS_EXPORT bool JSValueIsStrictEqual(JSContextRef ctx, JSValueRef a, JSValueRef b); + +/*! +@function +@abstract Tests whether a JavaScript value is an object constructed by a given constructor, as compared by the JS instanceof operator. +@param ctx The execution context to use. +@param value The JSValue to test. +@param constructor The constructor to test against. +@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. +@result true if value is an object constructed by constructor, as compared by the JS instanceof operator, otherwise false. +*/ +JS_EXPORT bool JSValueIsInstanceOfConstructor(JSContextRef ctx, JSValueRef value, JSObjectRef constructor, JSValueRef* exception); + +/* Creating values */ + +/*! +@function +@abstract Creates a JavaScript value of the undefined type. +@param ctx The execution context to use. +@result The unique undefined value. +*/ +JS_EXPORT JSValueRef JSValueMakeUndefined(JSContextRef ctx); + +/*! +@function +@abstract Creates a JavaScript value of the null type. +@param ctx The execution context to use. +@result The unique null value. +*/ +JS_EXPORT JSValueRef JSValueMakeNull(JSContextRef ctx); + +/*! +@function +@abstract Creates a JavaScript value of the boolean type. +@param ctx The execution context to use. +@param boolean The bool to assign to the newly created JSValue. +@result A JSValue of the boolean type, representing the value of boolean. +*/ +JS_EXPORT JSValueRef JSValueMakeBoolean(JSContextRef ctx, bool boolean); + +/*! +@function +@abstract Creates a JavaScript value of the number type. +@param ctx The execution context to use. +@param number The double to assign to the newly created JSValue. +@result A JSValue of the number type, representing the value of number. +*/ +JS_EXPORT JSValueRef JSValueMakeNumber(JSContextRef ctx, double number); + +/*! +@function +@abstract Creates a JavaScript value of the string type. +@param ctx The execution context to use. +@param string The JSString to assign to the newly created JSValue. The + newly created JSValue retains string, and releases it upon garbage collection. +@result A JSValue of the string type, representing the value of string. +*/ +JS_EXPORT JSValueRef JSValueMakeString(JSContextRef ctx, JSStringRef string); + +/* Converting to primitive values */ + +/*! +@function +@abstract Converts a JavaScript value to boolean and returns the resulting boolean. +@param ctx The execution context to use. +@param value The JSValue to convert. +@result The boolean result of conversion. +*/ +JS_EXPORT bool JSValueToBoolean(JSContextRef ctx, JSValueRef value); + +/*! +@function +@abstract Converts a JavaScript value to number and returns the resulting number. +@param ctx The execution context to use. +@param value The JSValue to convert. +@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. +@result The numeric result of conversion, or NaN if an exception is thrown. +*/ +JS_EXPORT double JSValueToNumber(JSContextRef ctx, JSValueRef value, JSValueRef* exception); + +/*! +@function +@abstract Converts a JavaScript value to string and copies the result into a JavaScript string. +@param ctx The execution context to use. +@param value The JSValue to convert. +@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. +@result A JSString with the result of conversion, or NULL if an exception is thrown. Ownership follows the Create Rule. +*/ +JS_EXPORT JSStringRef JSValueToStringCopy(JSContextRef ctx, JSValueRef value, JSValueRef* exception); + +/*! +@function +@abstract Converts a JavaScript value to object and returns the resulting object. +@param ctx The execution context to use. +@param value The JSValue to convert. +@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. +@result The JSObject result of conversion, or NULL if an exception is thrown. +*/ +JS_EXPORT JSObjectRef JSValueToObject(JSContextRef ctx, JSValueRef value, JSValueRef* exception); + +/* Garbage collection */ +/*! +@function +@abstract Protects a JavaScript value from garbage collection. +@param ctx The execution context to use. +@param value The JSValue to protect. +@discussion Use this method when you want to store a JSValue in a global or on the heap, where the garbage collector will not be able to discover your reference to it. + +A value may be protected multiple times and must be unprotected an equal number of times before becoming eligible for garbage collection. +*/ +JS_EXPORT void JSValueProtect(JSContextRef ctx, JSValueRef value); + +/*! +@function +@abstract Unprotects a JavaScript value from garbage collection. +@param ctx The execution context to use. +@param value The JSValue to unprotect. +@discussion A value may be protected multiple times and must be unprotected an + equal number of times before becoming eligible for garbage collection. +*/ +JS_EXPORT void JSValueUnprotect(JSContextRef ctx, JSValueRef value); + +#ifdef __cplusplus +} +#endif + +#endif /* JSValueRef_h */ diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/JavaScript.h b/src/3rdparty/javascriptcore/JavaScriptCore/API/JavaScript.h new file mode 100644 index 0000000..f8d92d8 --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JavaScript.h @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2006 Apple Inc. All rights reserved. + * Copyright (C) 2008 Alp Toker + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef JavaScript_h +#define JavaScript_h + +#include +#include +#include +#include +#include + +#endif /* JavaScript_h */ diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/JavaScriptCore.h b/src/3rdparty/javascriptcore/JavaScriptCore/API/JavaScriptCore.h new file mode 100644 index 0000000..87d6018 --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JavaScriptCore.h @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef JavaScriptCore_h +#define JavaScriptCore_h + +#include +#include + +#endif /* JavaScriptCore_h */ diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/OpaqueJSString.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/API/OpaqueJSString.cpp new file mode 100644 index 0000000..7c7b1af --- /dev/null +++ b/src/3rdparty/javascriptcore/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 +#include +#include + +using namespace JSC; + +PassRefPtr 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, true); + return UString::null(); +} + +Identifier OpaqueJSString::identifier(JSGlobalData* globalData) const +{ + if (!this || !m_characters) + return Identifier(globalData, static_cast(0)); + + return Identifier(globalData, m_characters, m_length); +} diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/OpaqueJSString.h b/src/3rdparty/javascriptcore/JavaScriptCore/API/OpaqueJSString.h new file mode 100644 index 0000000..473c815 --- /dev/null +++ b/src/3rdparty/javascriptcore/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 + +namespace JSC { + class Identifier; + class JSGlobalData; +} + +struct OpaqueJSString : public ThreadSafeShared { + + static PassRefPtr create() // null + { + return adoptRef(new OpaqueJSString); + } + + static PassRefPtr create(const UChar* characters, unsigned length) + { + return adoptRef(new OpaqueJSString(characters, length)); + } + + static PassRefPtr 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() + : 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/javascriptcore/JavaScriptCore/API/WebKitAvailability.h b/src/3rdparty/javascriptcore/JavaScriptCore/API/WebKitAvailability.h new file mode 100644 index 0000000..8402528 --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/WebKitAvailability.h @@ -0,0 +1,764 @@ +/* + * 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 __WebKitAvailability__ +#define __WebKitAvailability__ + +/* The structure of this header is based on AvailabilityMacros.h. The major difference is that the availability + macros are defined in terms of WebKit version numbers rather than Mac OS X system version numbers, as WebKit + releases span multiple versions of Mac OS X. +*/ + +#define WEBKIT_VERSION_1_0 0x0100 +#define WEBKIT_VERSION_1_1 0x0110 +#define WEBKIT_VERSION_1_2 0x0120 +#define WEBKIT_VERSION_1_3 0x0130 +#define WEBKIT_VERSION_2_0 0x0200 +#define WEBKIT_VERSION_3_0 0x0300 +#define WEBKIT_VERSION_3_1 0x0310 +#define WEBKIT_VERSION_4_0 0x0400 +#define WEBKIT_VERSION_LATEST 0x9999 + +#ifdef __APPLE__ +#import +#else +/* + * For non-Mac platforms, require the newest version. + */ +#define WEBKIT_VERSION_MIN_REQUIRED WEBKIT_VERSION_LATEST +/* + * only certain compilers support __attribute__((deprecated)) + */ +#if defined(__GNUC__) && ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1))) + #define DEPRECATED_ATTRIBUTE __attribute__((deprecated)) +#else + #define DEPRECATED_ATTRIBUTE +#endif +#endif + +/* The versions of GCC that shipped with Xcode prior to 3.0 (GCC build number < 5400) did not support attributes on methods. + If we are building with one of these versions, we need to omit the attribute. We achieve this by wrapping the annotation + in WEBKIT_OBJC_METHOD_ANNOTATION, which will remove the annotation when an old version of GCC is in use and will otherwise + expand to the annotation. The same is needed for protocol methods. +*/ +#if defined(__APPLE_CC__) && __APPLE_CC__ < 5400 + #define WEBKIT_OBJC_METHOD_ANNOTATION(ANNOTATION) +#else + #define WEBKIT_OBJC_METHOD_ANNOTATION(ANNOTATION) ANNOTATION +#endif + + +/* If minimum WebKit version is not specified, assume the version that shipped with the target Mac OS X version */ +#ifndef WEBKIT_VERSION_MIN_REQUIRED + #if !defined(MAC_OS_X_VERSION_10_2) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_2 + #error WebKit was not available prior to Mac OS X 10.2 + #elif !defined(MAC_OS_X_VERSION_10_3) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_3 + /* WebKit 1.0 is the only version available on Mac OS X 10.2. */ + #define WEBKIT_VERSION_MIN_REQUIRED WEBKIT_VERSION_1_0 + #elif !defined(MAC_OS_X_VERSION_10_4) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_4 + /* WebKit 1.1 is the version that shipped on Mac OS X 10.3. */ + #define WEBKIT_VERSION_MIN_REQUIRED WEBKIT_VERSION_1_1 + #elif !defined(MAC_OS_X_VERSION_10_5) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 + /* WebKit 2.0 is the version that shipped on Mac OS X 10.4. */ + #define WEBKIT_VERSION_MIN_REQUIRED WEBKIT_VERSION_2_0 + #elif !defined(MAC_OS_X_VERSION_10_6) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6 + /* WebKit 3.0 is the version that shipped on Mac OS X 10.5. */ + #define WEBKIT_VERSION_MIN_REQUIRED WEBKIT_VERSION_3_0 + #else + #define WEBKIT_VERSION_MIN_REQUIRED WEBKIT_VERSION_LATEST + #endif +#endif + + +/* If maximum WebKit version is not specified, assume largerof(latest, minimum) */ +#ifndef WEBKIT_VERSION_MAX_ALLOWED + #if WEBKIT_VERSION_MIN_REQUIRED > WEBKIT_VERSION_LATEST + #define WEBKIT_VERSION_MAX_ALLOWED WEBKIT_VERSION_MIN_REQUIRED + #else + #define WEBKIT_VERSION_MAX_ALLOWED WEBKIT_VERSION_LATEST + #endif +#endif + + +/* Sanity check the configured values */ +#if WEBKIT_VERSION_MAX_ALLOWED < WEBKIT_VERSION_MIN_REQUIRED + #error WEBKIT_VERSION_MAX_ALLOWED must be >= WEBKIT_VERSION_MIN_REQUIRED +#endif +#if WEBKIT_VERSION_MIN_REQUIRED < WEBKIT_VERSION_1_0 + #error WEBKIT_VERSION_MIN_REQUIRED must be >= WEBKIT_VERSION_1_0 +#endif + + + + + + +/* + * AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER + * + * Used on functions introduced in WebKit 1.0 + */ +#define AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER + +/* + * AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED + * + * Used on functions introduced in WebKit 1.0, + * and deprecated in WebKit 1.0 + */ +#define AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED DEPRECATED_ATTRIBUTE + +/* + * DEPRECATED_IN_WEBKIT_VERSION_1_0_AND_LATER + * + * Used on types deprecated in WebKit 1.0 + */ +#define DEPRECATED_IN_WEBKIT_VERSION_1_0_AND_LATER DEPRECATED_ATTRIBUTE + + + + + + +/* + * AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER + * + * Used on declarations introduced in WebKit 1.1 + */ +#if WEBKIT_VERSION_MAX_ALLOWED < WEBKIT_VERSION_1_1 + #define AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER UNAVAILABLE_ATTRIBUTE +#elif WEBKIT_VERSION_MIN_REQUIRED < WEBKIT_VERSION_1_1 + #define AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER WEAK_IMPORT_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED + * + * Used on declarations introduced in WebKit 1.1, + * and deprecated in WebKit 1.1 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_1_1 + #define AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_1_1 + * + * Used on declarations introduced in WebKit 1.0, + * but later deprecated in WebKit 1.1 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_1_1 + #define AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_1_1 DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_1_1 AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER +#endif + +/* + * DEPRECATED_IN_WEBKIT_VERSION_1_1_AND_LATER + * + * Used on types deprecated in WebKit 1.1 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_1_1 + #define DEPRECATED_IN_WEBKIT_VERSION_1_1_AND_LATER DEPRECATED_ATTRIBUTE +#else + #define DEPRECATED_IN_WEBKIT_VERSION_1_1_AND_LATER +#endif + + + + + + +/* + * AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER + * + * Used on declarations introduced in WebKit 1.2 + */ +#if WEBKIT_VERSION_MAX_ALLOWED < WEBKIT_VERSION_1_2 + #define AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER UNAVAILABLE_ATTRIBUTE +#elif WEBKIT_VERSION_MIN_REQUIRED < WEBKIT_VERSION_1_2 + #define AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER WEAK_IMPORT_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER_BUT_DEPRECATED + * + * Used on declarations introduced in WebKit 1.2, + * and deprecated in WebKit 1.2 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_1_2 + #define AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER_BUT_DEPRECATED DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER_BUT_DEPRECATED AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_1_2 + * + * Used on declarations introduced in WebKit 1.0, + * but later deprecated in WebKit 1.2 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_1_2 + #define AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_1_2 DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_1_2 AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_1_2 + * + * Used on declarations introduced in WebKit 1.1, + * but later deprecated in WebKit 1.2 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_1_2 + #define AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_1_2 DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_1_2 AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER +#endif + +/* + * DEPRECATED_IN_WEBKIT_VERSION_1_2_AND_LATER + * + * Used on types deprecated in WebKit 1.2 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_1_2 + #define DEPRECATED_IN_WEBKIT_VERSION_1_2_AND_LATER DEPRECATED_ATTRIBUTE +#else + #define DEPRECATED_IN_WEBKIT_VERSION_1_2_AND_LATER +#endif + + + + + + +/* + * AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER + * + * Used on declarations introduced in WebKit 1.3 + */ +#if WEBKIT_VERSION_MAX_ALLOWED < WEBKIT_VERSION_1_3 + #define AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER UNAVAILABLE_ATTRIBUTE +#elif WEBKIT_VERSION_MIN_REQUIRED < WEBKIT_VERSION_1_3 + #define AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER WEAK_IMPORT_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER_BUT_DEPRECATED + * + * Used on declarations introduced in WebKit 1.3, + * and deprecated in WebKit 1.3 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_1_3 + #define AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER_BUT_DEPRECATED DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER_BUT_DEPRECATED AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_1_3 + * + * Used on declarations introduced in WebKit 1.0, + * but later deprecated in WebKit 1.3 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_1_3 + #define AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_1_3 DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_1_3 AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_1_3 + * + * Used on declarations introduced in WebKit 1.1, + * but later deprecated in WebKit 1.3 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_1_3 + #define AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_1_3 DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_1_3 AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_1_3 + * + * Used on declarations introduced in WebKit 1.2, + * but later deprecated in WebKit 1.3 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_1_3 + #define AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_1_3 DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_1_3 AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER +#endif + +/* + * DEPRECATED_IN_WEBKIT_VERSION_1_3_AND_LATER + * + * Used on types deprecated in WebKit 1.3 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_1_3 + #define DEPRECATED_IN_WEBKIT_VERSION_1_3_AND_LATER DEPRECATED_ATTRIBUTE +#else + #define DEPRECATED_IN_WEBKIT_VERSION_1_3_AND_LATER +#endif + + + + + + +/* + * AVAILABLE_WEBKIT_VERSION_2_0_AND_LATER + * + * Used on declarations introduced in WebKit 2.0 + */ +#if WEBKIT_VERSION_MAX_ALLOWED < WEBKIT_VERSION_2_0 + #define AVAILABLE_WEBKIT_VERSION_2_0_AND_LATER UNAVAILABLE_ATTRIBUTE +#elif WEBKIT_VERSION_MIN_REQUIRED < WEBKIT_VERSION_2_0 + #define AVAILABLE_WEBKIT_VERSION_2_0_AND_LATER WEAK_IMPORT_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_2_0_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_2_0_AND_LATER_BUT_DEPRECATED + * + * Used on declarations introduced in WebKit 2.0, + * and deprecated in WebKit 2.0 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_2_0 + #define AVAILABLE_WEBKIT_VERSION_2_0_AND_LATER_BUT_DEPRECATED DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_2_0_AND_LATER_BUT_DEPRECATED AVAILABLE_WEBKIT_VERSION_2_0_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_2_0 + * + * Used on declarations introduced in WebKit 1.0, + * but later deprecated in WebKit 2.0 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_2_0 + #define AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_2_0 DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_2_0 AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_2_0 + * + * Used on declarations introduced in WebKit 1.1, + * but later deprecated in WebKit 2.0 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_2_0 + #define AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_2_0 DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_2_0 AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_2_0 + * + * Used on declarations introduced in WebKit 1.2, + * but later deprecated in WebKit 2.0 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_2_0 + #define AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_2_0 DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_2_0 AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_2_0 + * + * Used on declarations introduced in WebKit 1.3, + * but later deprecated in WebKit 2.0 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_2_0 + #define AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_2_0 DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_2_0 AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER +#endif + +/* + * DEPRECATED_IN_WEBKIT_VERSION_2_0_AND_LATER + * + * Used on types deprecated in WebKit 2.0 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_2_0 + #define DEPRECATED_IN_WEBKIT_VERSION_2_0_AND_LATER DEPRECATED_ATTRIBUTE +#else + #define DEPRECATED_IN_WEBKIT_VERSION_2_0_AND_LATER +#endif + + + + + + +/* + * AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER + * + * Used on declarations introduced in WebKit 3.0 + */ +#if WEBKIT_VERSION_MAX_ALLOWED < WEBKIT_VERSION_3_0 + #define AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER UNAVAILABLE_ATTRIBUTE +#elif WEBKIT_VERSION_MIN_REQUIRED < WEBKIT_VERSION_3_0 + #define AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER WEAK_IMPORT_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER_BUT_DEPRECATED + * + * Used on declarations introduced in WebKit 3.0, + * and deprecated in WebKit 3.0 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_3_0 + #define AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER_BUT_DEPRECATED DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER_BUT_DEPRECATED AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_0 + * + * Used on declarations introduced in WebKit 1.0, + * but later deprecated in WebKit 3.0 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_3_0 + #define AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_0 DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_0 AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_0 + * + * Used on declarations introduced in WebKit 1.1, + * but later deprecated in WebKit 3.0 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_3_0 + #define AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_0 DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_0 AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_0 + * + * Used on declarations introduced in WebKit 1.2, + * but later deprecated in WebKit 3.0 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_3_0 + #define AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_0 DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_0 AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_0 + * + * Used on declarations introduced in WebKit 1.3, + * but later deprecated in WebKit 3.0 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_3_0 + #define AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_0 DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_0 AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_2_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_0 + * + * Used on declarations introduced in WebKit 2.0, + * but later deprecated in WebKit 3.0 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_3_0 + #define AVAILABLE_WEBKIT_VERSION_2_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_0 DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_2_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_0 AVAILABLE_WEBKIT_VERSION_2_0_AND_LATER +#endif + +/* + * DEPRECATED_IN_WEBKIT_VERSION_3_0_AND_LATER + * + * Used on types deprecated in WebKit 3.0 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_3_0 + #define DEPRECATED_IN_WEBKIT_VERSION_3_0_AND_LATER DEPRECATED_ATTRIBUTE +#else + #define DEPRECATED_IN_WEBKIT_VERSION_3_0_AND_LATER +#endif + + + + + + +/* + * AVAILABLE_WEBKIT_VERSION_3_1_AND_LATER + * + * Used on declarations introduced in WebKit 3.1 + */ +#if WEBKIT_VERSION_MAX_ALLOWED < WEBKIT_VERSION_3_1 + #define AVAILABLE_WEBKIT_VERSION_3_1_AND_LATER UNAVAILABLE_ATTRIBUTE +#elif WEBKIT_VERSION_MIN_REQUIRED < WEBKIT_VERSION_3_1 + #define AVAILABLE_WEBKIT_VERSION_3_1_AND_LATER WEAK_IMPORT_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_3_1_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_3_1_AND_LATER_BUT_DEPRECATED + * + * Used on declarations introduced in WebKit 3.1, + * and deprecated in WebKit 3.1 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_3_1 + #define AVAILABLE_WEBKIT_VERSION_3_1_AND_LATER_BUT_DEPRECATED DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_3_1_AND_LATER_BUT_DEPRECATED AVAILABLE_WEBKIT_VERSION_3_1_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_1 + * + * Used on declarations introduced in WebKit 1.0, + * but later deprecated in WebKit 3.1 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_3_1 + #define AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_1 DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_1 AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_1 + * + * Used on declarations introduced in WebKit 1.1, + * but later deprecated in WebKit 3.1 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_3_1 + #define AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_1 DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_1 AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_1 + * + * Used on declarations introduced in WebKit 1.2, + * but later deprecated in WebKit 3.1 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_3_1 + #define AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_1 DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_1 AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_1 + * + * Used on declarations introduced in WebKit 1.3, + * but later deprecated in WebKit 3.1 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_3_1 + #define AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_1 DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_1 AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_2_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_1 + * + * Used on declarations introduced in WebKit 2.0, + * but later deprecated in WebKit 3.1 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_3_1 + #define AVAILABLE_WEBKIT_VERSION_2_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_1 DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_2_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_1 AVAILABLE_WEBKIT_VERSION_2_0_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_1 + * + * Used on declarations introduced in WebKit 3.0, + * but later deprecated in WebKit 3.1 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_3_1 + #define AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_1 DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_1 AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER +#endif + +/* + * DEPRECATED_IN_WEBKIT_VERSION_3_1_AND_LATER + * + * Used on types deprecated in WebKit 3.1 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_3_1 + #define DEPRECATED_IN_WEBKIT_VERSION_3_1_AND_LATER DEPRECATED_ATTRIBUTE +#else + #define DEPRECATED_IN_WEBKIT_VERSION_3_1_AND_LATER +#endif + + + + + + +/* + * AVAILABLE_IN_WEBKIT_VERSION_4_0 + * + * Used on declarations introduced in WebKit 4.0 + */ +#if WEBKIT_VERSION_MAX_ALLOWED < WEBKIT_VERSION_LATEST + #define AVAILABLE_IN_WEBKIT_VERSION_4_0 UNAVAILABLE_ATTRIBUTE +#elif WEBKIT_VERSION_MIN_REQUIRED < WEBKIT_VERSION_LATEST + #define AVAILABLE_IN_WEBKIT_VERSION_4_0 WEAK_IMPORT_ATTRIBUTE +#else + #define AVAILABLE_IN_WEBKIT_VERSION_4_0 +#endif + +/* + * AVAILABLE_IN_WEBKIT_VERSION_4_0_BUT_DEPRECATED + * + * Used on declarations introduced in WebKit 4.0, + * and deprecated in WebKit 4.0 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_LATEST + #define AVAILABLE_IN_WEBKIT_VERSION_4_0_BUT_DEPRECATED DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_IN_WEBKIT_VERSION_4_0_BUT_DEPRECATED AVAILABLE_IN_WEBKIT_VERSION_4_0 +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_4_0 + * + * Used on declarations introduced in WebKit 1.0, + * but later deprecated in WebKit 4.0 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_LATEST + #define AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_4_0 DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_4_0 AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_4_0 + * + * Used on declarations introduced in WebKit 1.1, + * but later deprecated in WebKit 4.0 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_LATEST + #define AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_4_0 DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_4_0 AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_4_0 + * + * Used on declarations introduced in WebKit 1.2, + * but later deprecated in WebKit 4.0 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_LATEST + #define AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_4_0 DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_4_0 AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_4_0 + * + * Used on declarations introduced in WebKit 1.3, + * but later deprecated in WebKit 4.0 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_LATEST + #define AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_4_0 DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_4_0 AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_2_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_4_0 + * + * Used on declarations introduced in WebKit 2.0, + * but later deprecated in WebKit 4.0 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_LATEST + #define AVAILABLE_WEBKIT_VERSION_2_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_4_0 DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_2_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_4_0 AVAILABLE_WEBKIT_VERSION_2_0_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_4_0 + * + * Used on declarations introduced in WebKit 3.0, + * but later deprecated in WebKit 4.0 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_LATEST + #define AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_4_0 DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_4_0 AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_3_1_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_4_0 + * + * Used on declarations introduced in WebKit 3.1, + * but later deprecated in WebKit 4.0 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_LATEST + #define AVAILABLE_WEBKIT_VERSION_3_1_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_4_0 DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_3_1_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_4_0 AVAILABLE_WEBKIT_VERSION_3_1_AND_LATER +#endif + +/* + * DEPRECATED_IN_WEBKIT_VERSION_4_0 + * + * Used on types deprecated in WebKit 4.0 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_LATEST + #define DEPRECATED_IN_WEBKIT_VERSION_4_0 DEPRECATED_ATTRIBUTE +#else + #define DEPRECATED_IN_WEBKIT_VERSION_4_0 +#endif + + +#endif /* __WebKitAvailability__ */ diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/AUTHORS b/src/3rdparty/javascriptcore/JavaScriptCore/AUTHORS new file mode 100644 index 0000000..e50da8c --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/AUTHORS @@ -0,0 +1,2 @@ +Harri Porten (porten@kde.org) +Peter Kelly (pmk@post.com) diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/COPYING.LIB b/src/3rdparty/javascriptcore/JavaScriptCore/COPYING.LIB new file mode 100644 index 0000000..87c4a33 --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/COPYING.LIB @@ -0,0 +1,488 @@ + + +NOTE! The LGPL below is copyrighted by the Free Software Foundation, but +the instance of code that it refers to (the kde libraries) are copyrighted +by the authors who actually wrote it. + +--------------------------------------------------------------------------- + GNU LIBRARY GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1991 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor + Boston, MA 02110-1301, USA. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the library GPL. It is + numbered 2 because it goes with version 2 of the ordinary GPL.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Library General Public License, applies to some +specially designated Free Software Foundation software, and to any +other libraries whose authors decide to use it. You can use it for +your libraries, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if +you distribute copies of the library, or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link a program with the library, you must provide +complete object files to the recipients so that they can relink them +with the library, after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + Our method of protecting your rights has two steps: (1) copyright +the library, and (2) offer you this license which gives you legal +permission to copy, distribute and/or modify the library. + + Also, for each distributor's protection, we want to make certain +that everyone understands that there is no warranty for this free +library. If the library is modified by someone else and passed on, we +want its recipients to know that what they have is not the original +version, so that any problems introduced by others will not reflect on +the original authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that companies distributing free +software will individually obtain patent licenses, thus in effect +transforming the program into proprietary software. To prevent this, +we have made it clear that any patent must be licensed for everyone's +free use or not licensed at all. + + Most GNU software, including some libraries, is covered by the ordinary +GNU General Public License, which was designed for utility programs. This +license, the GNU Library General Public License, applies to certain +designated libraries. This license is quite different from the ordinary +one; be sure to read it in full, and don't assume that anything in it is +the same as in the ordinary license. + + The reason we have a separate public license for some libraries is that +they blur the distinction we usually make between modifying or adding to a +program and simply using it. Linking a program with a library, without +changing the library, is in some sense simply using the library, and is +analogous to running a utility program or application program. However, in +a textual and legal sense, the linked executable is a combined work, a +derivative of the original library, and the ordinary General Public License +treats it as such. + + Because of this blurred distinction, using the ordinary General +Public License for libraries did not effectively promote software +sharing, because most developers did not use the libraries. We +concluded that weaker conditions might promote sharing better. + + However, unrestricted linking of non-free programs would deprive the +users of those programs of all benefit from the free status of the +libraries themselves. This Library General Public License is intended to +permit developers of non-free programs to use free libraries, while +preserving your freedom as a user of such programs to change the free +libraries that are incorporated in them. (We have not seen how to achieve +this as regards changes in header files, but we have achieved it as regards +changes in the actual functions of the Library.) The hope is that this +will lead to faster development of free libraries. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, while the latter only +works together with the library. + + Note that it is possible for a library to be covered by the ordinary +General Public License rather than by this special one. + + GNU LIBRARY GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library which +contains a notice placed by the copyright holder or other authorized +party saying it may be distributed under the terms of this Library +General Public License (also called "this License"). Each licensee is +addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also compile or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + c) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + d) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the source code distributed need not include anything that is normally +distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Library General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/ChangeLog b/src/3rdparty/javascriptcore/JavaScriptCore/ChangeLog new file mode 100644 index 0000000..24fc7e7 --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/ChangeLog @@ -0,0 +1,2726 @@ +2009-07-28 Xan Lopez + + Add new files, fixes distcheck. + + * GNUmakefile.am: + +2009-07-28 Csaba Osztrogonac + + 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 + + Fix of misuse of sort command. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: + +2009-07-27 Brian Weinstein + + Build fix for Windows. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: + +2009-07-27 Gavin Barraclough + + 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 + + Gtk build fix. + + * runtime/JSLock.cpp: (JSC::JSLock::JSLock): Fix "no threading" case. + +2009-07-27 Alexey Proskuryakov + + Release build fix. + + * runtime/JSLock.h: (JSC::JSLock::~JSLock): + +2009-07-27 Alexey Proskuryakov + + 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 + + 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 + + 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 + + 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 + + wx build fix, adding missing header. + + * jit/JIT.cpp: + +2009-07-22 Yong Li + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + Reviewed by David Levin. + + Fixed #undef typo. + https://bugs.webkit.org/show_bug.cgi?id=27506 + + * bytecode/Opcode.h: + +2009-07-21 Adam Roben + + 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 + + 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 + + Reviewed by NOBODY (Build fix). + + Build fix attempt #2 + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: + +2009-07-20 Oliver Hunt + + Reviewed by NOBODY (Build fix). + + Build fix attempt #1 + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: + +2009-07-20 Oliver Hunt + + 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): + (WTF::TryMallocReturnValue::getValue): + * wtf/PossiblyNull.h: + (WTF::PossiblyNull::PossiblyNull): + (WTF::PossiblyNull::~PossiblyNull): + (WTF::PossiblyNull::getValue): + * wtf/Platform.h: + +2009-07-20 Gavin Barraclough + + RS Oliver Hunt. + + Add ARM assembler files to xcodeproj, for convenience editing. + + * JavaScriptCore.xcodeproj/project.pbxproj: + +2009-07-20 Jessie Berlin + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + Signed off by Gabor Loki + + * 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + Reviewed by Adam Treat. + + https://bugs.webkit.org/show_bug.cgi?id=27303 + Implement createThreadInternal for WinCE. + Contains changes by George Staikos and Joe Mason + + * wtf/ThreadingWin.cpp: + (WTF::createThreadInternal): + +2009-07-15 Joe Mason + + Reviewed by George Staikos. + + https://bugs.webkit.org/show_bug.cgi?id=27298 + Platform defines for WINCE. + Contains changes by Yong Li , + George Staikos and Joe Mason + + * wtf/Platform.h: + +2009-07-15 Yong Li + + 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 + + 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 and refactored by + Joe Mason + + * wtf/Assertions.cpp: vprintf_stderr_common + +2009-07-15 Yong Li + + 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 + + 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 + + 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' to 'bool'" + + Same fix as in r38391. + + * JavaScriptCore/wtf/OwnArrayPtr.h: + +2009-07-15 Norbert Leser + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + Reviewed by Adam Treat. + + Authors: George Staikos , Joe Mason , Makoto Matsumoto , 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 + + Unreviewed make dist build fix. + + * GNUmakefile.am: + +2009-07-13 Drew Wilson + + 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 + + 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 + + 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 + + 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