From cfd86b747d32ac22246a1aa908eaa720c63a88c1 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Wed, 7 Nov 2012 11:22:47 +0100 Subject: Imported WebKit commit 20271caf2e2c016d5cef40184cddeefeac4f1876 (http://svn.webkit.org/repository/webkit/trunk@133733) New snapshot that contains all previous fixes as well as build fix for latest QtMultimedia API changes. --- Source/JavaScriptCore/API/JSStringRef.cpp | 3 +- Source/JavaScriptCore/API/JSStringRefCF.cpp | 6 + Source/JavaScriptCore/API/JSValueRef.cpp | 4 +- Source/JavaScriptCore/API/tests/minidom.c | 1 - Source/JavaScriptCore/API/tests/testapi.c | 1 - Source/JavaScriptCore/CMakeLists.txt | 4 +- Source/JavaScriptCore/ChangeLog | 1411 +++++++++++++++++++- Source/JavaScriptCore/Configurations/Base.xcconfig | 48 +- .../Configurations/CompilerVersion.xcconfig | 82 -- .../Configurations/DebugRelease.xcconfig | 13 +- .../Configurations/FeatureDefines.xcconfig | 61 +- Source/JavaScriptCore/Configurations/JSC.xcconfig | 2 +- .../Configurations/JavaScriptCore.xcconfig | 8 +- .../Configurations/ToolExecutable.xcconfig | 2 +- .../JavaScriptCore/Configurations/Version.xcconfig | 4 +- Source/JavaScriptCore/DerivedSources.pri | 20 +- Source/JavaScriptCore/GNUmakefile.list.am | 10 +- Source/JavaScriptCore/JavaScriptCore.pri | 4 + .../JavaScriptCore/JavaScriptCore.vcproj | 36 +- .../JavaScriptCore.xcodeproj/project.pbxproj | 90 +- Source/JavaScriptCore/LLIntOffsetsExtractor.pro | 6 +- Source/JavaScriptCore/Target.pri | 19 +- Source/JavaScriptCore/bytecode/ArrayProfile.cpp | 21 +- Source/JavaScriptCore/bytecode/ArrayProfile.h | 8 +- Source/JavaScriptCore/bytecode/CodeBlock.cpp | 441 +++--- Source/JavaScriptCore/bytecode/CodeBlock.h | 203 +-- Source/JavaScriptCore/bytecode/DFGExitProfile.h | 3 + Source/JavaScriptCore/bytecode/GetByIdStatus.cpp | 3 - .../JavaScriptCore/bytecode/MethodCallLinkInfo.cpp | 50 - .../JavaScriptCore/bytecode/MethodCallLinkInfo.h | 83 -- .../bytecode/MethodCallLinkStatus.cpp | 66 - .../JavaScriptCore/bytecode/MethodCallLinkStatus.h | 87 -- Source/JavaScriptCore/bytecode/Opcode.h | 6 +- Source/JavaScriptCore/bytecode/SpeculatedType.h | 5 + .../JavaScriptCore/bytecode/UnlinkedCodeBlock.cpp | 294 ++++ Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h | 700 ++++++++++ .../bytecompiler/BytecodeGenerator.cpp | 304 ++--- .../bytecompiler/BytecodeGenerator.h | 45 +- .../JavaScriptCore/bytecompiler/NodesCodegen.cpp | 1 - Source/JavaScriptCore/debugger/Debugger.cpp | 1 + Source/JavaScriptCore/dfg/DFGAbstractState.cpp | 108 +- Source/JavaScriptCore/dfg/DFGAbstractValue.h | 24 +- .../dfg/DFGArgumentsSimplificationPhase.cpp | 8 +- Source/JavaScriptCore/dfg/DFGArrayMode.cpp | 273 ++-- Source/JavaScriptCore/dfg/DFGArrayMode.h | 587 ++++---- Source/JavaScriptCore/dfg/DFGAssemblyHelpers.h | 7 + Source/JavaScriptCore/dfg/DFGByteCodeCache.h | 2 +- Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp | 141 +- Source/JavaScriptCore/dfg/DFGCSEPhase.cpp | 40 +- Source/JavaScriptCore/dfg/DFGCapabilities.h | 4 +- .../JavaScriptCore/dfg/DFGConstantFoldingPhase.cpp | 18 +- Source/JavaScriptCore/dfg/DFGFPRInfo.h | 4 +- Source/JavaScriptCore/dfg/DFGFixupPhase.cpp | 107 +- Source/JavaScriptCore/dfg/DFGGPRInfo.h | 10 +- Source/JavaScriptCore/dfg/DFGGraph.cpp | 2 +- Source/JavaScriptCore/dfg/DFGGraph.h | 13 +- Source/JavaScriptCore/dfg/DFGNode.h | 33 +- Source/JavaScriptCore/dfg/DFGNodeType.h | 3 +- Source/JavaScriptCore/dfg/DFGOSRExit.cpp | 2 +- Source/JavaScriptCore/dfg/DFGOSRExit.h | 4 +- Source/JavaScriptCore/dfg/DFGOSRExitCompiler.cpp | 9 +- .../JavaScriptCore/dfg/DFGOSRExitCompiler32_64.cpp | 8 +- Source/JavaScriptCore/dfg/DFGOSRExitCompiler64.cpp | 8 +- Source/JavaScriptCore/dfg/DFGOperations.cpp | 3 +- .../dfg/DFGPredictionPropagationPhase.cpp | 3 +- Source/JavaScriptCore/dfg/DFGRepatch.cpp | 10 +- Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp | 352 +++-- Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h | 44 +- .../JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp | 301 ++--- Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp | 310 ++--- .../disassembler/udis86/differences.txt | 2 + Source/JavaScriptCore/disassembler/udis86/itab.py | 16 +- Source/JavaScriptCore/heap/Heap.cpp | 5 +- Source/JavaScriptCore/heap/Heap.h | 6 + Source/JavaScriptCore/heap/MarkedAllocator.h | 12 +- Source/JavaScriptCore/heap/MarkedBlock.cpp | 27 +- Source/JavaScriptCore/heap/MarkedBlock.h | 26 +- Source/JavaScriptCore/heap/SlotVisitor.cpp | 6 + Source/JavaScriptCore/heap/WeakBlock.cpp | 4 +- Source/JavaScriptCore/interpreter/Interpreter.cpp | 35 +- Source/JavaScriptCore/interpreter/VMInspector.cpp | 463 +++++++ Source/JavaScriptCore/interpreter/VMInspector.h | 47 +- Source/JavaScriptCore/jit/JIT.cpp | 21 +- Source/JavaScriptCore/jit/JIT.h | 52 +- Source/JavaScriptCore/jit/JITDriver.h | 3 +- Source/JavaScriptCore/jit/JITOpcodes.cpp | 5 +- Source/JavaScriptCore/jit/JITOpcodes32_64.cpp | 5 +- Source/JavaScriptCore/jit/JITPropertyAccess.cpp | 155 +-- .../JavaScriptCore/jit/JITPropertyAccess32_64.cpp | 101 +- Source/JavaScriptCore/jit/JITStubs.cpp | 201 +-- Source/JavaScriptCore/jit/JITStubs.h | 4 +- Source/JavaScriptCore/llint/LLIntData.cpp | 2 +- .../JavaScriptCore/llint/LLIntOffsetsExtractor.cpp | 2 +- Source/JavaScriptCore/llint/LLIntSlowPaths.cpp | 57 +- Source/JavaScriptCore/llint/LLIntSlowPaths.h | 2 +- .../JavaScriptCore/llint/LowLevelInterpreter.asm | 82 +- .../JavaScriptCore/llint/LowLevelInterpreter.cpp | 118 +- .../llint/LowLevelInterpreter32_64.asm | 6 +- .../JavaScriptCore/llint/LowLevelInterpreter64.asm | 675 +++++----- Source/JavaScriptCore/offlineasm/armv7.rb | 2 +- Source/JavaScriptCore/offlineasm/asm.rb | 6 +- Source/JavaScriptCore/offlineasm/cloop.rb | 169 ++- Source/JavaScriptCore/offlineasm/instructions.rb | 52 +- Source/JavaScriptCore/offlineasm/x86.rb | 159 ++- Source/JavaScriptCore/parser/Lexer.cpp | 185 ++- Source/JavaScriptCore/parser/Lexer.h | 9 +- Source/JavaScriptCore/parser/Parser.h | 74 +- Source/JavaScriptCore/parser/ParserModes.h | 40 + Source/JavaScriptCore/parser/ParserTokens.h | 5 +- Source/JavaScriptCore/runtime/Arguments.h | 3 +- Source/JavaScriptCore/runtime/ArrayConventions.h | 2 +- .../runtime/CachedTranscendentalFunction.h | 4 +- Source/JavaScriptCore/runtime/CodeCache.cpp | 186 +++ Source/JavaScriptCore/runtime/CodeCache.h | 93 ++ Source/JavaScriptCore/runtime/DateConstructor.cpp | 2 +- Source/JavaScriptCore/runtime/DateInstanceCache.h | 6 +- Source/JavaScriptCore/runtime/ExceptionHelpers.cpp | 4 +- Source/JavaScriptCore/runtime/Executable.cpp | 247 ++-- Source/JavaScriptCore/runtime/Executable.h | 68 +- Source/JavaScriptCore/runtime/ExecutionHarness.h | 4 +- Source/JavaScriptCore/runtime/Identifier.cpp | 2 +- Source/JavaScriptCore/runtime/Identifier.h | 2 +- Source/JavaScriptCore/runtime/JSActivation.h | 7 +- Source/JavaScriptCore/runtime/JSArray.cpp | 14 +- Source/JavaScriptCore/runtime/JSArray.h | 460 +++---- Source/JavaScriptCore/runtime/JSCell.h | 589 ++++---- Source/JavaScriptCore/runtime/JSDateMath.cpp | 2 +- Source/JavaScriptCore/runtime/JSGlobalData.cpp | 14 +- Source/JavaScriptCore/runtime/JSGlobalData.h | 12 + Source/JavaScriptCore/runtime/JSGlobalObject.cpp | 55 + Source/JavaScriptCore/runtime/JSGlobalObject.h | 19 +- .../runtime/JSGlobalObjectFunctions.cpp | 16 +- Source/JavaScriptCore/runtime/JSONObject.cpp | 2 +- Source/JavaScriptCore/runtime/JSObject.h | 1394 +++++++++---------- Source/JavaScriptCore/runtime/JSScope.cpp | 5 +- Source/JavaScriptCore/runtime/JSType.h | 5 + Source/JavaScriptCore/runtime/JSTypeInfo.h | 2 +- Source/JavaScriptCore/runtime/JSValue.cpp | 2 +- Source/JavaScriptCore/runtime/JSValue.h | 4 + .../JavaScriptCore/runtime/JSValueInlineMethods.h | 2 +- Source/JavaScriptCore/runtime/MathObject.cpp | 4 +- Source/JavaScriptCore/runtime/Operations.h | 11 +- Source/JavaScriptCore/runtime/RegExpObject.cpp | 56 +- Source/JavaScriptCore/runtime/StringPrototype.cpp | 2 +- Source/JavaScriptCore/runtime/Structure.cpp | 9 + Source/JavaScriptCore/runtime/Structure.h | 5 + Source/JavaScriptCore/runtime/SymbolTable.h | 2 +- 147 files changed, 7904 insertions(+), 4847 deletions(-) delete mode 100644 Source/JavaScriptCore/Configurations/CompilerVersion.xcconfig delete mode 100644 Source/JavaScriptCore/bytecode/MethodCallLinkInfo.cpp delete mode 100644 Source/JavaScriptCore/bytecode/MethodCallLinkInfo.h delete mode 100644 Source/JavaScriptCore/bytecode/MethodCallLinkStatus.cpp delete mode 100644 Source/JavaScriptCore/bytecode/MethodCallLinkStatus.h create mode 100644 Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.cpp create mode 100644 Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h create mode 100644 Source/JavaScriptCore/parser/ParserModes.h create mode 100644 Source/JavaScriptCore/runtime/CodeCache.cpp create mode 100644 Source/JavaScriptCore/runtime/CodeCache.h (limited to 'Source/JavaScriptCore') diff --git a/Source/JavaScriptCore/API/JSStringRef.cpp b/Source/JavaScriptCore/API/JSStringRef.cpp index da1a3057a..7f2168dc2 100644 --- a/Source/JavaScriptCore/API/JSStringRef.cpp +++ b/Source/JavaScriptCore/API/JSStringRef.cpp @@ -47,9 +47,10 @@ JSStringRef JSStringCreateWithUTF8CString(const char* string) Vector buffer(length); UChar* p = buffer.data(); bool sourceIsAllASCII; + const LChar* stringStart = reinterpret_cast(string); if (conversionOK == convertUTF8ToUTF16(&string, string + length, &p, p + length, &sourceIsAllASCII)) { if (sourceIsAllASCII) - return OpaqueJSString::create(reinterpret_cast(string), length).leakRef(); + return OpaqueJSString::create(stringStart, length).leakRef(); return OpaqueJSString::create(buffer.data(), p - buffer.data()).leakRef(); } } diff --git a/Source/JavaScriptCore/API/JSStringRefCF.cpp b/Source/JavaScriptCore/API/JSStringRefCF.cpp index 69cf3f8c4..fd72a593c 100644 --- a/Source/JavaScriptCore/API/JSStringRefCF.cpp +++ b/Source/JavaScriptCore/API/JSStringRefCF.cpp @@ -41,6 +41,12 @@ JSStringRef JSStringCreateWithCFString(CFStringRef string) // it can hold. () size_t length = CFStringGetLength(string); if (length) { + Vector lcharBuffer(length); + CFIndex usedBufferLength; + CFIndex convertedSize = CFStringGetBytes(string, CFRangeMake(0, length), kCFStringEncodingISOLatin1, 0, false, lcharBuffer.data(), length, &usedBufferLength); + if (static_cast(convertedSize) == length && static_cast(usedBufferLength) == length) + return OpaqueJSString::create(lcharBuffer.data(), length).leakRef(); + OwnArrayPtr buffer = adoptArrayPtr(new UniChar[length]); CFStringGetCharacters(string, CFRangeMake(0, length), buffer.get()); COMPILE_ASSERT(sizeof(UniChar) == sizeof(UChar), unichar_and_uchar_must_be_same_size); diff --git a/Source/JavaScriptCore/API/JSValueRef.cpp b/Source/JavaScriptCore/API/JSValueRef.cpp index de84508c1..5ff7c03c6 100644 --- a/Source/JavaScriptCore/API/JSValueRef.cpp +++ b/Source/JavaScriptCore/API/JSValueRef.cpp @@ -217,7 +217,7 @@ JSValueRef JSValueMakeNumber(JSContextRef ctx, double value) // generated internally to JavaScriptCore naturally have that representation, // but an external NaN might not. if (isnan(value)) - value = std::numeric_limits::quiet_NaN(); + value = QNaN; return toRef(exec, jsNumber(value)); } @@ -282,7 +282,7 @@ double JSValueToNumber(JSContextRef ctx, JSValueRef value, JSValueRef* exception if (exception) *exception = toRef(exec, exec->exception()); exec->clearException(); - number = std::numeric_limits::quiet_NaN(); + number = QNaN; } return number; } diff --git a/Source/JavaScriptCore/API/tests/minidom.c b/Source/JavaScriptCore/API/tests/minidom.c index bd3e119e5..43ae2c1a8 100644 --- a/Source/JavaScriptCore/API/tests/minidom.c +++ b/Source/JavaScriptCore/API/tests/minidom.c @@ -30,7 +30,6 @@ #include "JSStringRef.h" #include #include -#include #include #include diff --git a/Source/JavaScriptCore/API/tests/testapi.c b/Source/JavaScriptCore/API/tests/testapi.c index b52a2b440..c2400f7ec 100644 --- a/Source/JavaScriptCore/API/tests/testapi.c +++ b/Source/JavaScriptCore/API/tests/testapi.c @@ -29,7 +29,6 @@ #include "JSObjectRefPrivate.h" #include #define ASSERT_DISABLED 0 -#include #include #include diff --git a/Source/JavaScriptCore/CMakeLists.txt b/Source/JavaScriptCore/CMakeLists.txt index c706f65e9..393db67c3 100644 --- a/Source/JavaScriptCore/CMakeLists.txt +++ b/Source/JavaScriptCore/CMakeLists.txt @@ -49,8 +49,6 @@ SET(JavaScriptCore_SOURCES bytecode/GetByIdStatus.cpp bytecode/JumpTable.cpp bytecode/LazyOperandValueProfile.cpp - bytecode/MethodCallLinkInfo.cpp - bytecode/MethodCallLinkStatus.cpp bytecode/MethodOfGettingAValueProfile.cpp bytecode/Opcode.cpp bytecode/PolymorphicPutByIdList.cpp @@ -61,6 +59,7 @@ SET(JavaScriptCore_SOURCES bytecode/SpecialPointer.cpp bytecode/StructureStubClearingWatchpoint.cpp bytecode/StructureStubInfo.cpp + bytecode/UnlinkedCodeBlock.cpp bytecode/Watchpoint.cpp bytecompiler/BytecodeGenerator.cpp @@ -176,6 +175,7 @@ SET(JavaScriptCore_SOURCES runtime/BooleanObject.cpp runtime/BooleanPrototype.cpp runtime/CallData.cpp + runtime/CodeCache.cpp runtime/CommonIdentifiers.cpp runtime/Completion.cpp runtime/ConstructData.cpp diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog index b2c4299ce..8479ac599 100644 --- a/Source/JavaScriptCore/ChangeLog +++ b/Source/JavaScriptCore/ChangeLog @@ -1,24 +1,1189 @@ +2012-11-06 Oliver Hunt + + Reduce parser overhead in JSC + https://bugs.webkit.org/show_bug.cgi?id=101127 + + Reviewed by Filip Pizlo. + + An exciting journey into the world of architecture in which our hero + adds yet another layer to JSC codegeneration. + + This patch adds a marginally more compact form of bytecode that is + free from any data specific to a given execution context, and that + does store any data structures necessary for execution. To actually + execute this UnlinkedBytecode we still need to instantiate a real + CodeBlock, but this is a much faster linear time operation than any + of the earlier parsing or code generation passes. + + As the unlinked code is context free we can then simply use a cache + from source to unlinked code mapping to completely avoid all of the + old parser overhead. The cache is currently very simple and memory + heavy, using the complete source text as a key (rather than SourceCode + or equivalent), and a random eviction policy. + + This seems to produce a substantial win when loading identical content + in different contexts. + + * API/tests/testapi.c: + (main): + * CMakeLists.txt: + * GNUmakefile.list.am: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: + * JavaScriptCore.xcodeproj/project.pbxproj: + * bytecode/CodeBlock.cpp: + * bytecode/CodeBlock.h: + Moved a number of fields, and a bunch of logic to UnlinkedCodeBlock.h/cpp + * bytecode/Opcode.h: + Added a global const init no op instruction needed to get correct + behaviour without any associated semantics. + * bytecode/UnlinkedCodeBlock.cpp: Added. + * bytecode/UnlinkedCodeBlock.h: Added. + A fairly shallow, GC allocated version of the old CodeBlock + classes with a 32bit instruction size, and just metadata + size tracking. + * bytecompiler/BytecodeGenerator.cpp: + * bytecompiler/BytecodeGenerator.h: + Replace direct access to m_symbolTable with access through + symbolTable(). ProgramCode no longer has a symbol table at + all so some previously unconditional (and pointless) uses + of symbolTable get null checks. + A few other changes to deal with type changes due to us generating + unlinked code (eg. pointer free, so profile indices rather than + pointers). + * dfg/DFGByteCodeParser.cpp: + * dfg/DFGCapabilities.h: + Support global_init_nop + * interpreter/Interpreter.cpp: + Now get the ProgramExecutable to initialise new global properties + before starting execution. + * jit/JIT.cpp: + * jit/JITDriver.h: + * jit/JITStubs.cpp: + * llint/LLIntData.cpp: + * llint/LLIntSlowPaths.cpp: + * llint/LowLevelInterpreter.asm: + * llint/LowLevelInterpreter32_64.asm: + * llint/LowLevelInterpreter64.asm: + Adding init_global_const_nop everywhere else + * parser/Parser.h: + * parser/ParserModes.h: Added. + * parser/ParserTokens.h: + Parser no longer needs a global object or callframe to function + * runtime/CodeCache.cpp: Added. + * runtime/CodeCache.h: Added. + A simple, random eviction, Source->UnlinkedCode cache + * runtime/Executable.cpp: + * runtime/Executable.h: + Executables now reference their unlinked counterparts, and + request code specifically for the target global object. + * runtime/JSGlobalData.cpp: + * runtime/JSGlobalData.h: + GlobalData now owns a CodeCache and a set of new structures + for the unlinked code types. + * runtime/JSGlobalObject.cpp: + * runtime/JSGlobalObject.h: + Utility functions used by executables to perform compilation + + * runtime/JSType.h: + Add new JSTypes for unlinked code + +2012-11-06 Michael Saboff + + JSStringCreateWithCFString() Should create an 8 bit String if possible + https://bugs.webkit.org/show_bug.cgi?id=101104 + + Reviewed by Darin Adler. + + Try converting the CFString to an 8 bit string using CFStringGetBytes(..., + kCFStringEncodingISOLatin1, ...) and return the 8 bit string if successful. + If not proceed with 16 bit conversion. + + * API/JSStringRefCF.cpp: + (JSStringCreateWithCFString): + +2012-11-06 Oliver Hunt + + Reduce direct m_symbolTable usage in CodeBlock + https://bugs.webkit.org/show_bug.cgi?id=101391 + + Reviewed by Sam Weinig. + + Simple refactoring. + + * bytecode/CodeBlock.cpp: + (JSC::CodeBlock::dump): + (JSC::CodeBlock::dumpStatistics): + (JSC::CodeBlock::nameForRegister): + * bytecode/CodeBlock.h: + (JSC::CodeBlock::isCaptured): + +2012-11-06 Michael Saboff + + Lexer::scanRegExp, create 8 bit pattern and flag Identifiers from 16 bit source when possible + https://bugs.webkit.org/show_bug.cgi?id=101013 + + Reviewed by Darin Adler. + + Changed scanRegExp so that it will create 8 bit identifiers from 8 bit sources and from 16 bit sources + whan all the characters are 8 bit. Using two templated helpers, the "is all 8 bit" check is only performed + on 16 bit sources. The first helper is orCharacter() that will accumulate the or value of all characters + only for 16 bit sources. Replaced the helper Lexer::makeIdentifierSameType() with Lexer::makeRightSizedIdentifier(). + + * parser/Lexer.cpp: + (JSC::orCharacter): Explicit template that serves as a placeholder. + (JSC::orCharacter): Explicit template that actually or accumulates characters. + (JSC::Lexer::scanRegExp): + * parser/Lexer.h: + (Lexer): + (JSC::Lexer::makeRightSizedIdentifier): New template that always creates an 8 bit Identifier. + (JSC::Lexer::makeRightSizedIdentifier): New template that creates an 8 bit Identifier for 8 bit + data in a 16 bit source. + +2012-11-06 Filip Pizlo + + Indentation of JSCell.h is wrong + https://bugs.webkit.org/show_bug.cgi?id=101379 + + Rubber stamped by Alexey Proskuryakov. + + Just removed four spaces on a bunch of lines. + + * runtime/JSCell.h: + +2012-11-05 Filip Pizlo + + Indentation of JSObject.h is wrong + https://bugs.webkit.org/show_bug.cgi?id=101313 + + Rubber stamped by Alexey Proskuryakov. + + Just unindented code, since namespace bodies shouldn't be indented. + + * runtime/JSObject.h: + +2012-11-05 Filip Pizlo + + Indentation of JSArray.h is wrong + https://bugs.webkit.org/show_bug.cgi?id=101314 + + Rubber stamped by Alexey Proskuryakov. + + Just removing the indentation inside the namespace body. + + * runtime/JSArray.h: + +2012-11-05 Filip Pizlo + + DFG should not fall down to patchable GetById just because a prototype had things added to it + https://bugs.webkit.org/show_bug.cgi?id=101299 + + Reviewed by Geoffrey Garen. + + This looks like a slight win on V8v7 and SunSpider. + + * bytecode/DFGExitProfile.h: + (JSC::DFG::exitKindToString): + * dfg/DFGSpeculativeJIT64.cpp: + (JSC::DFG::SpeculativeJIT::compile): + +2012-11-05 Filip Pizlo + + Get rid of method_check + https://bugs.webkit.org/show_bug.cgi?id=101147 + + Reviewed by Geoffrey Garen. + + op_method_check no longer buys us anything, since get_by_id proto caching + gives just as much profiling information and the DFG inlines monomorphic + proto accesses anyway. + + This also has the potential for a speed-up since it makes parsing of + profiling data easier. No longer do we have to deal with the confusion of + the get_by_id portion of a method_check appearing monomorphic even though + we're really dealing with a bimorphic access (method_check specializes for + one case and get_by_id for another). + + This looks like a 1% speed-up on both SunSpider and V8v7. + + * CMakeLists.txt: + * GNUmakefile.list.am: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: + * JavaScriptCore.xcodeproj/project.pbxproj: + * Target.pri: + * bytecode/CodeBlock.cpp: + (JSC::CodeBlock::printGetByIdCacheStatus): + (JSC::CodeBlock::dump): + (JSC::CodeBlock::finalizeUnconditionally): + (JSC::CodeBlock::shrinkToFit): + (JSC::CodeBlock::unlinkCalls): + * bytecode/CodeBlock.h: + (JSC::CodeBlock::getCallLinkInfo): + (JSC::CodeBlock::callLinkInfo): + (CodeBlock): + * bytecode/GetByIdStatus.cpp: + (JSC::GetByIdStatus::computeFromLLInt): + * bytecode/MethodCallLinkInfo.cpp: Removed. + * bytecode/MethodCallLinkInfo.h: Removed. + * bytecode/MethodCallLinkStatus.cpp: Removed. + * bytecode/MethodCallLinkStatus.h: Removed. + * bytecode/Opcode.h: + (JSC): + (JSC::padOpcodeName): + * bytecompiler/BytecodeGenerator.cpp: + (JSC): + * bytecompiler/BytecodeGenerator.h: + (BytecodeGenerator): + * bytecompiler/NodesCodegen.cpp: + (JSC::FunctionCallDotNode::emitBytecode): + * dfg/DFGByteCodeParser.cpp: + (JSC::DFG::ByteCodeParser::parseBlock): + * dfg/DFGCapabilities.h: + (JSC::DFG::canCompileOpcode): + * jit/JIT.cpp: + (JSC::JIT::privateCompileMainPass): + (JSC::JIT::privateCompileSlowCases): + (JSC::PropertyStubCompilationInfo::copyToStubInfo): + (JSC::JIT::privateCompile): + * jit/JIT.h: + (JSC::PropertyStubCompilationInfo::slowCaseInfo): + (PropertyStubCompilationInfo): + (JSC): + (JIT): + * jit/JITPropertyAccess.cpp: + (JSC): + (JSC::JIT::emitSlow_op_get_by_id): + (JSC::JIT::compileGetByIdSlowCase): + * jit/JITPropertyAccess32_64.cpp: + (JSC): + (JSC::JIT::compileGetByIdSlowCase): + * jit/JITStubs.cpp: + (JSC): + * jit/JITStubs.h: + * llint/LowLevelInterpreter.asm: + +2012-11-05 Yuqiang Xian + + Refactor LLInt64 to distinguish the pointer operations from the 64-bit integer operations + https://bugs.webkit.org/show_bug.cgi?id=100321 + + Reviewed by Filip Pizlo. + + We have refactored the MacroAssembler and JIT compilers to distinguish + the pointer operations from the 64-bit integer operations (see bug #99154). + Now we want to do the similar work for LLInt, and the goal is same as + the one mentioned in 99154. + + This is the second part of the modification: in the low level interpreter, + changing the operations on 64-bit integers to use the "q" instructions. + This also removes some unused/meaningless "p" instructions. + + * llint/LowLevelInterpreter.asm: + * llint/LowLevelInterpreter.cpp: + (JSC::CLoop::execute): + * llint/LowLevelInterpreter64.asm: + * offlineasm/armv7.rb: + * offlineasm/cloop.rb: + * offlineasm/instructions.rb: + * offlineasm/x86.rb: + +2012-11-05 Filip Pizlo + + Prototype chain caching should check that the path from the base object to the slot base involves prototype hops only + https://bugs.webkit.org/show_bug.cgi?id=101276 + + Reviewed by Gavin Barraclough. + + Changed normalizePrototypeChain() to report an invalid prototype chain if any object is a proxy. + This catches cases where our prototype chain checks would have been insufficient to guard against + newly introduced properties, despecialized properties, or deleted properties in the chain of + objects involved in the access. + + * dfg/DFGRepatch.cpp: + (JSC::DFG::tryCacheGetByID): + (JSC::DFG::tryBuildGetByIDProtoList): + (JSC::DFG::tryCachePutByID): + (JSC::DFG::tryBuildPutByIdList): + * jit/JITStubs.cpp: + (JSC::JITThunks::tryCachePutByID): + (JSC::JITThunks::tryCacheGetByID): + (JSC::DEFINE_STUB_FUNCTION): + * llint/LLIntSlowPaths.cpp: + (JSC::LLInt::LLINT_SLOW_PATH_DECL): + * runtime/Operations.h: + (JSC): + (JSC::normalizePrototypeChain): + +2012-11-05 Dima Gorbik + + Back out controversial changes from Bug 98665. + https://bugs.webkit.org/show_bug.cgi?id=101244 + + Reviewed by David Kilzer. + + Backing out changes from Bug 98665 until further discussions take place on rules for including Platform.h in Assertions.h. + + * API/tests/minidom.c: + * API/tests/testapi.c: + +2012-11-04 Filip Pizlo + + Reduce the verbosity of referring to QNaN in JavaScriptCore + https://bugs.webkit.org/show_bug.cgi?id=101174 + + Reviewed by Geoffrey Garen. + + Introduces a #define QNaN in JSValue.h, and replaces all previous uses of + std::numeric_limits::quiet_NaN() with QNaN. + + * API/JSValueRef.cpp: + (JSValueMakeNumber): + (JSValueToNumber): + * dfg/DFGSpeculativeJIT.cpp: + (JSC::DFG::SpeculativeJIT::compileGetByValOnFloatTypedArray): + * jit/JITPropertyAccess.cpp: + (JSC::JIT::emitFloatTypedArrayGetByVal): + * runtime/CachedTranscendentalFunction.h: + (JSC::CachedTranscendentalFunction::initialize): + * runtime/DateConstructor.cpp: + (JSC::constructDate): + * runtime/DateInstanceCache.h: + (JSC::DateInstanceData::DateInstanceData): + (JSC::DateInstanceCache::reset): + * runtime/ExceptionHelpers.cpp: + (JSC::InterruptedExecutionError::defaultValue): + (JSC::TerminatedExecutionError::defaultValue): + * runtime/JSCell.h: + (JSC::JSValue::getPrimitiveNumber): + * runtime/JSDateMath.cpp: + (JSC::parseDateFromNullTerminatedCharacters): + * runtime/JSGlobalData.cpp: + (JSC::JSGlobalData::JSGlobalData): + (JSC::JSGlobalData::resetDateCache): + * runtime/JSGlobalObjectFunctions.cpp: + (JSC::parseInt): + (JSC::jsStrDecimalLiteral): + (JSC::toDouble): + (JSC::jsToNumber): + (JSC::parseFloat): + * runtime/JSValue.cpp: + (JSC::JSValue::toNumberSlowCase): + * runtime/JSValue.h: + (JSC): + * runtime/JSValueInlineMethods.h: + (JSC::jsNaN): + * runtime/MathObject.cpp: + (JSC::mathProtoFuncMax): + (JSC::mathProtoFuncMin): + +2012-11-03 Filip Pizlo + + Baseline JIT should use structure watchpoints whenever possible + https://bugs.webkit.org/show_bug.cgi?id=101146 + + Reviewed by Sam Weinig. + + No speed-up yet except on toy programs. I think that it will start to show + speed-ups with https://bugs.webkit.org/show_bug.cgi?id=101147, which this is + a step towards. + + * jit/JIT.h: + (JIT): + * jit/JITPropertyAccess.cpp: + (JSC::JIT::privateCompilePutByIdTransition): + (JSC::JIT::privateCompileGetByIdProto): + (JSC::JIT::privateCompileGetByIdProtoList): + (JSC::JIT::privateCompileGetByIdChainList): + (JSC::JIT::privateCompileGetByIdChain): + (JSC::JIT::addStructureTransitionCheck): + (JSC): + (JSC::JIT::testPrototype): + * jit/JITPropertyAccess32_64.cpp: + (JSC::JIT::privateCompilePutByIdTransition): + (JSC::JIT::privateCompileGetByIdProto): + (JSC::JIT::privateCompileGetByIdProtoList): + (JSC::JIT::privateCompileGetByIdChainList): + (JSC::JIT::privateCompileGetByIdChain): + +2012-11-04 Csaba Osztrogonác + + [Qt] udis86_itab.c is always regenerated + https://bugs.webkit.org/show_bug.cgi?id=100756 + + Reviewed by Simon Hausmann. + + * DerivedSources.pri: Generate sources to the generated directory. + * disassembler/udis86/differences.txt: + * disassembler/udis86/itab.py: Add --outputDir option. + (UdItabGenerator.__init__): + (genItabH): + (genItabC): + (main): + +2012-11-02 Filip Pizlo + + LLInt 32-bit put_by_val ArrayStorage case should use the right register (t3, not t2) for the index in the publicLength updating path + https://bugs.webkit.org/show_bug.cgi?id=101118 + + Reviewed by Gavin Barraclough. + + * llint/LowLevelInterpreter32_64.asm: + +2012-11-02 Filip Pizlo + + DFG::Node::converToStructureTransitionWatchpoint should take kindly to ArrayifyToStructure + https://bugs.webkit.org/show_bug.cgi?id=101117 + + Reviewed by Gavin Barraclough. + + We have logic to convert ArrayifyToStructure to StructureTransitionWatchpoint, which is awesome, except + that previously convertToStructureTransitionWatchpoint was (a) asserting that it never saw an + ArrayifyToStructure and (b) would incorrectly create a ForwardStructureTransitionWatchpoint if it did. + + * dfg/DFGNode.h: + (JSC::DFG::Node::convertToStructureTransitionWatchpoint): + +2012-11-02 Filip Pizlo + + DFG::SpeculativeJIT::typedArrayDescriptor should use the Float64Array descriptor for Float64Arrays + https://bugs.webkit.org/show_bug.cgi?id=101114 + + Reviewed by Gavin Barraclough. + + As in https://bugs.webkit.org/show_bug.cgi?id=101112, this was only wrong when Float64Array descriptors + hadn't been initialized yet. That happens rarely, but when it does happen, we would crash. + + This would also become much more wrong if we ever put type size info (num bytes, etc) in the descriptor + and used that directly. So it's good to fix it. + + * dfg/DFGSpeculativeJIT.cpp: + (JSC::DFG::SpeculativeJIT::typedArrayDescriptor): + +2012-11-02 Filip Pizlo + + JIT::privateCompileGetByVal should use the uint8ClampedArrayDescriptor for compiling accesses to Uint8ClampedArrays + https://bugs.webkit.org/show_bug.cgi?id=101112 + + Reviewed by Gavin Barraclough. + + The only reason why the code was wrong to use uint8ArrayDescriptor instead is that if we're just using + Uint8ClampedArrays then the descriptor for Uint8Array may not have been initialized. + + * jit/JITPropertyAccess.cpp: + (JSC::JIT::privateCompileGetByVal): + +2012-11-02 Mark Hahnenberg + + MarkedBlocks should use something other than the mark bits to indicate liveness for newly allocated objects + https://bugs.webkit.org/show_bug.cgi?id=100877 + + Reviewed by Filip Pizlo. + + Currently when we canonicalize cell liveness data in MarkedBlocks, we set the mark bit for every cell in the + block except for those in the free list. This allows us to consider objects that were allocated since the + previous collection to be considered live until they have a chance to be properly marked by the collector. + + If we want to use the mark bits to signify other types of information, e.g. using sticky mark bits for generational + collection, we will have to keep track of newly allocated objects in a different fashion when we canonicalize cell liveness. + + One method would be to allocate a separate set of bits while canonicalizing liveness data. These bits would + track the newly allocated objects in the block separately from those objects who had already been marked. We would + then check these bits, along with the mark bits, when determining liveness. + + * heap/Heap.h: + (Heap): + (JSC::Heap::isLive): We now check for the presence of the newlyAllocated Bitmap. + (JSC): + * heap/MarkedBlock.cpp: + (JSC::MarkedBlock::specializedSweep): We clear the newlyAllocated Bitmap if we're creating a free list. This + will happen if we canonicalize liveness data for some other reason than collection (e.g. forEachCell) and + then start allocating again. + (JSC::SetNewlyAllocatedFunctor::SetNewlyAllocatedFunctor): + (SetNewlyAllocatedFunctor): + (JSC::SetNewlyAllocatedFunctor::operator()): We set the newlyAllocated bits for all the objects + that aren't already marked. We undo the bits for the objects in the free list later in canonicalizeCellLivenessData. + (JSC::MarkedBlock::canonicalizeCellLivenessData): We should never have a FreeListed block with a newlyAllocated Bitmap. + We allocate the new Bitmap, set the bits for all the objects that aren't already marked, and then unset all of the + bits for the items currently in the FreeList. + * heap/MarkedBlock.h: + (JSC::MarkedBlock::clearMarks): We clear the newlyAllocated bitmap if it exists because at this point we don't need it + any more. + (JSC::MarkedBlock::isEmpty): If we have some objects that are newlyAllocated, we are not empty. + (JSC::MarkedBlock::isNewlyAllocated): + (JSC): + (JSC::MarkedBlock::setNewlyAllocated): + (JSC::MarkedBlock::clearNewlyAllocated): + (JSC::MarkedBlock::isLive): We now check the newlyAllocated Bitmap, if it exists, when determining liveness of a cell in + a block that is Marked. + * heap/WeakBlock.cpp: + (JSC::WeakBlock::visit): We need to make sure we don't finalize objects that are in the newlyAllocated Bitmap. + (JSC::WeakBlock::reap): Ditto. + +2012-11-02 Filip Pizlo + + JIT::privateCompileGetByVal should use MacroAssemblerCodePtr::createFromExecutableAddress like JIT::privateCompilePutByVal + https://bugs.webkit.org/show_bug.cgi?id=101109 + + Reviewed by Gavin Barraclough. + + This fixes crashes on ARMv7 resulting from the return address already being tagged with the THUMB2 bit. + + * jit/JITPropertyAccess.cpp: + (JSC::JIT::privateCompileGetByVal): + +2012-11-02 Simon Fraser + + Enable SUBPIXEL_LAYOUT on Mac + https://bugs.webkit.org/show_bug.cgi?id=101076 + + Reviewed by Dave Hyatt. + + Define ENABLE_SUBPIXEL_LAYOUT and include it in FEATURE_DEFINES. + + * Configurations/FeatureDefines.xcconfig: + +2012-11-02 Michael Saboff + + RegExp.prototype.toString Should Produce an 8 bit JSString if possible. + https://bugs.webkit.org/show_bug.cgi?id=101003 + + Reviewed by Geoffrey Garen. + + Took the logic of regExpObjectSource() and created two templated helpers that uses the + source character type when appending to the StringBuilder. + + * runtime/RegExpObject.cpp: + (JSC::appendLineTerminatorEscape): Checks line terminate type to come up with escaped version. + (JSC::regExpObjectSourceInternal): Templated version of original. + (JSC::regExpObjectSource): Wrapper function. + +2012-11-02 Adam Barth + + ENABLE(UNDO_MANAGER) is disabled everywhere and is not under active development + https://bugs.webkit.org/show_bug.cgi?id=100711 + + Reviewed by Eric Seidel. + + * Configurations/FeatureDefines.xcconfig: + 2012-11-02 Simon Hausmann - [Qt] Fix build on Windows when Qt is configured with -release - https://bugs.webkit.org/show_bug.cgi?id=101041 + [Qt] Fix build on Windows when Qt is configured with -release + https://bugs.webkit.org/show_bug.cgi?id=101041 + + Reviewed by Jocelyn Turcotte. + + When Qt is configured with -debug or -release, the release/debug build of for example + QtCore is not available by default. For LLIntExtractor we always need to build debug + _and_ release versions, but we do not actually need any Qt libraries nor qtmain(d).lib. + Therefore we can disable all these features but need to keep $$QT.core.includes in the + INCLUDEPATH for some defines from qglobal.h. + + * LLIntOffsetsExtractor.pro: + +2012-11-01 Mark Lam + + A llint workaround for a toolchain issue. + https://bugs.webkit.org/show_bug.cgi?id=101012. + + Reviewed by Michael Saboff. + + * llint/LowLevelInterpreter.asm: + - use a local label to workaround the toolchain issue with undeclared + global labels. + +2012-11-01 Oliver Hunt + + Remove GlobalObject constant register that is typically unused + https://bugs.webkit.org/show_bug.cgi?id=101005 + + Reviewed by Geoffrey Garen. + + The GlobalObject constant register is frequently allocated even when it + is not used, it is also getting in the way of some other optimisations. + + * bytecode/CodeBlock.cpp: + (JSC::CodeBlock::CodeBlock): + * bytecode/CodeBlock.h: + (CodeBlock): + * bytecompiler/BytecodeGenerator.cpp: + (JSC::BytecodeGenerator::BytecodeGenerator): + * dfg/DFGByteCodeParser.cpp: + (JSC::DFG::ByteCodeParser::parseResolveOperations): + +2012-10-31 Filip Pizlo + + DFG optimized string access code should be enabled + https://bugs.webkit.org/show_bug.cgi?id=100825 + + Reviewed by Oliver Hunt. + + - Removes prediction checks from the parser. + + - Fixes the handling of array mode refinement for strings. I.e. we don't do + any refinement - we already know it's going to be a string. We could + revisit this in the future, but for now the DFG lacks the ability to + handle any array modes other than Array::String for string intrinsics, so + this is as good as it gets. + + - Removes uses of isBlahSpeculation for checking if a mode is already + checked. isBlahSpeculation implicitly checks if the SpeculatedType is not + BOTTOM ("empty"), which breaks for checking if a mode is already checked + since a mode may already be "checked" in the sense that we've proven that + the code is unreachable. + + ~1% speed-up on V8v7, mostly from a speed-up on crypto, which uses string + intrinsics in one of the hot functions. + + * bytecode/SpeculatedType.h: + (JSC::speculationChecked): + (JSC): + * dfg/DFGArrayMode.cpp: + (JSC::DFG::ArrayMode::alreadyChecked): + * dfg/DFGByteCodeParser.cpp: + (JSC::DFG::ByteCodeParser::handleIntrinsic): + * dfg/DFGFixupPhase.cpp: + (JSC::DFG::FixupPhase::fixupNode): + * dfg/DFGSpeculativeJIT.cpp: + (JSC::DFG::SpeculativeJIT::compileGetCharCodeAt): + +2012-10-31 Filip Pizlo + + Sparse array size threshold should be increased to 100000 + https://bugs.webkit.org/show_bug.cgi?id=100827 + + Reviewed by Oliver Hunt. + + This enables the use of contiguous arrays in programs that previously + couldn't use them. And I so far can't see any examples of this being + a downside. To the extent that there is a downside, it ought to be + addressed by GC: https://bugs.webkit.org/show_bug.cgi?id=100828 + + * runtime/ArrayConventions.h: + (JSC): + +2012-10-31 Mark Lam + + C++ llint 64-bit backend needs to zero extend results of int32 operations. + https://bugs.webkit.org/show_bug.cgi?id=100899. + + Reviewed by Filip Pizlo. + + llint asm instructions ending in "i" for a 64-bit machine expects the + high 32-bit of registers to be zero'ed out when a 32-bit instruction + writes into a register. Fixed the C++ llint to honor this. + + Fixed the index register used in BaseIndex addressing to be of size + intptr_t as expected. + + Updated CLoopRegister to handle different endiannesss configurations. + + * llint/LowLevelInterpreter.cpp: + (JSC::CLoopRegister::clearHighWord): + - new method to clear the high 32-bit of a 64-bit register. + It's a no-op for the 32-bit build. + (CLoopRegister): + - CLoopRegister now takes care of packing and byte endianness order. + (JSC::CLoop::execute): - Added an assert. + * offlineasm/cloop.rb: + - Add calls to clearHighWord() wherever needed. + +2012-10-31 Mark Lam + + A JSC printf (support for %J+s and %b). + https://bugs.webkit.org/show_bug.cgi?id=100566. + + Reviewed by Michael Saboff. + + Added VMInspector::printf(), fprintf(), sprintf(), and snprintf(). + - %b prints ints as boolean TRUE (non-zero) or FALSE (zero). + - %Js prints a WTF::String* like a %s prints a char*. + Also works for 16bit WTF::Strings (prints wchar_t* using %S). + - '+' is a modifier meaning 'use verbose mode', and %J+s is an example + of its use. + + * JavaScriptCore.xcodeproj/project.pbxproj: + * interpreter/VMInspector.cpp: + (FormatPrinter): + (JSC::FormatPrinter::~FormatPrinter): + (JSC::FormatPrinter::print): + (JSC::FormatPrinter::printArg): + (JSC::FormatPrinter::printWTFString): + (JSC::FileFormatPrinter::FileFormatPrinter): + (JSC::FileFormatPrinter::printArg): + (JSC::StringFormatPrinter::StringFormatPrinter): + (JSC::StringFormatPrinter::printArg): + (JSC::StringNFormatPrinter::StringNFormatPrinter): + (JSC::StringNFormatPrinter::printArg): + (JSC::VMInspector::fprintf): + (JSC::VMInspector::printf): + (JSC::VMInspector::sprintf): + (JSC::VMInspector::snprintf): + * interpreter/VMInspector.h: + (VMInspector): + +2012-10-31 Mark Lam + + 64-bit llint PC offset can be negative: using an unsigned shift is a bug. + https://bugs.webkit.org/show_bug.cgi?id=100896. + + Reviewed by Filip Pizlo. + + Fixed the PC offset divisions in the 64-bit llint asm to use rshift instead of urshift. + + * llint/LowLevelInterpreter64.asm: + +2012-10-30 Yuqiang Xian + + glsl-function-atan.html WebGL conformance test fails after https://bugs.webkit.org/show_bug.cgi?id=99154 + https://bugs.webkit.org/show_bug.cgi?id=100789 + + Reviewed by Filip Pizlo. + + We accidently missed a bitwise double to int64 conversion. + + * dfg/DFGSpeculativeJIT.h: + (JSC::DFG::SpeculativeJIT::silentFill): + +2012-10-30 Joseph Pecoraro + + [Mac] Sync up FeatureDefine Configuration Files + https://bugs.webkit.org/show_bug.cgi?id=100171 + + Reviewed by David Kilzer. + + Follow up to better coordinate with iOS feature defines. Make: + + - ENABLE_FILTERS always on + - ENABLE_INPUT_* iphonesimulator values point to the iphoneos values + + * Configurations/FeatureDefines.xcconfig: + +2012-10-30 Joseph Pecoraro + + [Mac] Sync up FeatureDefine Configuration Files + https://bugs.webkit.org/show_bug.cgi?id=100171 + + Reviewed by David Kilzer. + + Ensure an identical FeatureDefine files across all projects. Changes: + + - ENABLE_CSS_BOX_DECORATION_BREAK should be in all + - ENABLE_PDFKIT_PLUGIN should be in all + - ENABLE_RESOLUTION_MEDIA_QUERY should be in all + - ENABLE_ENCRYPTED_MEDIA should be in all + - ENABLE_HIDDEN_PAGE_DOM_TIMER_THROTTLING with corrected value + - Some alphabetical ordering cleanup + + * Configurations/FeatureDefines.xcconfig: + +2012-10-30 Mark Hahnenberg + + Arrays can change IndexingType in the middle of sorting + https://bugs.webkit.org/show_bug.cgi?id=100773 + + Reviewed by Filip Pizlo. + + Instead of giving up, we just fetch the appropriate vector based on the current + IndexingType of the array. + + * runtime/JSArray.cpp: + (JSC::JSArray::sortVector): + * runtime/JSObject.h: + (JSObject): + (JSC::JSObject::currentIndexingData): + (JSC::JSObject::currentRelevantLength): + +2012-10-29 Anders Carlsson + + Build WebKit as C++11 on Mac + https://bugs.webkit.org/show_bug.cgi?id=100720 + + Reviewed by Daniel Bates. + + * Configurations/Base.xcconfig: + Add CLANG_CXX_LANGUAGE_STANDARD=gnu++0x. + + * bytecompiler/BytecodeGenerator.cpp: + (JSC::BytecodeGenerator::generate): + (JSC::BytecodeGenerator::pushFinallyContext): + (JSC::BytecodeGenerator::beginSwitch): + * llint/LLIntOffsetsExtractor.cpp: + * runtime/Identifier.cpp: + (JSC::Identifier::add8): + * runtime/Identifier.h: + (JSC::Identifier::add): + * runtime/JSONObject.cpp: + (JSC::appendStringToStringBuilder): + * runtime/StringPrototype.cpp: + (JSC::replaceUsingStringSearch): + Add static_casts to prevent implicit type conversions in non-constant initializer lists. + +2012-10-28 Mark Rowe + + Simplify Xcode configuration settings that used to vary between OS versions. + + Reviewed by Dan Bernstein. + + * Configurations/Base.xcconfig: + * Configurations/DebugRelease.xcconfig: + * Configurations/JavaScriptCore.xcconfig: + +2012-10-28 Mark Rowe + + Remove references to unsupported OS and Xcode versions. + + Reviewed by Anders Carlsson. + + * Configurations/Base.xcconfig: + * Configurations/CompilerVersion.xcconfig: Removed. + * Configurations/DebugRelease.xcconfig: + * Configurations/Version.xcconfig: + * JavaScriptCore.xcodeproj/project.pbxproj: + +2012-10-29 Michael Saboff + + Non-special escape character sequences cause JSC::Lexer::parseString to create 16 bit strings + https://bugs.webkit.org/show_bug.cgi?id=100576 + + Reviewed by Darin Adler. + + Changed singleEscape() processing to be based on a lookup of a static table. The table + covers ASCII characters SPACE through DEL. If a character can be a single character escape, + then the table provides the non-zero result of that escape. Updated the result of + singleEscape to be an LChar to make the table as small as possible. + Added a new test fast/js/normal-character-escapes-in-string-literals.html to validated + the behavior. + + * parser/Lexer.cpp: + (JSC::singleEscape): + (JSC::Lexer::parseString): + (JSC::Lexer::parseStringSlowCase): + +2012-10-29 Enrica Casucci + + Add ENABLE_USERSELECT_ALL feature flag. + https://bugs.webkit.org/show_bug.cgi?id=100559 + + Reviewed by Eric Seidel. + + * Configurations/FeatureDefines.xcconfig: + +2012-10-28 Filip Pizlo + + DFG should be able to emit effectful structure checks + https://bugs.webkit.org/show_bug.cgi?id=99260 + + Reviewed by Oliver Hunt. + + This change allows us to find out if an array access that has gone polymorphic + is operating over known structures - i.e. the primordial array structures of the + global object that the code block containing the array access belongs to. We + term this state "OriginalArray" for short. The fact that the access has gone + polymorphic means that the array profile will not be able to report the set of + structures it had seen - but if it can tell us that all of the structures were + primordial then it just so happens that we can deduce what the structure set + would have been by just querying the code block's global object. This allows us + to emit an ArrayifyToStructure instead of an Arrayify if we find that we need to + do conversions. The fast path of an ArrayifyToStructure is exactly like the fast + path of a CheckStructure and is mostly subject to the same optimizations. It + also burns one fewer registers. + + Essentially the notion of OriginalArray is a super cheap way of getting the + array profile to tell us a structure set instead of a singleton structure. + Currently, the array profile can only tell us the structure seen at an array + access if there was exactly one structure. If there were multiple structures, it + won't tell us anything other than the array modes and other auxiliary profiling + data (whether there were stores to holes, for example). With OriginalArray, we + cheaply get a structure set if all of the structures were primordial for the + code block's global object, since in that case the array mode set (ArrayModes) + can directly tell us the structure set. In the future, we might consider adding + complete structure sets to the array profiles, but I suspect that we would hit + diminishing returns if we did so - it would only help if we have array accesses + that are both polymorphic and are cross-global-object accesses (rare) or if the + arrays had named properties or other structure transitions that are unrelated to + indexing type (also rare). + + This also does away with Arrayify (and the new ArrayifyToStructure) returning + the butterfly pointer. This turns out to be faster and easier to CSE. + + And, this also changes constant folding to be able to eliminate CheckStructure, + ForwardCheckStructure, and ArrayifyToStructure in addition to being able to + transform them into structure transition watchpoints. This is great for + ArrayifyToStructure because then CSE and CFA know that there is no side effect. + Converting CheckStructure and ForwardCheckStructure to also behave this way is + just a matter of elegance. + + This has no performance impact right now. It's intended to alleviate some of the + regressions seen in the early implementation of + https://bugs.webkit.org/show_bug.cgi?id=98606. + + * bytecode/ArrayProfile.cpp: + (JSC::ArrayProfile::computeUpdatedPrediction): + * bytecode/ArrayProfile.h: + (JSC): + (JSC::ArrayProfile::ArrayProfile): + (ArrayProfile): + (JSC::ArrayProfile::usesOriginalArrayStructures): + * bytecode/CodeBlock.cpp: + (JSC::CodeBlock::updateAllPredictionsAndCountLiveness): + * dfg/DFGAbstractState.cpp: + (JSC::DFG::AbstractState::execute): + * dfg/DFGArrayMode.cpp: + (JSC::DFG::ArrayMode::fromObserved): + (JSC::DFG::ArrayMode::alreadyChecked): + (JSC::DFG::arrayClassToString): + * dfg/DFGArrayMode.h: + (JSC::DFG::ArrayMode::withProfile): + (JSC::DFG::ArrayMode::isJSArray): + (ArrayMode): + (JSC::DFG::ArrayMode::isJSArrayWithOriginalStructure): + (JSC::DFG::ArrayMode::supportsLength): + (JSC::DFG::ArrayMode::arrayModesWithIndexingShape): + * dfg/DFGByteCodeParser.cpp: + (JSC::DFG::ByteCodeParser::getArrayMode): + (JSC::DFG::ByteCodeParser::getArrayModeAndEmitChecks): + (JSC::DFG::ByteCodeParser::handleGetByOffset): + * dfg/DFGCSEPhase.cpp: + (JSC::DFG::CSEPhase::checkStructureElimination): + (JSC::DFG::CSEPhase::structureTransitionWatchpointElimination): + (JSC::DFG::CSEPhase::getPropertyStorageLoadElimination): + (JSC::DFG::CSEPhase::checkArrayElimination): + (JSC::DFG::CSEPhase::getScopeRegistersLoadElimination): + * dfg/DFGConstantFoldingPhase.cpp: + (JSC::DFG::ConstantFoldingPhase::foldConstants): + * dfg/DFGFixupPhase.cpp: + (JSC::DFG::FixupPhase::fixupNode): + (JSC::DFG::FixupPhase::checkArray): + * dfg/DFGNode.h: + (JSC::DFG::Node::hasStructure): + (JSC::DFG::Node::hasArrayMode): + (JSC::DFG::Node::arrayMode): + * dfg/DFGNodeType.h: + (DFG): + * dfg/DFGPredictionPropagationPhase.cpp: + (JSC::DFG::PredictionPropagationPhase::propagate): + * dfg/DFGSpeculativeJIT.cpp: + (JSC::DFG::SpeculativeJIT::jumpSlowForUnwantedArrayMode): + (JSC::DFG::SpeculativeJIT::arrayify): + * dfg/DFGSpeculativeJIT.h: + (SpeculativeJIT): + * dfg/DFGSpeculativeJIT32_64.cpp: + (JSC::DFG::SpeculativeJIT::compile): + * dfg/DFGSpeculativeJIT64.cpp: + (JSC::DFG::SpeculativeJIT::compile): + * runtime/JSGlobalObject.h: + (JSC::JSGlobalObject::isOriginalArrayStructure): + * runtime/Structure.cpp: + (JSC::Structure::nonPropertyTransition): + +2012-10-28 Filip Pizlo - Reviewed by Jocelyn Turcotte. + There should not be blind spots in array length array profiling + https://bugs.webkit.org/show_bug.cgi?id=100620 - When Qt is configured with -debug or -release, the release/debug build of for example - QtCore is not available by default. For LLIntExtractor we always need to build debug - _and_ release versions, but we do not actually need any Qt libraries nor qtmain(d).lib. - Therefore we can disable all these features but need to keep $$QT.core.includes in the - INCLUDEPATH for some defines from qglobal.h. + Reviewed by Oliver Hunt. - * LLIntOffsetsExtractor.pro: + I don't think this has any performance impact. But it's good to not have random + programs occasionally emit a GetById for array length accesses. + + * jit/JITPropertyAccess.cpp: + (JSC::JIT::compileGetByIdHotPath): + (JSC::JIT::privateCompilePatchGetArrayLength): + * jit/JITPropertyAccess32_64.cpp: + (JSC::JIT::compileGetByIdHotPath): + (JSC::JIT::privateCompilePatchGetArrayLength): + +2012-10-28 Filip Pizlo + + Unreviewed, make always-true enum-to-int comparisons use casts. + + * dfg/DFGFPRInfo.h: + (JSC::DFG::FPRInfo::debugName): + * dfg/DFGGPRInfo.h: + (JSC::DFG::JSValueSource::tagGPR): + (JSC::DFG::GPRInfo::toIndex): + (JSC::DFG::GPRInfo::debugName): + * runtime/JSTypeInfo.h: + (JSC::TypeInfo::TypeInfo): + +2012-10-27 Filip Pizlo + + OSR exit compilation should defend against argument recoveries from code blocks that are no longer on the inline stack + https://bugs.webkit.org/show_bug.cgi?id=100601 + + Reviewed by Oliver Hunt. + + This happened to me while I was fixing bugs for https://bugs.webkit.org/show_bug.cgi?id=100599. + I'm not sure how to reproduce this. + + * dfg/DFGAssemblyHelpers.h: + (JSC::DFG::AssemblyHelpers::baselineCodeBlockFor): + (AssemblyHelpers): + * dfg/DFGOSRExitCompiler32_64.cpp: + (JSC::DFG::OSRExitCompiler::compileExit): + * dfg/DFGOSRExitCompiler64.cpp: + (JSC::DFG::OSRExitCompiler::compileExit): + +2012-10-27 Filip Pizlo + + DFG::Array::Mode needs to be cleaned up + https://bugs.webkit.org/show_bug.cgi?id=100599 + + Reviewed by Oliver Hunt. + + Turn the previous massive Array::Mode enum into a class that contains four + fields, the type, whether it's a JSArray, the level of speculation, and the + kind of conversion to perform. + + No performance or behavioral change. + + * dfg/DFGAbstractState.cpp: + (JSC::DFG::AbstractState::execute): + * dfg/DFGArgumentsSimplificationPhase.cpp: + (JSC::DFG::ArgumentsSimplificationPhase::run): + * dfg/DFGArrayMode.cpp: + (JSC::DFG::ArrayMode::fromObserved): + (JSC::DFG::ArrayMode::refine): + (JSC::DFG::ArrayMode::alreadyChecked): + (JSC::DFG::arrayTypeToString): + (JSC::DFG::arrayClassToString): + (DFG): + (JSC::DFG::arraySpeculationToString): + (JSC::DFG::arrayConversionToString): + (JSC::DFG::ArrayMode::toString): + * dfg/DFGArrayMode.h: + (DFG): + (ArrayMode): + (JSC::DFG::ArrayMode::ArrayMode): + (JSC::DFG::ArrayMode::type): + (JSC::DFG::ArrayMode::arrayClass): + (JSC::DFG::ArrayMode::speculation): + (JSC::DFG::ArrayMode::conversion): + (JSC::DFG::ArrayMode::asWord): + (JSC::DFG::ArrayMode::fromWord): + (JSC::DFG::ArrayMode::withSpeculation): + (JSC::DFG::ArrayMode::usesButterfly): + (JSC::DFG::ArrayMode::isJSArray): + (JSC::DFG::ArrayMode::isInBounds): + (JSC::DFG::ArrayMode::mayStoreToHole): + (JSC::DFG::ArrayMode::isOutOfBounds): + (JSC::DFG::ArrayMode::isSlowPut): + (JSC::DFG::ArrayMode::canCSEStorage): + (JSC::DFG::ArrayMode::lengthNeedsStorage): + (JSC::DFG::ArrayMode::modeForPut): + (JSC::DFG::ArrayMode::isSpecific): + (JSC::DFG::ArrayMode::supportsLength): + (JSC::DFG::ArrayMode::benefitsFromStructureCheck): + (JSC::DFG::ArrayMode::doesConversion): + (JSC::DFG::ArrayMode::arrayModesThatPassFiltering): + (JSC::DFG::ArrayMode::operator==): + (JSC::DFG::ArrayMode::operator!=): + (JSC::DFG::ArrayMode::arrayModesWithIndexingShape): + (JSC::DFG::canCSEStorage): + (JSC::DFG::lengthNeedsStorage): + * dfg/DFGByteCodeParser.cpp: + (JSC::DFG::ByteCodeParser::getArrayMode): + (JSC::DFG::ByteCodeParser::getArrayModeAndEmitChecks): + (JSC::DFG::ByteCodeParser::handleIntrinsic): + (JSC::DFG::ByteCodeParser::parseBlock): + * dfg/DFGCSEPhase.cpp: + (JSC::DFG::CSEPhase::getArrayLengthElimination): + (JSC::DFG::CSEPhase::checkArrayElimination): + (JSC::DFG::CSEPhase::getIndexedPropertyStorageLoadElimination): + (JSC::DFG::CSEPhase::performNodeCSE): + * dfg/DFGConstantFoldingPhase.cpp: + (JSC::DFG::ConstantFoldingPhase::foldConstants): + * dfg/DFGFixupPhase.cpp: + (JSC::DFG::FixupPhase::fixupNode): + (JSC::DFG::FixupPhase::checkArray): + (JSC::DFG::FixupPhase::blessArrayOperation): + * dfg/DFGGraph.cpp: + (JSC::DFG::Graph::dump): + * dfg/DFGGraph.h: + (JSC::DFG::Graph::byValIsPure): + * dfg/DFGNode.h: + (JSC::DFG::Node::arrayMode): + (JSC::DFG::Node::setArrayMode): + * dfg/DFGSpeculativeJIT.cpp: + (JSC::DFG::SpeculativeJIT::typedArrayDescriptor): + (JSC::DFG::SpeculativeJIT::jumpSlowForUnwantedArrayMode): + (JSC::DFG::SpeculativeJIT::checkArray): + (JSC::DFG::SpeculativeJIT::arrayify): + (JSC::DFG::SpeculativeJIT::compileGetByValOnString): + (JSC::DFG::SpeculativeJIT::compileGetByValOnIntTypedArray): + (JSC::DFG::SpeculativeJIT::compileGetByValOnFloatTypedArray): + (JSC::DFG::SpeculativeJIT::compilePutByValForFloatTypedArray): + (JSC::DFG::SpeculativeJIT::compileGetIndexedPropertyStorage): + (JSC::DFG::SpeculativeJIT::compileGetByValOnArguments): + (JSC::DFG::SpeculativeJIT::compileGetArgumentsLength): + (JSC::DFG::SpeculativeJIT::compileGetArrayLength): + (JSC::DFG::SpeculativeJIT::temporaryRegisterForPutByVal): + * dfg/DFGSpeculativeJIT.h: + (JSC::DFG::SpeculativeJIT::putByValWillNeedExtraRegister): + (SpeculativeJIT): + * dfg/DFGSpeculativeJIT32_64.cpp: + (JSC::DFG::SpeculativeJIT::compile): + * dfg/DFGSpeculativeJIT64.cpp: + (JSC::DFG::SpeculativeJIT::compile): + +2012-10-27 Dan Bernstein + + REAL_PLATFORM_NAME build setting is no longer needed + https://bugs.webkit.org/show_bug.cgi?id=100587 + + Reviewed by Mark Rowe. + + Removed the definition of REAL_PLATFORM_NAME and replaced references to it with references + to PLATFORM_NAME. + + * Configurations/Base.xcconfig: + * Configurations/CompilerVersion.xcconfig: + * Configurations/DebugRelease.xcconfig: + * Configurations/FeatureDefines.xcconfig: + * Configurations/JSC.xcconfig: + * Configurations/JavaScriptCore.xcconfig: + * Configurations/ToolExecutable.xcconfig: + +2012-10-25 Filip Pizlo + + Forward OSR calculation is wrong in the presence of multiple SetLocals, or a mix of SetLocals and Phantoms + https://bugs.webkit.org/show_bug.cgi?id=100461 + + Reviewed by Oliver Hunt and Gavin Barraclough. + + This does a couple of things. First, it removes the part of the change in r131822 that made the forward + OSR exit calculator capable of handling multiple SetLocals. That change was wrong, because it would + blindly assume that all SetLocals had the same ValueRecovery, and would ignore the possibility that if + there is no value recovery then a ForwardCheckStructure on the first SetLocal would not know how to + recover the state associated with the second SetLocal. Then, it introduces the invariant that any bytecode + op that decomposes into multiple SetLocals must first emit dead SetLocals as hints and then emit a second + set of SetLocals to actually do the setting of the locals. This means that if a ForwardCheckStructure (or + any other hoisted forward speculation) is inserted, it will always be inserted on the second set of + SetLocals (since hoisting only touches the live ones), at which point OSR will already know about the + mov hints implied by the first set of (dead) SetLocals. This gives us the behavior we wanted, namely, that + a ForwardCheckStructure applied to a variant set by a resolve_with_base-like operation can correctly do a + forward exit while also ensuring that prior to exiting we set the appropriate locals. + + * dfg/DFGByteCodeParser.cpp: + (JSC::DFG::ByteCodeParser::parseBlock): + * dfg/DFGOSRExit.cpp: + (JSC::DFG::OSRExit::OSRExit): + * dfg/DFGOSRExit.h: + (OSRExit): + * dfg/DFGOSRExitCompiler.cpp: + * dfg/DFGOSRExitCompiler32_64.cpp: + (JSC::DFG::OSRExitCompiler::compileExit): + * dfg/DFGOSRExitCompiler64.cpp: + (JSC::DFG::OSRExitCompiler::compileExit): + * dfg/DFGSpeculativeJIT.cpp: + (JSC::DFG::SpeculativeJIT::convertLastOSRExitToForward): -2012-10-25 Simon Hausmann +2012-10-26 Simon Hausmann [Qt] Fix the LLInt build on Windows https://bugs.webkit.org/show_bug.cgi?id=97648 - Reviewed by NOBODY (OOPS!). + Reviewed by Tor Arne Vestbø. The main change for the port on Windows is changing the way offsets are extracted and the LLIntAssembly.h is generated to accomodate release and debug configurations. @@ -38,21 +1203,45 @@ In Target.pri we have to also make sure that those directories are in the include path according to the release or debug configuration. - Lastly a small tweak in the LLIntOffsetsExtractor build was needed to make sure that - we include JavaScriptCore/config.h instead of WTF/config.h, required to fix the build - issues originally pasted in bug #97648. + Lastly a small tweak - swapping WTF.pri and JSC.pri inclusions - in the + LLIntOffsetsExtractor build was needed to make sure that we include + JavaScriptCore/config.h instead of WTF/config.h, required to fix the + build issues originally pasted in bug #97648. * DerivedSources.pri: * JavaScriptCore.pro: * LLIntOffsetsExtractor.pro: * Target.pri: -2012-10-25 Simon Hausmann +2012-10-26 Gabor Ballabas + + [Qt] Enable JSC's disassembler on x86, x86_64 Linux + https://bugs.webkit.org/show_bug.cgi?id=100386 + + Reviewed by Simon Hausmann. + + It works fine on Linux x86, x86_64 just needs to be enabled in the + QtWebKit build system. + + * DerivedSources.pri: + * JavaScriptCore.pri: + * Target.pri: + +2012-10-26 Thiago Marcos P. Santos + + Add feature flags for CSS Device Adaptation + https://bugs.webkit.org/show_bug.cgi?id=95960 + + Reviewed by Kenneth Rohde Christiansen. + + * Configurations/FeatureDefines.xcconfig: + +2012-10-26 Simon Hausmann [WIN] Make LLInt offsets extractor work on Windows https://bugs.webkit.org/show_bug.cgi?id=100369 - Reviewed by NOBODY (OOPS!). + Reviewed by Kenneth Rohde Christiansen. Open the input file explicitly in binary mode to prevent ruby/Windows from thinking that it's a text mode file that needs even new line conversions. The binary mode parameter is @@ -60,6 +1249,194 @@ * offlineasm/offsets.rb: +2012-10-25 Michael Saboff + + SymbolTableIndexHashTraits::needsDestruction should be set to true + https://bugs.webkit.org/show_bug.cgi?id=100437 + + Reviewed by Mark Hahnenberg. + + For correctness, set SymbolTableIndexHashTraits::needsDestruction to true since SymbolTableEntry's do + need to have their destructor called due to the possibility of rare data. + + * runtime/SymbolTable.h: + (SymbolTableIndexHashTraits): + +2012-10-25 Filip Pizlo + + DFG Arrayify elimination should replace it with GetButterfly rather than Phantom + https://bugs.webkit.org/show_bug.cgi?id=100441 + + Reviewed by Oliver Hunt and Gavin Barraclough. + + Made array profiler's to-string helper behave correctly. + + Made Arrayify elimination do the right thing (convert to GetButterfly). + + Made CFA's interference analysis track clobbered array modes correctly, mostly by + simplifying the machinery. + + * bytecode/ArrayProfile.cpp: + (JSC::arrayModesToString): + * dfg/DFGAbstractState.cpp: + (JSC::DFG::AbstractState::execute): + * dfg/DFGAbstractValue.h: + (JSC::DFG::AbstractValue::clobberArrayModes): + (AbstractValue): + * dfg/DFGConstantFoldingPhase.cpp: + (JSC::DFG::ConstantFoldingPhase::foldConstants): + +2012-10-25 Filip Pizlo + + REGRESSION (r131793-r131826): Crash going to wikifonia.org + https://bugs.webkit.org/show_bug.cgi?id=100281 + + Reviewed by Oliver Hunt. + + Restore something that got lost in the resolve refactoring: the ability to give up on life if + we see a resolve of 'arguments'. + + * runtime/JSScope.cpp: + (JSC::JSScope::resolveContainingScopeInternal): + +2012-10-25 Dominik Röttsches + + Conditionalize XHR timeout support + https://bugs.webkit.org/show_bug.cgi?id=100356 + + Reviewed by Adam Barth. + + Adding XHR_TIMEOUT feature to conditionalize this on ports without network backend support. + + * Configurations/FeatureDefines.xcconfig: + +2012-10-25 Michael Saboff + + REGRESSION (r131836): failures in list styles tests on EFL, GTK + https://bugs.webkit.org/show_bug.cgi?id=99824 + + Reviewed by Oliver Hunt. + + Saved start of string since it is modified by call convertUTF8ToUTF16(). + + * API/JSStringRef.cpp: + (JSStringCreateWithUTF8CString): + +2012-10-24 Filip Pizlo + + DFG NewArrayBuffer node should keep its data in a structure on the side to free up one of the opInfos + https://bugs.webkit.org/show_bug.cgi?id=100328 + + Reviewed by Oliver Hunt. + + * dfg/DFGByteCodeParser.cpp: + (JSC::DFG::ByteCodeParser::parseBlock): + * dfg/DFGGraph.h: + (Graph): + * dfg/DFGNode.h: + (NewArrayBufferData): + (DFG): + (JSC::DFG::Node::newArrayBufferData): + (Node): + (JSC::DFG::Node::startConstant): + (JSC::DFG::Node::numConstants): + +2012-10-25 Mark Lam + + Update the C++ llint to work with the latest op_resolve... changes. + https://bugs.webkit.org/show_bug.cgi?id=100345. + + Reviewed by Oliver Hunt. + + * llint/LowLevelInterpreter.cpp: + (JSC::CLoop::execute): + - emit opcode name as label when not using COMPUTED_GOTOs. The new op_resolve + opcodes have jumps to these labels. + - declare all opcode labels as UNUSED_LABEL()s to keep the compiler happy + for opcodes that are not referenced by anyone. + * offlineasm/asm.rb: + - strip llint_ prefix from opcode names used as labels. + +2012-10-24 Yuqiang Xian + + Refactor LLInt64 to distinguish the pointer operations from the 64-bit integer operations + https://bugs.webkit.org/show_bug.cgi?id=100321 + + Reviewed by Filip Pizlo. + + We have refactored the MacroAssembler and JIT compilers to distinguish + the pointer operations from the 64-bit integer operations (see bug #99154). + Now we want to do the similar work for LLInt, and the goal is same as + the one mentioned in 99154. + + This is the first part of the modification: in the offline assembler, + adding the support of the "q" instructions which will be used for + 64-bit integer operations. + + * llint/LowLevelInterpreter.cpp: + (JSC::CLoop::execute): + * offlineasm/cloop.rb: + * offlineasm/instructions.rb: + * offlineasm/x86.rb: + +2012-10-24 Filip Pizlo + + DFG compileBlahBlahByVal methods for Contiguous and ArrayStorage have only one caller and should be removed + https://bugs.webkit.org/show_bug.cgi?id=100311 + + Reviewed by Mark Hahnenberg. + + Just trying to simplify things before I make them more complicated again. + + * dfg/DFGSpeculativeJIT.h: + (SpeculativeJIT): + (JSC::DFG::SpeculativeJIT::temporaryRegisterForPutByVal): + * dfg/DFGSpeculativeJIT32_64.cpp: + (DFG): + (JSC::DFG::SpeculativeJIT::compile): + * dfg/DFGSpeculativeJIT64.cpp: + (DFG): + (JSC::DFG::SpeculativeJIT::compile): + +2012-10-23 Andreas Kling + + CodeBlock: Give m_putToBaseOperations an inline capacity. + + + + Reviewed by Oliver Hunt. + + Since the CodeBlock constructor always inserts a single PutToBaseOperation, but there's no + guarantee that more will follow, give the m_putToBaseOperations vector an inline capacity of 1. + There are 4009 of these Vectors on Membuster3, and only 126 of them have more than a single entry. + + This change yields a 1.90MB reduction in memory usage. + + * bytecode/CodeBlock.h: + (CodeBlock): + +2012-10-23 Christophe Dumez + + Regression(r132143): Assertion hit in JSC::Interpreter::StackPolicy::StackPolicy(JSC::Interpreter&, const WTF::StackBounds&) + https://bugs.webkit.org/show_bug.cgi?id=100109 + + Reviewed by Oliver Hunt. + + Fix possible integer overflow in StackPolicy constructor by + using size_t type instead of int for stack sizes. The value + returned by StackBounds::size() is of type size_t but was + assigned to an int, which may overflow. + + * interpreter/Interpreter.cpp: + (JSC): + (JSC::Interpreter::StackPolicy::StackPolicy): + +2012-10-23 Carlos Garcia Campos + + Unreviewed. Fix make distcheck. + + * GNUmakefile.list.am: Add missing header file. + 2012-10-23 Mark Lam Make topCallFrame reliable. @@ -729,7 +2106,7 @@ (JSC::JIT::emit_op_next_pname): (JSC::JIT::compileOpStrictEq): (JSC::JIT::emit_op_catch): - (JSC::JIT::emit_op_throw_reference_error): + (JSC::JIT::emit_op_throw_static_error): (JSC::JIT::emit_op_eq_null): (JSC::JIT::emit_op_neq_null): (JSC::JIT::emit_op_create_activation): diff --git a/Source/JavaScriptCore/Configurations/Base.xcconfig b/Source/JavaScriptCore/Configurations/Base.xcconfig index 47c8f7382..2de8597d7 100644 --- a/Source/JavaScriptCore/Configurations/Base.xcconfig +++ b/Source/JavaScriptCore/Configurations/Base.xcconfig @@ -21,11 +21,8 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#include "CompilerVersion.xcconfig" - -COMPILER_SPECIFIC_WARNING_CFLAGS = $(COMPILER_SPECIFIC_WARNING_CFLAGS_$(TARGET_GCC_VERSION)); -COMPILER_SPECIFIC_WARNING_CFLAGS_LLVM_COMPILER = -Wexit-time-destructors -Wglobal-constructors -Wtautological-compare; - +CLANG_CXX_LANGUAGE_STANDARD = gnu++0x; +CLANG_CXX_LIBRARY = libc++; CLANG_WARN_CXX0X_EXTENSIONS = NO; DEBUG_INFORMATION_FORMAT = dwarf-with-dsym; GCC_C_LANGUAGE_STANDARD = gnu99; @@ -34,7 +31,7 @@ GCC_DYNAMIC_NO_PIC = NO; GCC_ENABLE_CPP_EXCEPTIONS = NO; GCC_ENABLE_CPP_RTTI = NO; GCC_ENABLE_OBJC_EXCEPTIONS = YES; -GCC_ENABLE_OBJC_GC = $(GCC_ENABLE_OBJC_GC_$(REAL_PLATFORM_NAME)); +GCC_ENABLE_OBJC_GC = $(GCC_ENABLE_OBJC_GC_$(PLATFORM_NAME)); GCC_ENABLE_OBJC_GC_iphoneos = NO; GCC_ENABLE_OBJC_GC_iphonesimulator = NO; GCC_ENABLE_OBJC_GC_macosx = supported; @@ -42,7 +39,7 @@ GCC_ENABLE_SYMBOL_SEPARATION = NO; GCC_FAST_OBJC_DISPATCH = YES; GCC_GENERATE_DEBUGGING_SYMBOLS = YES; GCC_INLINES_ARE_PRIVATE_EXTERN = YES; -GCC_MODEL_TUNING = $(GCC_MODEL_TUNING_$(REAL_PLATFORM_NAME)); +GCC_MODEL_TUNING = $(GCC_MODEL_TUNING_$(PLATFORM_NAME)); GCC_MODEL_TUNING_macosx = G5; GCC_OBJC_CALL_CXX_CDTORS = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; @@ -50,6 +47,7 @@ GCC_PREPROCESSOR_DEFINITIONS = $(DEBUG_DEFINES) HAVE_DTRACE=$(HAVE_DTRACE) WEBKI GCC_STRICT_ALIASING = YES; GCC_THREADSAFE_STATICS = NO; GCC_TREAT_WARNINGS_AS_ERRORS = YES; +GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO; GCC_WARN_ABOUT_MISSING_NEWLINE = YES; GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; @@ -57,12 +55,12 @@ GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES; GCC_WARN_SIGN_COMPARE = YES; LINKER_DISPLAYS_MANGLED_NAMES = YES; PREBINDING = NO; -VALID_ARCHS = $(VALID_ARCHS_$(REAL_PLATFORM_NAME)); +VALID_ARCHS = $(VALID_ARCHS_$(PLATFORM_NAME)); VALID_ARCHS_iphoneos = $(ARCHS_STANDARD_32_BIT); VALID_ARCHS_iphonesimulator = $(ARCHS_STANDARD_32_BIT); VALID_ARCHS_macosx = i386 ppc x86_64 ppc64 $(ARCHS_UNIVERSAL_IPHONE_OS); -WARNING_CFLAGS_BASE = -Wall -Wextra -Wcast-qual -Wchar-subscripts -Wextra-tokens -Wformat=2 -Winit-self -Wmissing-format-attribute -Wmissing-noreturn -Wpacked -Wpointer-arith -Wredundant-decls -Wundef -Wwrite-strings; -WARNING_CFLAGS = $(WARNING_CFLAGS_$(REAL_PLATFORM_NAME)) $(COMPILER_SPECIFIC_WARNING_CFLAGS); +WARNING_CFLAGS_BASE = -Wall -Wextra -Wcast-qual -Wchar-subscripts -Wextra-tokens -Wformat=2 -Winit-self -Wmissing-format-attribute -Wmissing-noreturn -Wpacked -Wpointer-arith -Wredundant-decls -Wundef -Wwrite-strings -Wexit-time-destructors -Wglobal-constructors -Wtautological-compare; +WARNING_CFLAGS = $(WARNING_CFLAGS_$(PLATFORM_NAME)); WARNING_CFLAGS_iphoneos = $(WARNING_CFLAGS_BASE) -Wshorten-64-to-32; WARNING_CFLAGS_iphonesimulator = $(WARNING_CFLAGS_BASE) -Wshorten-64-to-32; WARNING_CFLAGS_macosx = $(WARNING_CFLAGS_macosx_$(CURRENT_ARCH)); @@ -70,22 +68,9 @@ WARNING_CFLAGS_macosx_ = $(WARNING_CFLAGS_BASE) -Wshorten-64-to-32; WARNING_CFLAGS_macosx_i386 = $(WARNING_CFLAGS_BASE) -Wshorten-64-to-32; WARNING_CFLAGS_macosx_ppc = $(WARNING_CFLAGS_BASE) -Wshorten-64-to-32; // FIXME: JavaScriptCore 64-bit builds should build with -Wshorten-64-to-32 -WARNING_CFLAGS_macosx_ppc64 = $(WARNING_CFLAGS_BASE); WARNING_CFLAGS_macosx_x86_64 = $(WARNING_CFLAGS_BASE); HEADER_SEARCH_PATHS = . icu "${BUILT_PRODUCTS_DIR}/usr/local/include" $(HEADER_SEARCH_PATHS); -CLANG_CXX_LIBRARY = $(CLANG_CXX_LIBRARY_$(TARGET_MAC_OS_X_VERSION_MAJOR)); -CLANG_CXX_LIBRARY_1060 = libstdc++; -CLANG_CXX_LIBRARY_1070 = libc++; -CLANG_CXX_LIBRARY_1080 = libc++; -CLANG_CXX_LIBRARY_1090 = libc++; - -REAL_PLATFORM_NAME = $(REAL_PLATFORM_NAME_$(PLATFORM_NAME)); -REAL_PLATFORM_NAME_ = $(REAL_PLATFORM_NAME_macosx); -REAL_PLATFORM_NAME_iphoneos = iphoneos; -REAL_PLATFORM_NAME_iphonesimulator = iphonesimulator; -REAL_PLATFORM_NAME_macosx = macosx; - TARGET_MAC_OS_X_VERSION_MAJOR = $(MAC_OS_X_VERSION_MAJOR); FRAMEWORK_SEARCH_PATHS = $(STAGED_FRAMEWORKS_SEARCH_PATH); @@ -93,12 +78,12 @@ FRAMEWORK_SEARCH_PATHS = $(STAGED_FRAMEWORKS_SEARCH_PATH); STAGED_FRAMEWORKS_SEARCH_PATH = $(STAGED_FRAMEWORKS_SEARCH_PATH_$(USE_STAGING_INSTALL_PATH)); STAGED_FRAMEWORKS_SEARCH_PATH_YES = $(NEXT_ROOT)$(SYSTEM_LIBRARY_DIR)/StagedFrameworks/Safari; -NORMAL_JAVASCRIPTCORE_FRAMEWORKS_DIR = $(NORMAL_JAVASCRIPTCORE_FRAMEWORKS_DIR_$(REAL_PLATFORM_NAME)); +NORMAL_JAVASCRIPTCORE_FRAMEWORKS_DIR = $(NORMAL_JAVASCRIPTCORE_FRAMEWORKS_DIR_$(PLATFORM_NAME)); NORMAL_JAVASCRIPTCORE_FRAMEWORKS_DIR_iphoneos = $(SYSTEM_LIBRARY_DIR)/PrivateFrameworks; NORMAL_JAVASCRIPTCORE_FRAMEWORKS_DIR_iphonesimulator = $(NORMAL_JAVASCRIPTCORE_FRAMEWORKS_DIR_iphoneos); NORMAL_JAVASCRIPTCORE_FRAMEWORKS_DIR_macosx = $(SYSTEM_LIBRARY_DIR)/Frameworks; -JAVASCRIPTCORE_FRAMEWORKS_DIR = $(JAVASCRIPTCORE_FRAMEWORKS_DIR_$(REAL_PLATFORM_NAME)); +JAVASCRIPTCORE_FRAMEWORKS_DIR = $(JAVASCRIPTCORE_FRAMEWORKS_DIR_$(PLATFORM_NAME)); JAVASCRIPTCORE_FRAMEWORKS_DIR_iphoneos = $(NORMAL_JAVASCRIPTCORE_FRAMEWORKS_DIR_iphoneos); JAVASCRIPTCORE_FRAMEWORKS_DIR_iphonesimulator = $(JAVASCRIPTCORE_FRAMEWORKS_DIR_iphoneos); @@ -128,7 +113,6 @@ DEAD_CODE_STRIPPING = $(DEAD_CODE_STRIPPING_$(CURRENT_VARIANT)); SECTORDER_FLAGS = -Wl,-order_file,JavaScriptCore.order; TARGETING_SAME_OS_X_VERSION = $(TARGETING_SAME_OS_X_VERSION_$(MAC_OS_X_VERSION_MAJOR)_$(TARGET_MAC_OS_X_VERSION_MAJOR)); -TARGETING_SAME_OS_X_VERSION_1060_1060 = YES; TARGETING_SAME_OS_X_VERSION_1070_1070 = YES; TARGETING_SAME_OS_X_VERSION_1080_1080 = YES; TARGETING_SAME_OS_X_VERSION_1090_1090 = YES; @@ -137,14 +121,4 @@ TARGETING_SAME_OS_X_VERSION_1090_1090 = YES; SDKROOT = $(SDKROOT_TARGETING_SAME_OS_X_VERSION_$(TARGETING_SAME_OS_X_VERSION)); SDKROOT_TARGETING_SAME_OS_X_VERSION_ = macosx; - -// HAVE_DTRACE is disabled on Leopard due to -HAVE_DTRACE = $(HAVE_DTRACE_$(REAL_PLATFORM_NAME)); -HAVE_DTRACE_iphoneos = 1; -HAVE_DTRACE_iphonesimulator = 1; -HAVE_DTRACE_macosx = $(HAVE_DTRACE_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR)); -HAVE_DTRACE_macosx_1050 = 0; -HAVE_DTRACE_macosx_1060 = 1; -HAVE_DTRACE_macosx_1070 = 1; -HAVE_DTRACE_macosx_1080 = 1; -HAVE_DTRACE_macosx_1090 = 1; +HAVE_DTRACE = 1; diff --git a/Source/JavaScriptCore/Configurations/CompilerVersion.xcconfig b/Source/JavaScriptCore/Configurations/CompilerVersion.xcconfig deleted file mode 100644 index 1d959fe9d..000000000 --- a/Source/JavaScriptCore/Configurations/CompilerVersion.xcconfig +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -IS_XCODE_0400 = $(IS_XCODE_0400_$(XCODE_VERSION_MINOR)); -IS_XCODE_0400_0400 = YES; - -IS_XCODE_0400_OR_0410 = $(IS_XCODE_0400_OR_0410_$(XCODE_VERSION_MINOR)); -IS_XCODE_0400_OR_0410_0400 = YES; -IS_XCODE_0400_OR_0410_0410 = YES; - -// The version of the LLVM Compiler in Xcode 4.0 and earlier have difficulty compiling our code. -LLVM_COMPILER_UNSUITABLE_FOR_DEBUG_BUILDS = $(LLVM_COMPILER_UNSUITABLE_FOR_DEBUG_BUILDS_$(XCODE_VERSION_MAJOR)); -LLVM_COMPILER_UNSUITABLE_FOR_DEBUG_BUILDS_0300 = YES; -LLVM_COMPILER_UNSUITABLE_FOR_DEBUG_BUILDS_0400 = $(LLVM_COMPILER_UNSUITABLE_FOR_DEBUG_BUILDS_IS_XCODE_0400_$(IS_XCODE_0400)); -LLVM_COMPILER_UNSUITABLE_FOR_DEBUG_BUILDS_IS_XCODE_0400_YES = YES; - -// The version of the LLVM Compiler in Xcode 4.1 and earlier do not generate fast enough code. -LLVM_COMPILER_UNSUITABLE_FOR_OPTIMIZED_BUILDS = $(LLVM_COMPILER_UNSUITABLE_FOR_OPTIMIZED_BUILDS_$(XCODE_VERSION_MAJOR)); -LLVM_COMPILER_UNSUITABLE_FOR_OPTIMIZED_BUILDS_0300 = YES; -LLVM_COMPILER_UNSUITABLE_FOR_OPTIMIZED_BUILDS_0400 = $(LLVM_COMPILER_UNSUITABLE_FOR_OPTIMIZED_BUILDS_IS_XCODE_0400_OR_0410_$(IS_XCODE_0400_OR_0410)); -LLVM_COMPILER_UNSUITABLE_FOR_OPTIMIZED_BUILDS_IS_XCODE_0400_OR_0410_YES = YES; - -LLVM_COMPILER_SUITABLE_FOR_DEBUG_BUILDS = $(LLVM_COMPILER_SUITABLE_FOR_DEBUG_BUILDS_$(LLVM_COMPILER_UNSUITABLE_FOR_DEBUG_BUILDS)); -LLVM_COMPILER_SUITABLE_FOR_DEBUG_BUILDS_ = YES; -LLVM_COMPILER_SUITABLE_FOR_DEBUG_BUILDS_YES = NO; - -LLVM_COMPILER_SUITABLE_FOR_OPTIMIZED_BUILDS = $(LLVM_COMPILER_SUITABLE_FOR_OPTIMIZED_BUILDS_$(LLVM_COMPILER_UNSUITABLE_FOR_OPTIMIZED_BUILDS)); -LLVM_COMPILER_SUITABLE_FOR_OPTIMIZED_BUILDS_ = YES; -LLVM_COMPILER_SUITABLE_FOR_OPTIMIZED_BUILDS_YES = NO; - - -// Use GCC 4.2 with Xcode 3.1, which includes GCC 4.2 but defaults to GCC 4.0. -// Note that Xcode versions as new as 3.1.2 use XCODE_VERSION_ACTUAL for the minor version -// number. Newer versions of Xcode use XCODE_VERSION_MINOR for the minor version, and -// XCODE_VERSION_ACTUAL for the full version number. -TARGET_GCC_VERSION = $(TARGET_GCC_VERSION_$(REAL_PLATFORM_NAME)); -TARGET_GCC_VERSION_iphoneos = LLVM_COMPILER; -TARGET_GCC_VERSION_iphonesimulator = $(TARGET_GCC_VERSION_iphoneos); -TARGET_GCC_VERSION_macosx = $(TARGET_GCC_VERSION_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR)); - -TARGET_GCC_VERSION_macosx_1050 = $(TARGET_GCC_VERSION_macosx_1050_$(XCODE_VERSION_MINOR)); -TARGET_GCC_VERSION_macosx_1050_ = $(TARGET_GCC_VERSION_macosx_1050_$(XCODE_VERSION_ACTUAL)); -TARGET_GCC_VERSION_macosx_1050_0310 = GCC_42; -TARGET_GCC_VERSION_macosx_1050_0320 = GCC_42; - -TARGET_GCC_VERSION_macosx_1060 = $(TARGET_GCC_VERSION_macosx_1060_AND_1070_$(CONFIGURATION)); -TARGET_GCC_VERSION_macosx_1070 = $(TARGET_GCC_VERSION_macosx_1060_AND_1070_$(CONFIGURATION)); -TARGET_GCC_VERSION_macosx_1060_AND_1070_Debug = $(TARGET_GCC_VERSION_macosx_USE_LLVM_COMPILER_$(LLVM_COMPILER_SUITABLE_FOR_DEBUG_BUILDS)); -TARGET_GCC_VERSION_macosx_1060_AND_1070_Release = $(TARGET_GCC_VERSION_macosx_USE_LLVM_COMPILER_$(LLVM_COMPILER_SUITABLE_FOR_OPTIMIZED_BUILDS)); -TARGET_GCC_VERSION_macosx_1060_AND_1070_Production = $(TARGET_GCC_VERSION_macosx_USE_LLVM_COMPILER_$(LLVM_COMPILER_SUITABLE_FOR_OPTIMIZED_BUILDS)); - -TARGET_GCC_VERSION_macosx_USE_LLVM_COMPILER_YES = LLVM_COMPILER; -TARGET_GCC_VERSION_macosx_USE_LLVM_COMPILER_NO = GCC_42; - -TARGET_GCC_VERSION_macosx_1080 = LLVM_COMPILER; -TARGET_GCC_VERSION_macosx_1090 = LLVM_COMPILER; - -GCC_VERSION = $(GCC_VERSION_$(TARGET_GCC_VERSION)); -GCC_VERSION_GCC_40 = 4.0; -GCC_VERSION_GCC_42 = 4.2; -GCC_VERSION_LLVM_GCC_42 = com.apple.compilers.llvmgcc42; -GCC_VERSION_LLVM_COMPILER = com.apple.compilers.llvm.clang.1_0; diff --git a/Source/JavaScriptCore/Configurations/DebugRelease.xcconfig b/Source/JavaScriptCore/Configurations/DebugRelease.xcconfig index 5fb574367..bf2c8d19a 100644 --- a/Source/JavaScriptCore/Configurations/DebugRelease.xcconfig +++ b/Source/JavaScriptCore/Configurations/DebugRelease.xcconfig @@ -23,24 +23,17 @@ #include "Base.xcconfig" -ARCHS = $(ARCHS_$(REAL_PLATFORM_NAME)); +ARCHS = $(ARCHS_$(PLATFORM_NAME)); ARCHS_iphoneos = $(ARCHS_UNIVERSAL_IPHONE_OS); ARCHS_iphonesimulator = $(NATIVE_ARCH); -ARCHS_macosx = $(ARCHS_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR)); -ARCHS_macosx_1050 = $(NATIVE_ARCH); -ARCHS_macosx_1060 = $(ARCHS_STANDARD_32_64_BIT); -ARCHS_macosx_1070 = $(ARCHS_STANDARD_32_64_BIT); -ARCHS_macosx_1080 = $(ARCHS_STANDARD_32_64_BIT); -ARCHS_macosx_1090 = $(ARCHS_STANDARD_32_64_BIT); +ARCHS_macosx = $(ARCHS_STANDARD_32_64_BIT); ONLY_ACTIVE_ARCH = YES; -MACOSX_DEPLOYMENT_TARGET = $(MACOSX_DEPLOYMENT_TARGET_$(REAL_PLATFORM_NAME)); +MACOSX_DEPLOYMENT_TARGET = $(MACOSX_DEPLOYMENT_TARGET_$(PLATFORM_NAME)); MACOSX_DEPLOYMENT_TARGET_iphoneos = 10.5; MACOSX_DEPLOYMENT_TARGET_iphonesimulator = 10.5; MACOSX_DEPLOYMENT_TARGET_macosx = $(MACOSX_DEPLOYMENT_TARGET_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR)); -MACOSX_DEPLOYMENT_TARGET_macosx_1050 = 10.5; -MACOSX_DEPLOYMENT_TARGET_macosx_1060 = 10.6; MACOSX_DEPLOYMENT_TARGET_macosx_1070 = 10.7; MACOSX_DEPLOYMENT_TARGET_macosx_1080 = 10.8; MACOSX_DEPLOYMENT_TARGET_macosx_1090 = 10.9; diff --git a/Source/JavaScriptCore/Configurations/FeatureDefines.xcconfig b/Source/JavaScriptCore/Configurations/FeatureDefines.xcconfig index 79a458eca..a4f8ca0c0 100644 --- a/Source/JavaScriptCore/Configurations/FeatureDefines.xcconfig +++ b/Source/JavaScriptCore/Configurations/FeatureDefines.xcconfig @@ -37,6 +37,9 @@ ENABLE_ANIMATION_API = ; ENABLE_BLOB = ENABLE_BLOB; ENABLE_CHANNEL_MESSAGING = ENABLE_CHANNEL_MESSAGING; ENABLE_CSP_NEXT = ; +ENABLE_CSS_BOX_DECORATION_BREAK = ENABLE_CSS_BOX_DECORATION_BREAK; +ENABLE_CSS_COMPOSITING = ENABLE_CSS_COMPOSITING; +ENABLE_CSS_DEVICE_ADAPTATION = ; ENABLE_CSS_EXCLUSIONS = ENABLE_CSS_EXCLUSIONS; ENABLE_CSS_FILTERS = ENABLE_CSS_FILTERS; ENABLE_CSS_HIERARCHIES = ; @@ -44,13 +47,12 @@ ENABLE_CSS_IMAGE_ORIENTATION = ; ENABLE_CSS_IMAGE_RESOLUTION = ; ENABLE_CSS_REGIONS = ENABLE_CSS_REGIONS; ENABLE_CSS_SHADERS = ENABLE_CSS_SHADERS; -ENABLE_CSS_COMPOSITING = ENABLE_CSS_COMPOSITING; ENABLE_CSS_STICKY_POSITION = ENABLE_CSS_STICKY_POSITION; ENABLE_CSS_VARIABLES = ; ENABLE_CSS3_CONDITIONAL_RULES = ; ENABLE_CSS3_TEXT = ; ENABLE_CUSTOM_SCHEME_HANDLER = ; -ENABLE_DASHBOARD_SUPPORT = $(ENABLE_DASHBOARD_SUPPORT_$(REAL_PLATFORM_NAME)); +ENABLE_DASHBOARD_SUPPORT = $(ENABLE_DASHBOARD_SUPPORT_$(PLATFORM_NAME)); ENABLE_DASHBOARD_SUPPORT_macosx = ENABLE_DASHBOARD_SUPPORT; ENABLE_DATALIST_ELEMENT = ; ENABLE_DATA_TRANSFER_ITEMS = ; @@ -59,47 +61,46 @@ ENABLE_DEVICE_ORIENTATION = ; ENABLE_DIALOG_ELEMENT = ; ENABLE_DIRECTORY_UPLOAD = ; ENABLE_DRAGGABLE_REGION = ; -ENABLE_ENCRYPTED_MEDIA = $(ENABLE_ENCRYPTED_MEDIA_$(REAL_PLATFORM_NAME)); +ENABLE_ENCRYPTED_MEDIA = $(ENABLE_ENCRYPTED_MEDIA_$(PLATFORM_NAME)); ENABLE_ENCRYPTED_MEDIA_macosx = $(ENABLE_ENCRYPTED_MEDIA_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR)); ENABLE_ENCRYPTED_MEDIA_macosx_1070 = ; ENABLE_ENCRYPTED_MEDIA_macosx_1080 = ; ENABLE_ENCRYPTED_MEDIA_macosx_1090 = ENABLE_ENCRYPTED_MEDIA; ENABLE_FILE_SYSTEM = ; -ENABLE_FILTERS = $(ENABLE_FILTERS_$(REAL_PLATFORM_NAME)); -ENABLE_FILTERS_macosx = ENABLE_FILTERS; +ENABLE_FILTERS = ENABLE_FILTERS; ENABLE_FULLSCREEN_API = ENABLE_FULLSCREEN_API; ENABLE_GAMEPAD = ; ENABLE_GEOLOCATION = ENABLE_GEOLOCATION; -ENABLE_HIDDEN_PAGE_DOM_TIMER_THROTTLING = $(HIDDEN_PAGE_DOM_TIMER_THROTTLING_$(REAL_PLATFORM_NAME)); -ENABLE_HIDDEN_PAGE_DOM_TIMER_THROTTLING_macosx = HIDDEN_PAGE_DOM_TIMER_THROTTLING; +ENABLE_HIDDEN_PAGE_DOM_TIMER_THROTTLING = $(ENABLE_HIDDEN_PAGE_DOM_TIMER_THROTTLING_$(PLATFORM_NAME)); +ENABLE_HIDDEN_PAGE_DOM_TIMER_THROTTLING_macosx = ENABLE_HIDDEN_PAGE_DOM_TIMER_THROTTLING; ENABLE_HIGH_DPI_CANVAS = ENABLE_HIGH_DPI_CANVAS; -ENABLE_ICONDATABASE = $(ENABLE_ICONDATABASE_$(REAL_PLATFORM_NAME)); +ENABLE_ICONDATABASE = $(ENABLE_ICONDATABASE_$(PLATFORM_NAME)); ENABLE_ICONDATABASE_macosx = ENABLE_ICONDATABASE; ENABLE_IFRAME_SEAMLESS = ENABLE_IFRAME_SEAMLESS; ENABLE_INDEXED_DATABASE = ; ENABLE_INPUT_SPEECH = ; ENABLE_INPUT_TYPE_COLOR = ; -ENABLE_INPUT_TYPE_DATE = $(ENABLE_INPUT_TYPE_DATE_$(REAL_PLATFORM_NAME)); +ENABLE_INPUT_TYPE_DATE = $(ENABLE_INPUT_TYPE_DATE_$(PLATFORM_NAME)); ENABLE_INPUT_TYPE_DATE_iphoneos = ENABLE_INPUT_TYPE_DATE; -ENABLE_INPUT_TYPE_DATE_iphonesimulator = ENABLE_INPUT_TYPE_DATE; -ENABLE_INPUT_TYPE_DATETIME = $(ENABLE_INPUT_TYPE_DATETIME_$(REAL_PLATFORM_NAME)); +ENABLE_INPUT_TYPE_DATE_iphonesimulator = $(ENABLE_INPUT_TYPE_DATE_iphoneos); +ENABLE_INPUT_TYPE_DATETIME = $(ENABLE_INPUT_TYPE_DATETIME_$(PLATFORM_NAME)); ENABLE_INPUT_TYPE_DATETIME_iphoneos = ENABLE_INPUT_TYPE_DATETIME; -ENABLE_INPUT_TYPE_DATETIME_iphonesimulator = ENABLE_INPUT_TYPE_DATETIME; -ENABLE_INPUT_TYPE_DATETIMELOCAL = $(ENABLE_INPUT_TYPE_DATETIMELOCAL_$(REAL_PLATFORM_NAME)); +ENABLE_INPUT_TYPE_DATETIME_iphonesimulator = $(ENABLE_INPUT_TYPE_DATETIME_iphoneos); +ENABLE_INPUT_TYPE_DATETIMELOCAL = $(ENABLE_INPUT_TYPE_DATETIMELOCAL_$(PLATFORM_NAME)); ENABLE_INPUT_TYPE_DATETIMELOCAL_iphoneos = ENABLE_INPUT_TYPE_DATETIMELOCAL; -ENABLE_INPUT_TYPE_DATETIMELOCAL_iphonesimulator = ENABLE_INPUT_TYPE_DATETIMELOCAL; -ENABLE_INPUT_TYPE_MONTH = $(ENABLE_INPUT_TYPE_MONTH_$(REAL_PLATFORM_NAME)); +ENABLE_INPUT_TYPE_DATETIMELOCAL_iphonesimulator = $(ENABLE_INPUT_TYPE_DATETIMELOCAL_iphoneos); +ENABLE_INPUT_TYPE_MONTH = $(ENABLE_INPUT_TYPE_MONTH_$(PLATFORM_NAME)); ENABLE_INPUT_TYPE_MONTH_iphoneos = ENABLE_INPUT_TYPE_MONTH; -ENABLE_INPUT_TYPE_MONTH_iphonesimulator = ENABLE_INPUT_TYPE_MONTH; -ENABLE_INPUT_TYPE_TIME = $(ENABLE_INPUT_TYPE_TIME_$(REAL_PLATFORM_NAME)); +ENABLE_INPUT_TYPE_MONTH_iphonesimulator = $(ENABLE_INPUT_TYPE_MONTH_iphoneos); +ENABLE_INPUT_TYPE_TIME = $(ENABLE_INPUT_TYPE_TIME_$(PLATFORM_NAME)); ENABLE_INPUT_TYPE_TIME_iphoneos = ENABLE_INPUT_TYPE_TIME; -ENABLE_INPUT_TYPE_TIME_iphonesimulator = ENABLE_INPUT_TYPE_TIME; -ENABLE_INPUT_TYPE_WEEK = $(ENABLE_INPUT_TYPE_WEEK_$(REAL_PLATFORM_NAME)); +ENABLE_INPUT_TYPE_TIME_iphonesimulator = $(ENABLE_INPUT_TYPE_TIME_iphoneos); +ENABLE_INPUT_TYPE_WEEK = $(ENABLE_INPUT_TYPE_WEEK_$(PLATFORM_NAME)); ENABLE_INPUT_TYPE_WEEK_iphoneos = ENABLE_INPUT_TYPE_WEEK; -ENABLE_INPUT_TYPE_WEEK_iphonesimulator = ENABLE_INPUT_TYPE_WEEK; +ENABLE_INPUT_TYPE_WEEK_iphonesimulator = $(ENABLE_INPUT_TYPE_WEEK_iphoneos); ENABLE_JAVASCRIPT_DEBUGGER = ENABLE_JAVASCRIPT_DEBUGGER; ENABLE_LEGACY_CSS_VENDOR_PREFIXES = ENABLE_LEGACY_CSS_VENDOR_PREFIXES; -ENABLE_LEGACY_NOTIFICATIONS = $(ENABLE_LEGACY_NOTIFICATIONS_$(REAL_PLATFORM_NAME)); +ENABLE_LEGACY_NOTIFICATIONS = $(ENABLE_LEGACY_NOTIFICATIONS_$(PLATFORM_NAME)); ENABLE_LEGACY_NOTIFICATIONS_macosx = $(ENABLE_LEGACY_NOTIFICATIONS_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR)); ENABLE_LEGACY_NOTIFICATIONS_macosx_1070 = ; ENABLE_LEGACY_NOTIFICATIONS_macosx_1080 = ENABLE_LEGACY_NOTIFICATIONS; @@ -116,36 +117,44 @@ ENABLE_MHTML = ; ENABLE_MICRODATA = ; ENABLE_MUTATION_OBSERVERS = ENABLE_MUTATION_OBSERVERS; ENABLE_NAVIGATOR_CONTENT_UTILS = ; -ENABLE_NOTIFICATIONS = $(ENABLE_NOTIFICATIONS_$(REAL_PLATFORM_NAME)); +ENABLE_NOTIFICATIONS = $(ENABLE_NOTIFICATIONS_$(PLATFORM_NAME)); ENABLE_NOTIFICATIONS_macosx = $(ENABLE_NOTIFICATIONS_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR)); ENABLE_NOTIFICATIONS_macosx_1070 = ; ENABLE_NOTIFICATIONS_macosx_1080 = ENABLE_NOTIFICATIONS; ENABLE_NOTIFICATIONS_macosx_1090 = ENABLE_NOTIFICATIONS; ENABLE_PAGE_VISIBILITY_API = ; +ENABLE_PDFKIT_PLUGIN = $(ENABLE_PDFKIT_PLUGIN_$(PLATFORM_NAME)); +ENABLE_PDFKIT_PLUGIN_macosx = $(ENABLE_PDFKIT_PLUGIN_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR)); +ENABLE_PDFKIT_PLUGIN_macosx_1070 = ; +ENABLE_PDFKIT_PLUGIN_macosx_1080 = ; +ENABLE_PDFKIT_PLUGIN_macosx_1090 = ENABLE_PDFKIT_PLUGIN; ENABLE_PROGRESS_ELEMENT = ENABLE_PROGRESS_ELEMENT; ENABLE_QUOTA = ; ENABLE_REQUEST_ANIMATION_FRAME = ENABLE_REQUEST_ANIMATION_FRAME; +ENABLE_RESOLUTION_MEDIA_QUERY = ; ENABLE_SCRIPTED_SPEECH = ; ENABLE_SHADOW_DOM = ; ENABLE_SHARED_WORKERS = ENABLE_SHARED_WORKERS; ENABLE_SQL_DATABASE = ENABLE_SQL_DATABASE; ENABLE_STYLE_SCOPED = ; +ENABLE_SUBPIXEL_LAYOUT = ENABLE_SUBPIXEL_LAYOUT; ENABLE_SVG = ENABLE_SVG; -ENABLE_SVG_DOM_OBJC_BINDINGS = $(ENABLE_SVG_DOM_OBJC_BINDINGS_$(REAL_PLATFORM_NAME)); +ENABLE_SVG_DOM_OBJC_BINDINGS = $(ENABLE_SVG_DOM_OBJC_BINDINGS_$(PLATFORM_NAME)); ENABLE_SVG_DOM_OBJC_BINDINGS_macosx = ENABLE_SVG_DOM_OBJC_BINDINGS; ENABLE_SVG_FONTS = ENABLE_SVG_FONTS; ENABLE_TEXT_AUTOSIZING = ; ENABLE_TEXT_NOTIFICATIONS_ONLY = ENABLE_TEXT_NOTIFICATIONS_ONLY; ENABLE_TOUCH_ICON_LOADING = ; -ENABLE_UNDO_MANAGER = ; +ENABLE_USERSELECT_ALL = ENABLE_USERSELECT_ALL; ENABLE_VIDEO = ENABLE_VIDEO; -ENABLE_VIDEO_TRACK = $(ENABLE_VIDEO_TRACK_$(REAL_PLATFORM_NAME)); +ENABLE_VIDEO_TRACK = $(ENABLE_VIDEO_TRACK_$(PLATFORM_NAME)); ENABLE_VIDEO_TRACK_macosx = ENABLE_VIDEO_TRACK; ENABLE_WEBGL = ENABLE_WEBGL; ENABLE_WEB_AUDIO = ENABLE_WEB_AUDIO; ENABLE_WEB_SOCKETS = ENABLE_WEB_SOCKETS; ENABLE_WEB_TIMING = ; ENABLE_WORKERS = ENABLE_WORKERS; +ENABLE_XHR_TIMEOUT = ENABLE_XHR_TIMEOUT; ENABLE_XSLT = ENABLE_XSLT; -FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ANIMATION_API) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CSP_NEXT) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_EXCLUSIONS) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_HIERARCHIES) $(ENABLE_CSS_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SHADERS) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_STICKY_POSITION) $(ENABLE_CSS_VARIABLES) $(ENABLE_CSS3_CONDITIONAL_RULES) $(ENABLE_CSS3_TEXT) $(ENABLE_CUSTOM_SCHEME_HANDLER) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS_ELEMENT) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIALOG_ELEMENT) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_DRAGGABLE_REGION) $(ENABLE_ENCRYPTED_MEDIA) $(ENABLE_FILE_SYSTEM) $(ENABLE_FILTERS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_HIDDEN_PAGE_DOM_TIMER_THROTTLING) $(ENABLE_HIGH_DPI_CANVAS) $(ENABLE_ICONDATABASE) $(ENABLE_IFRAME_SEAMLESS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_NOTIFICATIONS) $(ENABLE_LEGACY_VENDOR_PREFIXES) $(ENABLE_LEGACY_WEB_AUDIO) $(ENABLE_LINK_PREFETCH) $(ENABLE_LINK_PRERENDER) $(ENABLE_MATHML) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MICRODATA) $(ENABLE_MUTATION_OBSERVERS) $(ENABLE_NAVIGATOR_CONTENT_UTILS) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PROGRESS_ELEMENT) $(ENABLE_QUOTA) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_SCRIPTED_SPEECH) $(ENABLE_SHADOW_DOM) $(ENABLE_SHARED_WORKERS) $(ENABLE_SQL_DATABASE) $(ENABLE_STYLE_SCOPED) $(ENABLE_SVG) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TEXT_NOTIFICATIONS_ONLY) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_UNDO_MANAGER) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WORKERS) $(ENABLE_XSLT); +FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ANIMATION_API) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CSP_NEXT) $(ENABLE_CSS_BOX_DECORATION_BREAK) $(ENABLE_CSS_DEVICE_ADAPTATION) $(ENABLE_CSS_EXCLUSIONS) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_HIERARCHIES) $(ENABLE_CSS_IMAGE_ORIENTATION) $(ENABLE_CSS_IMAGE_RESOLUTION) $(ENABLE_CSS_REGIONS) $(ENABLE_CSS_SHADERS) $(ENABLE_CSS_COMPOSITING) $(ENABLE_CSS_STICKY_POSITION) $(ENABLE_CSS_VARIABLES) $(ENABLE_CSS3_CONDITIONAL_RULES) $(ENABLE_CSS3_TEXT) $(ENABLE_CUSTOM_SCHEME_HANDLER) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST_ELEMENT) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS_ELEMENT) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIALOG_ELEMENT) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_DRAGGABLE_REGION) $(ENABLE_ENCRYPTED_MEDIA) $(ENABLE_FILE_SYSTEM) $(ENABLE_FILTERS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_HIDDEN_PAGE_DOM_TIMER_THROTTLING) $(ENABLE_HIGH_DPI_CANVAS) $(ENABLE_ICONDATABASE) $(ENABLE_IFRAME_SEAMLESS) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_COLOR) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_LEGACY_CSS_VENDOR_PREFIXES) $(ENABLE_LEGACY_NOTIFICATIONS) $(ENABLE_LEGACY_VENDOR_PREFIXES) $(ENABLE_LEGACY_WEB_AUDIO) $(ENABLE_LINK_PREFETCH) $(ENABLE_LINK_PRERENDER) $(ENABLE_MATHML) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_ELEMENT) $(ENABLE_MHTML) $(ENABLE_MICRODATA) $(ENABLE_MUTATION_OBSERVERS) $(ENABLE_NAVIGATOR_CONTENT_UTILS) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PDFKIT_PLUGIN) $(ENABLE_PROGRESS_ELEMENT) $(ENABLE_QUOTA) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_RESOLUTION_MEDIA_QUERY) $(ENABLE_SCRIPTED_SPEECH) $(ENABLE_SHADOW_DOM) $(ENABLE_SHARED_WORKERS) $(ENABLE_SQL_DATABASE) $(ENABLE_STYLE_SCOPED) $(ENABLE_SUBPIXEL_LAYOUT) $(ENABLE_SVG) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_TEXT_AUTOSIZING) $(ENABLE_TEXT_NOTIFICATIONS_ONLY) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_USERSELECT_ALL) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WORKERS) $(ENABLE_XHR_TIMEOUT) $(ENABLE_XSLT); diff --git a/Source/JavaScriptCore/Configurations/JSC.xcconfig b/Source/JavaScriptCore/Configurations/JSC.xcconfig index 8330d3f27..d596596e8 100644 --- a/Source/JavaScriptCore/Configurations/JSC.xcconfig +++ b/Source/JavaScriptCore/Configurations/JSC.xcconfig @@ -23,5 +23,5 @@ INSTALL_PATH = $(JAVASCRIPTCORE_FRAMEWORKS_DIR)/JavaScriptCore.framework/Versions/A/Resources PRODUCT_NAME = jsc; -CODE_SIGN_ENTITLEMENTS = $(CODE_SIGN_ENTITLEMENTS_$(REAL_PLATFORM_NAME)); +CODE_SIGN_ENTITLEMENTS = $(CODE_SIGN_ENTITLEMENTS_$(PLATFORM_NAME)); CODE_SIGN_ENTITLEMENTS_iphoneos = entitlements.plist; diff --git a/Source/JavaScriptCore/Configurations/JavaScriptCore.xcconfig b/Source/JavaScriptCore/Configurations/JavaScriptCore.xcconfig index 28ce60770..d5101d3b0 100644 --- a/Source/JavaScriptCore/Configurations/JavaScriptCore.xcconfig +++ b/Source/JavaScriptCore/Configurations/JavaScriptCore.xcconfig @@ -30,19 +30,15 @@ JSVALUE_MODEL_armv6 = 32_64; JSVALUE_MODEL_armv7 = 32_64; JSVALUE_MODEL_i386 = 32_64; JSVALUE_MODEL_ppc = 32_64; -JSVALUE_MODEL_ppc64 = 64; JSVALUE_MODEL_x86_64 = 64; // Prevent C++ standard library operator new, delete and their related exception types from being exported as weak symbols. OTHER_LDFLAGS_HIDE_SYMBOLS = -Wl,-unexported_symbol -Wl,__ZTISt9bad_alloc -Wl,-unexported_symbol -Wl,__ZTISt9exception -Wl,-unexported_symbol -Wl,__ZTSSt9bad_alloc -Wl,-unexported_symbol -Wl,__ZTSSt9exception -Wl,-unexported_symbol -Wl,__ZdlPvS_ -Wl,-unexported_symbol -Wl,__ZnwmPv -Wl,-all_load; OTHER_LDFLAGS_BASE = -lobjc -Wl,-Y,3 $(OTHER_LDFLAGS_HIDE_SYMBOLS); -OTHER_LDFLAGS = $(OTHER_LDFLAGS_$(REAL_PLATFORM_NAME)); +OTHER_LDFLAGS = $(OTHER_LDFLAGS_$(PLATFORM_NAME)); OTHER_LDFLAGS_iphoneos = $(OTHER_LDFLAGS_BASE); OTHER_LDFLAGS_iphonesimulator = $(OTHER_LDFLAGS_iphoneos); -OTHER_LDFLAGS_macosx = $(OTHER_LDFLAGS_BASE) -sub_library libobjc -framework CoreServices $(OTHER_LDFLAGS_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR)); -OTHER_LDFLAGS_macosx_1070 = -Xlinker -objc_gc_compaction; -OTHER_LDFLAGS_macosx_1080 = $(OTHER_LDFLAGS_macosx_1070); -OTHER_LDFLAGS_macosx_1090 = $(OTHER_LDFLAGS_macosx_1070); +OTHER_LDFLAGS_macosx = $(OTHER_LDFLAGS_BASE) -sub_library libobjc -framework CoreServices; GCC_PREFIX_HEADER = JavaScriptCorePrefix.h; GCC_SYMBOLS_PRIVATE_EXTERN = YES; HEADER_SEARCH_PATHS = "${BUILT_PRODUCTS_DIR}/DerivedSources/JavaScriptCore" $(HEADER_SEARCH_PATHS); diff --git a/Source/JavaScriptCore/Configurations/ToolExecutable.xcconfig b/Source/JavaScriptCore/Configurations/ToolExecutable.xcconfig index 65f9ad5ac..bd733d4a2 100644 --- a/Source/JavaScriptCore/Configurations/ToolExecutable.xcconfig +++ b/Source/JavaScriptCore/Configurations/ToolExecutable.xcconfig @@ -21,7 +21,7 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -INSTALL_PATH = $(INSTALL_PATH_$(REAL_PLATFORM_NAME)); +INSTALL_PATH = $(INSTALL_PATH_$(PLATFORM_NAME)); INSTALL_PATH_iphoneos = $(JAVASCRIPTCORE_FRAMEWORKS_DIR)/JavaScriptCore.framework/Resources; INSTALL_PATH_iphonesimulator = $(INSTALL_PATH_iphoneos); INSTALL_PATH_macosx = $(JAVASCRIPTCORE_FRAMEWORKS_DIR)/JavaScriptCore.framework/Versions/A/Resources; diff --git a/Source/JavaScriptCore/Configurations/Version.xcconfig b/Source/JavaScriptCore/Configurations/Version.xcconfig index f0f18d9e1..3d24fe85a 100644 --- a/Source/JavaScriptCore/Configurations/Version.xcconfig +++ b/Source/JavaScriptCore/Configurations/Version.xcconfig @@ -22,7 +22,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. MAJOR_VERSION = 537; -MINOR_VERSION = 16; +MINOR_VERSION = 18; TINY_VERSION = 0; FULL_VERSION = $(MAJOR_VERSION).$(MINOR_VERSION); @@ -32,8 +32,6 @@ SHORT_VERSION_STRING = $(SHORT_VERSION_STRING_$(CONFIGURATION)) // The system version prefix is based on the current system version. SYSTEM_VERSION_PREFIX = $(SYSTEM_VERSION_PREFIX_$(TARGET_MAC_OS_X_VERSION_MAJOR)); -SYSTEM_VERSION_PREFIX_1050 = 5; -SYSTEM_VERSION_PREFIX_1060 = 6; SYSTEM_VERSION_PREFIX_1070 = 7; SYSTEM_VERSION_PREFIX_1080 = 8; SYSTEM_VERSION_PREFIX_1090 = 9; diff --git a/Source/JavaScriptCore/DerivedSources.pri b/Source/JavaScriptCore/DerivedSources.pri index cf44aefe1..03a935575 100644 --- a/Source/JavaScriptCore/DerivedSources.pri +++ b/Source/JavaScriptCore/DerivedSources.pri @@ -40,6 +40,13 @@ LLINT_DEPENDENCY = \ $$PWD/llint/LowLevelInterpreter64.asm \ $$LLINT_ASSEMBLER +DISASSEMBLER_FILES = \ + disassembler/udis86/optable.xml + +DISASSEMBLER_DEPENDENCY = \ + $$PWD/disassembler/udis86/ud_opcode.py \ + $$PWD/disassembler/udis86/ud_optable.py + # GENERATOR 1-A: LUT creator lut.output = ${QMAKE_FILE_BASE}.lut.h lut.input = LUT_FILES @@ -88,7 +95,7 @@ klgen.input = KEYWORDLUT_FILES klgen.commands = python $$klgen.script ${QMAKE_FILE_NAME} > ${QMAKE_FILE_OUT} GENERATORS += klgen -EXTRACTOR_BINARY = LLIntOffsetsExtractor$$EXEEXT +EXTRACTOR_BINARY = LLIntOffsetsExtractor$$BIN_EXTENSION DIRS = $$OUT_PWD $$OUT_PWD/debug $$OUT_PWD/release for(dir, DIRS) { file = $$dir/$$EXTRACTOR_BINARY @@ -104,3 +111,14 @@ if(linux-*|win32):!equals(QT_ARCH, "arm") { llint.commands = ruby $$llint.script $$LLINT_ASSEMBLER ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT} GENERATORS += llint } + +linux-*:if(isEqual(QT_ARCH, "i386")|isEqual(QT_ARCH, "x86_64")) { + # GENERATOR: disassembler + disassembler.output = udis86_itab.c + disassembler.input = DISASSEMBLER_FILES + disassembler.script = $$PWD/disassembler/udis86/itab.py + disassembler.depends = $$DISASSEMBLER_DEPENDENCY + disassembler.commands = python $$disassembler.script ${QMAKE_FILE_NAME} --outputDir ${QMAKE_FUNC_FILE_OUT_PATH} + disassembler.CONFIG += no_link + GENERATORS += disassembler +} diff --git a/Source/JavaScriptCore/GNUmakefile.list.am b/Source/JavaScriptCore/GNUmakefile.list.am index 243894d39..d68a22b9f 100644 --- a/Source/JavaScriptCore/GNUmakefile.list.am +++ b/Source/JavaScriptCore/GNUmakefile.list.am @@ -114,10 +114,6 @@ javascriptcore_sources += \ Source/JavaScriptCore/bytecode/LazyOperandValueProfile.cpp \ Source/JavaScriptCore/bytecode/LazyOperandValueProfile.h \ Source/JavaScriptCore/bytecode/LineInfo.h \ - Source/JavaScriptCore/bytecode/MethodCallLinkInfo.cpp \ - Source/JavaScriptCore/bytecode/MethodCallLinkInfo.h \ - Source/JavaScriptCore/bytecode/MethodCallLinkStatus.cpp \ - Source/JavaScriptCore/bytecode/MethodCallLinkStatus.h \ Source/JavaScriptCore/bytecode/MethodOfGettingAValueProfile.cpp \ Source/JavaScriptCore/bytecode/MethodOfGettingAValueProfile.h \ Source/JavaScriptCore/bytecode/Opcode.cpp \ @@ -142,6 +138,8 @@ javascriptcore_sources += \ Source/JavaScriptCore/bytecode/StructureStubInfo.h \ Source/JavaScriptCore/bytecode/StructureStubClearingWatchpoint.cpp \ Source/JavaScriptCore/bytecode/StructureStubClearingWatchpoint.h \ + Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.cpp \ + Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h \ Source/JavaScriptCore/bytecode/ValueProfile.h \ Source/JavaScriptCore/bytecode/ValueRecovery.h \ Source/JavaScriptCore/bytecode/VirtualRegister.h \ @@ -377,6 +375,7 @@ javascriptcore_sources += \ Source/JavaScriptCore/interpreter/Interpreter.h \ Source/JavaScriptCore/interpreter/JSStack.cpp \ Source/JavaScriptCore/interpreter/JSStack.h \ + Source/JavaScriptCore/interpreter/JSStackInlines.h \ Source/JavaScriptCore/interpreter/Register.h \ Source/JavaScriptCore/interpreter/VMInspector.cpp \ Source/JavaScriptCore/interpreter/VMInspector.h \ @@ -447,6 +446,7 @@ javascriptcore_sources += \ Source/JavaScriptCore/parser/ParserTokens.h \ Source/JavaScriptCore/parser/Parser.cpp \ Source/JavaScriptCore/parser/Parser.h \ + Source/JavaScriptCore/parser/ParserModes.h \ Source/JavaScriptCore/parser/ResultType.h \ Source/JavaScriptCore/parser/SourceCode.h \ Source/JavaScriptCore/parser/SourceProvider.h \ @@ -487,6 +487,8 @@ javascriptcore_sources += \ Source/JavaScriptCore/runtime/CallData.cpp \ Source/JavaScriptCore/runtime/CallData.h \ Source/JavaScriptCore/runtime/ClassInfo.h \ + Source/JavaScriptCore/runtime/CodeCache.cpp \ + Source/JavaScriptCore/runtime/CodeCache.h \ Source/JavaScriptCore/runtime/CodeSpecializationKind.h \ Source/JavaScriptCore/runtime/CommonIdentifiers.cpp \ Source/JavaScriptCore/runtime/CommonIdentifiers.h \ diff --git a/Source/JavaScriptCore/JavaScriptCore.pri b/Source/JavaScriptCore/JavaScriptCore.pri index fad36c974..d465bcfea 100644 --- a/Source/JavaScriptCore/JavaScriptCore.pri +++ b/Source/JavaScriptCore/JavaScriptCore.pri @@ -38,3 +38,7 @@ wince* { INCLUDEPATH += $$QT.core.sources/../3rdparty/ce-compat INCLUDEPATH += $$SOURCE_DIR/os-win32 } + +linux-*:if(isEqual(QT_ARCH, "i386")|isEqual(QT_ARCH, "x86_64")) { + INCLUDEPATH += $$SOURCE_DIR/disassembler/udis86 +} diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj index a21dcf1e8..b1567e2cd 100644 --- a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj +++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj @@ -637,6 +637,14 @@ RelativePath="..\..\runtime\ClassInfo.h" > + + + + @@ -1677,22 +1685,6 @@ RelativePath="..\..\bytecode\LineInfo.h" > - - - - - - - - @@ -1761,6 +1753,14 @@ RelativePath="..\..\bytecode\StructureStubInfo.h" > + + + + @@ -2245,6 +2245,10 @@ RelativePath="..\..\parser\Parser.h" > + + diff --git a/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj b/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj index 1cf109a0b..3cada1cd7 100644 --- a/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj +++ b/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj @@ -69,8 +69,6 @@ 0F0B83AD14BCF60400885B4F /* LineInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F0B83AC14BCF60200885B4F /* LineInfo.h */; settings = {ATTRIBUTES = (Private, ); }; }; 0F0B83B014BCF71600885B4F /* CallLinkInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F0B83AE14BCF71400885B4F /* CallLinkInfo.cpp */; }; 0F0B83B114BCF71800885B4F /* CallLinkInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F0B83AF14BCF71400885B4F /* CallLinkInfo.h */; settings = {ATTRIBUTES = (Private, ); }; }; - 0F0B83B414BCF86000885B4F /* MethodCallLinkInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F0B83B214BCF85E00885B4F /* MethodCallLinkInfo.cpp */; }; - 0F0B83B514BCF86200885B4F /* MethodCallLinkInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F0B83B314BCF85E00885B4F /* MethodCallLinkInfo.h */; settings = {ATTRIBUTES = (Private, ); }; }; 0F0B83B914BCF95F00885B4F /* CallReturnOffsetToBytecodeOffset.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F0B83B814BCF95B00885B4F /* CallReturnOffsetToBytecodeOffset.h */; settings = {ATTRIBUTES = (Private, ); }; }; 0F0CD4C215F1A6070032F1C0 /* PutDirectIndexMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F0CD4C015F1A6040032F1C0 /* PutDirectIndexMode.h */; settings = {ATTRIBUTES = (Private, ); }; }; 0F0CD4C415F6B6BB0032F1C0 /* SparseArrayValueMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F0CD4C315F6B6B50032F1C0 /* SparseArrayValueMap.cpp */; }; @@ -178,8 +176,6 @@ 0F93329E14CA7DC50085F3C6 /* CallLinkStatus.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F93329414CA7DC10085F3C6 /* CallLinkStatus.h */; settings = {ATTRIBUTES = (Private, ); }; }; 0F93329F14CA7DCA0085F3C6 /* GetByIdStatus.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F93329514CA7DC10085F3C6 /* GetByIdStatus.cpp */; }; 0F9332A014CA7DCD0085F3C6 /* GetByIdStatus.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F93329614CA7DC10085F3C6 /* GetByIdStatus.h */; settings = {ATTRIBUTES = (Private, ); }; }; - 0F9332A114CA7DD10085F3C6 /* MethodCallLinkStatus.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F93329714CA7DC10085F3C6 /* MethodCallLinkStatus.cpp */; }; - 0F9332A214CA7DD30085F3C6 /* MethodCallLinkStatus.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F93329814CA7DC10085F3C6 /* MethodCallLinkStatus.h */; settings = {ATTRIBUTES = (Private, ); }; }; 0F9332A314CA7DD70085F3C6 /* PutByIdStatus.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F93329914CA7DC10085F3C6 /* PutByIdStatus.cpp */; }; 0F9332A414CA7DD90085F3C6 /* PutByIdStatus.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F93329A14CA7DC10085F3C6 /* PutByIdStatus.h */; settings = {ATTRIBUTES = (Private, ); }; }; 0F9332A514CA7DDD0085F3C6 /* StructureSet.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F93329B14CA7DC10085F3C6 /* StructureSet.h */; settings = {ATTRIBUTES = (Private, ); }; }; @@ -584,12 +580,17 @@ A75706DE118A2BCF0057F88F /* JITArithmetic32_64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A75706DD118A2BCF0057F88F /* JITArithmetic32_64.cpp */; }; A766B44F0EE8DCD1009518CA /* ExecutableAllocator.h in Headers */ = {isa = PBXBuildFile; fileRef = A7B48DB50EE74CFC00DCBDB6 /* ExecutableAllocator.h */; settings = {ATTRIBUTES = (Private, ); }; }; A76C51761182748D00715B05 /* JSInterfaceJIT.h in Headers */ = {isa = PBXBuildFile; fileRef = A76C51741182748D00715B05 /* JSInterfaceJIT.h */; settings = {ATTRIBUTES = (Private, ); }; }; + A76F279415F13C9600517D67 /* UnlinkedCodeBlock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A79E781E15EECBA80047C855 /* UnlinkedCodeBlock.cpp */; }; A76F54A313B28AAB00EF2BCE /* JITWriteBarrier.h in Headers */ = {isa = PBXBuildFile; fileRef = A76F54A213B28AAB00EF2BCE /* JITWriteBarrier.h */; }; + A77F1821164088B200640A47 /* CodeCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A77F181F164088B200640A47 /* CodeCache.cpp */; }; + A77F1822164088B200640A47 /* CodeCache.h in Headers */ = {isa = PBXBuildFile; fileRef = A77F1820164088B200640A47 /* CodeCache.h */; settings = {ATTRIBUTES = (Private, ); }; }; + A77F1825164192C700640A47 /* ParserModes.h in Headers */ = {isa = PBXBuildFile; fileRef = A77F18241641925400640A47 /* ParserModes.h */; settings = {ATTRIBUTES = (Private, ); }; }; A784A26111D16622005776AC /* ASTBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = A7A7EE7411B98B8D0065A14F /* ASTBuilder.h */; }; A784A26411D16622005776AC /* SyntaxChecker.h in Headers */ = {isa = PBXBuildFile; fileRef = A7A7EE7711B98B8D0065A14F /* SyntaxChecker.h */; }; A7AFC17915F7EFE30048F57B /* ResolveOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = A7AFC17715F7EFE30048F57B /* ResolveOperation.h */; settings = {ATTRIBUTES = (Private, ); }; }; A7B48F490EE8936F00DCBDB6 /* ExecutableAllocator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7B48DB60EE74CFC00DCBDB6 /* ExecutableAllocator.cpp */; }; A7B4ACAF1484C9CE00B38A36 /* JSExportMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = A7B4ACAE1484C9CE00B38A36 /* JSExportMacros.h */; settings = {ATTRIBUTES = (Private, ); }; }; + A7B601821639FD2A00372BA3 /* UnlinkedCodeBlock.h in Headers */ = {isa = PBXBuildFile; fileRef = A79E781F15EECBA80047C855 /* UnlinkedCodeBlock.h */; settings = {ATTRIBUTES = (Private, ); }; }; A7C1E8E4112E72EF00A37F98 /* JITPropertyAccess32_64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7C1E8C8112E701C00A37F98 /* JITPropertyAccess32_64.cpp */; }; A7DCB97312E5193F00911940 /* WriteBarrier.h in Headers */ = {isa = PBXBuildFile; fileRef = A7DCB77912E3D90500911940 /* WriteBarrier.h */; settings = {ATTRIBUTES = (Private, ); }; }; A7E2EA6B0FB460CF00601F06 /* LiteralParser.h in Headers */ = {isa = PBXBuildFile; fileRef = A7E2EA690FB460CF00601F06 /* LiteralParser.h */; }; @@ -746,7 +747,7 @@ FE20CE9D15F04A9500DF3430 /* LLIntCLoop.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE20CE9B15F04A9500DF3430 /* LLIntCLoop.cpp */; }; FE20CE9E15F04A9500DF3430 /* LLIntCLoop.h in Headers */ = {isa = PBXBuildFile; fileRef = FE20CE9C15F04A9500DF3430 /* LLIntCLoop.h */; settings = {ATTRIBUTES = (Private, ); }; }; FE4A331F15BD2E07006F54F3 /* VMInspector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE4A331D15BD2E07006F54F3 /* VMInspector.cpp */; }; - FE4A332015BD2E07006F54F3 /* VMInspector.h in Headers */ = {isa = PBXBuildFile; fileRef = FE4A331E15BD2E07006F54F3 /* VMInspector.h */; }; + FE4A332015BD2E07006F54F3 /* VMInspector.h in Headers */ = {isa = PBXBuildFile; fileRef = FE4A331E15BD2E07006F54F3 /* VMInspector.h */; settings = {ATTRIBUTES = (Private, ); }; }; FED287B215EC9A5700DA8161 /* LLIntOpcode.h in Headers */ = {isa = PBXBuildFile; fileRef = FED287B115EC9A5700DA8161 /* LLIntOpcode.h */; settings = {ATTRIBUTES = (Private, ); }; }; /* End PBXBuildFile section */ @@ -853,8 +854,6 @@ 0F0B83AC14BCF60200885B4F /* LineInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LineInfo.h; sourceTree = ""; }; 0F0B83AE14BCF71400885B4F /* CallLinkInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CallLinkInfo.cpp; sourceTree = ""; }; 0F0B83AF14BCF71400885B4F /* CallLinkInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CallLinkInfo.h; sourceTree = ""; }; - 0F0B83B214BCF85E00885B4F /* MethodCallLinkInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MethodCallLinkInfo.cpp; sourceTree = ""; }; - 0F0B83B314BCF85E00885B4F /* MethodCallLinkInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MethodCallLinkInfo.h; sourceTree = ""; }; 0F0B83B814BCF95B00885B4F /* CallReturnOffsetToBytecodeOffset.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CallReturnOffsetToBytecodeOffset.h; sourceTree = ""; }; 0F0CD4C015F1A6040032F1C0 /* PutDirectIndexMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PutDirectIndexMode.h; sourceTree = ""; }; 0F0CD4C315F6B6B50032F1C0 /* SparseArrayValueMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SparseArrayValueMap.cpp; sourceTree = ""; }; @@ -963,8 +962,6 @@ 0F93329414CA7DC10085F3C6 /* CallLinkStatus.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CallLinkStatus.h; sourceTree = ""; }; 0F93329514CA7DC10085F3C6 /* GetByIdStatus.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GetByIdStatus.cpp; sourceTree = ""; }; 0F93329614CA7DC10085F3C6 /* GetByIdStatus.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GetByIdStatus.h; sourceTree = ""; }; - 0F93329714CA7DC10085F3C6 /* MethodCallLinkStatus.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MethodCallLinkStatus.cpp; sourceTree = ""; }; - 0F93329814CA7DC10085F3C6 /* MethodCallLinkStatus.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MethodCallLinkStatus.h; sourceTree = ""; }; 0F93329914CA7DC10085F3C6 /* PutByIdStatus.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PutByIdStatus.cpp; sourceTree = ""; }; 0F93329A14CA7DC10085F3C6 /* PutByIdStatus.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PutByIdStatus.h; sourceTree = ""; }; 0F93329B14CA7DC10085F3C6 /* StructureSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StructureSet.h; sourceTree = ""; }; @@ -1386,6 +1383,11 @@ A767FF9F14F4502900789059 /* JSCTypedArrayStubs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCTypedArrayStubs.h; sourceTree = ""; }; A76C51741182748D00715B05 /* JSInterfaceJIT.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSInterfaceJIT.h; sourceTree = ""; }; A76F54A213B28AAB00EF2BCE /* JITWriteBarrier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITWriteBarrier.h; sourceTree = ""; }; + A77F181F164088B200640A47 /* CodeCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CodeCache.cpp; sourceTree = ""; }; + A77F1820164088B200640A47 /* CodeCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CodeCache.h; sourceTree = ""; }; + A77F18241641925400640A47 /* ParserModes.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ParserModes.h; sourceTree = ""; }; + A79E781E15EECBA80047C855 /* UnlinkedCodeBlock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UnlinkedCodeBlock.cpp; sourceTree = ""; }; + A79E781F15EECBA80047C855 /* UnlinkedCodeBlock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UnlinkedCodeBlock.h; sourceTree = ""; }; A79EDB0811531CD60019E912 /* JSObjectRefPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSObjectRefPrivate.h; sourceTree = ""; }; A7A7EE7411B98B8D0065A14F /* ASTBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASTBuilder.h; sourceTree = ""; }; A7A7EE7711B98B8D0065A14F /* SyntaxChecker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SyntaxChecker.h; sourceTree = ""; }; @@ -1408,7 +1410,6 @@ A8A4748D151A8306004123FF /* libWTF.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libWTF.a; sourceTree = BUILT_PRODUCTS_DIR; }; A8E894310CD0602400367179 /* JSCallbackObjectFunctions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCallbackObjectFunctions.h; sourceTree = ""; }; A8E894330CD0603F00367179 /* JSGlobalObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSGlobalObject.h; sourceTree = ""; }; - BC021BF1136900C300FC5467 /* CompilerVersion.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = CompilerVersion.xcconfig; sourceTree = ""; }; BC021BF2136900C300FC5467 /* ToolExecutable.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = ToolExecutable.xcconfig; sourceTree = ""; }; BC02E9040E1839DB000F9297 /* ErrorConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ErrorConstructor.cpp; sourceTree = ""; }; BC02E9050E1839DB000F9297 /* ErrorConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ErrorConstructor.h; sourceTree = ""; }; @@ -2001,7 +2002,6 @@ isa = PBXGroup; children = ( 1C9051450BA9E8A70081E9D0 /* Base.xcconfig */, - BC021BF1136900C300FC5467 /* CompilerVersion.xcconfig */, 1C9051440BA9E8A70081E9D0 /* DebugRelease.xcconfig */, 449097EE0F8F81B50076A327 /* FeatureDefines.xcconfig */, 5DAFD6CB146B686300FBEFB4 /* JSC.xcconfig */, @@ -2073,6 +2073,7 @@ E49DC15112EF272200184A1F /* SourceProviderCache.h */, E49DC14912EF261A00184A1F /* SourceProviderCacheItem.h */, A7A7EE7711B98B8D0065A14F /* SyntaxChecker.h */, + A77F18241641925400640A47 /* ParserModes.h */, ); path = parser; sourceTree = ""; @@ -2307,6 +2308,8 @@ 1420BE7A10AA6DDB00F455D2 /* WeakRandom.h */, A7DCB77912E3D90500911940 /* WriteBarrier.h */, C2D58C3315912FEE0021A844 /* GCActivityCallback.cpp */, + A77F181F164088B200640A47 /* CodeCache.cpp */, + A77F1820164088B200640A47 /* CodeCache.h */, ); path = runtime; sourceTree = ""; @@ -2520,14 +2523,6 @@ 0F0B83AF14BCF71400885B4F /* CallLinkInfo.h */, 0F93329314CA7DC10085F3C6 /* CallLinkStatus.cpp */, 0F93329414CA7DC10085F3C6 /* CallLinkStatus.h */, - 0F93329514CA7DC10085F3C6 /* GetByIdStatus.cpp */, - 0F93329614CA7DC10085F3C6 /* GetByIdStatus.h */, - 0F93329714CA7DC10085F3C6 /* MethodCallLinkStatus.cpp */, - 0F93329814CA7DC10085F3C6 /* MethodCallLinkStatus.h */, - 0F93329914CA7DC10085F3C6 /* PutByIdStatus.cpp */, - 0F93329A14CA7DC10085F3C6 /* PutByIdStatus.h */, - A7AFC17715F7EFE30048F57B /* ResolveOperation.h */, - 0F93329B14CA7DC10085F3C6 /* StructureSet.h */, 0F0B83B814BCF95B00885B4F /* CallReturnOffsetToBytecodeOffset.h */, 969A07900ED1D3AE00F1F681 /* CodeBlock.cpp */, 969A07910ED1D3AE00F1F681 /* CodeBlock.h */, @@ -2551,10 +2546,6 @@ 0FB5467614F59AD1002C2989 /* LazyOperandValueProfile.h */, 0F0B83AC14BCF60200885B4F /* LineInfo.h */, 0F0FC45814BD15F100B81154 /* LLIntCallLinkInfo.h */, - 0F0B83B214BCF85E00885B4F /* MethodCallLinkInfo.cpp */, - 0F0B83B314BCF85E00885B4F /* MethodCallLinkInfo.h */, - 0F93329714CA7DC10085F3C6 /* MethodCallLinkStatus.cpp */, - 0F93329814CA7DC10085F3C6 /* MethodCallLinkStatus.h */, 0FB5467C14F5CFD3002C2989 /* MethodOfGettingAValueProfile.cpp */, 0FB5467A14F5C7D4002C2989 /* MethodOfGettingAValueProfile.h */, 969A07940ED1D3AE00F1F681 /* Opcode.cpp */, @@ -2567,6 +2558,7 @@ 0F9FC8C114E1B5FB00D52AE0 /* PutKind.h */, 0FF4276E159275D2004CB9FF /* ResolveGlobalStatus.cpp */, 0FF4276F159275D2004CB9FF /* ResolveGlobalStatus.h */, + A7AFC17715F7EFE30048F57B /* ResolveOperation.h */, 1429D8830ED21C3D00B89619 /* SamplingTool.cpp */, 1429D8840ED21C3D00B89619 /* SamplingTool.h */, 0F5541AF1613C1FB00CE3E25 /* SpecialPointer.cpp */, @@ -2574,6 +2566,7 @@ 0FD82E84141F3FDA00179C94 /* SpeculatedType.cpp */, 0FD82E4F141DAEA100179C94 /* SpeculatedType.h */, 0F93329B14CA7DC10085F3C6 /* StructureSet.h */, + 0F93329514CA7DC10085F3C6 /* GetByIdStatus.cpp */, 0F766D3615AE4A1A008F363E /* StructureStubClearingWatchpoint.cpp */, 0F766D3715AE4A1A008F363E /* StructureStubClearingWatchpoint.h */, BCCF0D0B0EF0B8A500413C8F /* StructureStubInfo.cpp */, @@ -2583,6 +2576,12 @@ 0F426A461460CBAB00131F8F /* VirtualRegister.h */, 0F919D2215853CDE004A4E7D /* Watchpoint.cpp */, 0F919D2315853CDE004A4E7D /* Watchpoint.h */, + 0F93329614CA7DC10085F3C6 /* GetByIdStatus.h */, + 0F93329914CA7DC10085F3C6 /* PutByIdStatus.cpp */, + 0F93329A14CA7DC10085F3C6 /* PutByIdStatus.h */, + 0F93329B14CA7DC10085F3C6 /* StructureSet.h */, + A79E781E15EECBA80047C855 /* UnlinkedCodeBlock.cpp */, + A79E781F15EECBA80047C855 /* UnlinkedCodeBlock.h */, ); path = bytecode; sourceTree = ""; @@ -2615,6 +2614,7 @@ 86ADD1450FDDEA980006EEC2 /* ARMv7Assembler.h in Headers */, C2EAD2FC14F0249800A4B159 /* CopiedAllocator.h in Headers */, C2B916C214DA014E00CBAC86 /* MarkedAllocator.h in Headers */, + FE4A332015BD2E07006F54F3 /* VMInspector.h in Headers */, C2239D1816262BDD005AC5FD /* CopyVisitor.h in Headers */, C2239D1916262BDD005AC5FD /* CopyVisitorInlineMethods.h in Headers */, C24D31E3161CD695002AA4DB /* HeapStatistics.h in Headers */, @@ -2900,7 +2900,6 @@ 0F0B83AB14BCF5BB00885B4F /* ExpressionRangeInfo.h in Headers */, 0F0B83AD14BCF60400885B4F /* LineInfo.h in Headers */, 0F0B83B114BCF71800885B4F /* CallLinkInfo.h in Headers */, - 0F0B83B514BCF86200885B4F /* MethodCallLinkInfo.h in Headers */, 0F0B83B914BCF95F00885B4F /* CallReturnOffsetToBytecodeOffset.h in Headers */, 0F0FC45A14BD15F500B81154 /* LLIntCallLinkInfo.h in Headers */, 0F21C26814BE5F6800ADC64B /* JITDriver.h in Headers */, @@ -2914,7 +2913,6 @@ 0F7B294D14C3CD4C007C3DB1 /* DFGCommon.h in Headers */, 0F93329E14CA7DC50085F3C6 /* CallLinkStatus.h in Headers */, 0F9332A014CA7DCD0085F3C6 /* GetByIdStatus.h in Headers */, - 0F9332A214CA7DD30085F3C6 /* MethodCallLinkStatus.h in Headers */, 0F9332A414CA7DD90085F3C6 /* PutByIdStatus.h in Headers */, 0F9332A514CA7DDD0085F3C6 /* StructureSet.h in Headers */, 0F55F0F514D1063C00AC7649 /* AbstractPC.h in Headers */, @@ -2984,7 +2982,6 @@ 0F766D3915AE4A1F008F363E /* StructureStubClearingWatchpoint.h in Headers */, 0F766D4415B2A3C0008F363E /* DFGRegisterSet.h in Headers */, 0F766D4615B3701F008F363E /* DFGScratchRegisterAllocator.h in Headers */, - FE4A332015BD2E07006F54F3 /* VMInspector.h in Headers */, 0F63943F15C75F19006A597C /* DFGStructureCheckHoistingPhase.h in Headers */, 0F63945515D07057006A597C /* ArrayProfile.h in Headers */, 0F63948515E4811B006A597C /* DFGArrayMode.h in Headers */, @@ -3009,8 +3006,11 @@ 862553D216136E1A009F17D0 /* JSProxy.h in Headers */, 0F5541B21613C1FB00CE3E25 /* SpecialPointer.h in Headers */, 0FEB3ECD16237F4D00AB67AD /* TypedArrayDescriptor.h in Headers */, - 0F256C361627B0AD007F2783 /* DFGCallArrayAllocatorSlowPathGenerator.h in Headers */, + 0F256C361627B0AD007F2783 /* DFGCallArrayAllocatorSlowPathGenerator.h in Headers */, C2239D1B16262BDD005AC5FD /* GCThread.h in Headers */, + A7B601821639FD2A00372BA3 /* UnlinkedCodeBlock.h in Headers */, + A77F1822164088B200640A47 /* CodeCache.h in Headers */, + A77F1825164192C700640A47 /* ParserModes.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -3096,8 +3096,6 @@ 932F5B3F0822A1C700736975 /* Headers */, 932F5B910822A1C700736975 /* Sources */, 932F5BD20822A1C700736975 /* Frameworks */, - 9319586B09D9F91A00A56FD4 /* Check For Global Initializers */, - 933457200EBFDC3F00B80894 /* Check For Exit Time Destructors */, 5D29D8BE0E9860B400C3D2D0 /* Check For Weak VTables and Externals */, 3713F014142905240036387F /* Check For Inappropriate Objective-C Class Names */, ); @@ -3292,36 +3290,6 @@ shellPath = /bin/sh; shellScript = "mkdir -p \"${BUILT_PRODUCTS_DIR}/DerivedSources/JavaScriptCore/docs\"\ncd \"${BUILT_PRODUCTS_DIR}/DerivedSources/JavaScriptCore\"\n\n/bin/ln -sfh \"${SRCROOT}\" JavaScriptCore\nexport JavaScriptCore=\"JavaScriptCore\"\nexport BUILT_PRODUCTS_DIR=\"../..\"\n\nmake --no-builtin-rules -f \"JavaScriptCore/DerivedSources.make\" -j `/usr/sbin/sysctl -n hw.ncpu` || exit 1\n\n/usr/bin/env ruby JavaScriptCore/offlineasm/asm.rb JavaScriptCore/llint/LowLevelInterpreter.asm ${BUILT_PRODUCTS_DIR}/JSCLLIntOffsetsExtractor LLIntAssembly.h || exit 1\n"; }; - 9319586B09D9F91A00A56FD4 /* Check For Global Initializers */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "$(TARGET_BUILD_DIR)/$(EXECUTABLE_PATH)", - ); - name = "Check For Global Initializers"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "if [ \"${TARGET_GCC_VERSION}\" = \"LLVM_COMPILER\" ]; then\n exit 0;\nfi\n\nif [ -f ../../Tools/Scripts/check-for-global-initializers ]; then\n ../../Tools/Scripts/check-for-global-initializers || exit $?\nfi"; - }; - 933457200EBFDC3F00B80894 /* Check For Exit Time Destructors */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "$(TARGET_BUILD_DIR)/$(EXECUTABLE_PATH)", - ); - name = "Check For Exit Time Destructors"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "if [ \"${TARGET_GCC_VERSION}\" = \"LLVM_COMPILER\" ]; then\n exit 0;\nfi\n\nif [ -f ../../Tools/Scripts/check-for-exit-time-destructors ]; then\n ../../Tools/Scripts/check-for-exit-time-destructors || exit $?\nfi"; - }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -3541,10 +3509,8 @@ 0F0B839A14BCF45D00885B4F /* LLIntEntrypoints.cpp in Sources */, 0F0B839C14BCF46300885B4F /* LLIntThunks.cpp in Sources */, 0F0B83B014BCF71600885B4F /* CallLinkInfo.cpp in Sources */, - 0F0B83B414BCF86000885B4F /* MethodCallLinkInfo.cpp in Sources */, 0F93329D14CA7DC30085F3C6 /* CallLinkStatus.cpp in Sources */, 0F93329F14CA7DCA0085F3C6 /* GetByIdStatus.cpp in Sources */, - 0F9332A114CA7DD10085F3C6 /* MethodCallLinkStatus.cpp in Sources */, 0F9332A314CA7DD70085F3C6 /* PutByIdStatus.cpp in Sources */, 0F55F0F414D1063900AC7649 /* AbstractPC.cpp in Sources */, 86B5826714D2796C00A9C306 /* CodeProfile.cpp in Sources */, @@ -3621,6 +3587,8 @@ C24D31E2161CD695002AA4DB /* HeapStatistics.cpp in Sources */, C2239D1716262BDD005AC5FD /* CopyVisitor.cpp in Sources */, C2239D1A16262BDD005AC5FD /* GCThread.cpp in Sources */, + A76F279415F13C9600517D67 /* UnlinkedCodeBlock.cpp in Sources */, + A77F1821164088B200640A47 /* CodeCache.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Source/JavaScriptCore/LLIntOffsetsExtractor.pro b/Source/JavaScriptCore/LLIntOffsetsExtractor.pro index 1fc6c1d7c..ae635c1b5 100644 --- a/Source/JavaScriptCore/LLIntOffsetsExtractor.pro +++ b/Source/JavaScriptCore/LLIntOffsetsExtractor.pro @@ -22,18 +22,14 @@ LIBS = defineTest(addIncludePaths) { # Just needed for include paths - include(../WTF/WTF.pri) include(JavaScriptCore.pri) + include(../WTF/WTF.pri) export(INCLUDEPATH) } addIncludePaths() -# To make sure we include JavaScriptCore/config.h and not -# the WTF one. -INCLUDEPATH = $$PWD $$INCLUDEPATH - LLINT_DEPENDENCY = \ $$PWD/llint/LowLevelInterpreter.asm \ $$PWD/llint/LowLevelInterpreter32_64.asm \ diff --git a/Source/JavaScriptCore/Target.pri b/Source/JavaScriptCore/Target.pri index ffd295a41..b0fcc16e7 100644 --- a/Source/JavaScriptCore/Target.pri +++ b/Source/JavaScriptCore/Target.pri @@ -30,8 +30,7 @@ include(yarr/yarr.pri) INSTALLDEPS += all -CONFIG(debug, debug|release): INCLUDEPATH += $$JAVASCRIPTCORE_GENERATED_SOURCES_DIR\debug -CONFIG(release, debug|release): INCLUDEPATH += $$JAVASCRIPTCORE_GENERATED_SOURCES_DIR\release +debug_and_release: INCLUDEPATH += $$JAVASCRIPTCORE_GENERATED_SOURCES_DIR/$$activeBuildConfig() SOURCES += \ API/JSBase.cpp \ @@ -60,8 +59,6 @@ SOURCES += \ bytecode/GetByIdStatus.cpp \ bytecode/JumpTable.cpp \ bytecode/LazyOperandValueProfile.cpp \ - bytecode/MethodCallLinkInfo.cpp \ - bytecode/MethodCallLinkStatus.cpp \ bytecode/MethodOfGettingAValueProfile.cpp \ bytecode/Opcode.cpp \ bytecode/PolymorphicPutByIdList.cpp \ @@ -72,6 +69,7 @@ SOURCES += \ bytecode/SpeculatedType.cpp \ bytecode/StructureStubClearingWatchpoint.cpp \ bytecode/StructureStubInfo.cpp \ + bytecode/UnlinkedCodeBlock.cpp \ bytecode/Watchpoint.cpp \ bytecompiler/BytecodeGenerator.cpp \ bytecompiler/NodesCodegen.cpp \ @@ -187,6 +185,7 @@ SOURCES += \ runtime/BooleanObject.cpp \ runtime/BooleanPrototype.cpp \ runtime/CallData.cpp \ + runtime/CodeCache.cpp \ runtime/CommonIdentifiers.cpp \ runtime/Completion.cpp \ runtime/ConstructData.cpp \ @@ -276,6 +275,18 @@ SOURCES += \ tools/CodeProfiling.cpp \ yarr/YarrJIT.cpp \ +linux-*:if(isEqual(QT_ARCH, "i386")|isEqual(QT_ARCH, "x86_64")) { + SOURCES += \ + disassembler/UDis86Disassembler.cpp \ + disassembler/udis86/udis86.c \ + disassembler/udis86/udis86_decode.c \ + disassembler/udis86/udis86_input.c \ + disassembler/udis86/udis86_itab_holder.c \ + disassembler/udis86/udis86_syn-att.c \ + disassembler/udis86/udis86_syn-intel.c \ + disassembler/udis86/udis86_syn.c \ +} + HEADERS += $$files(*.h, true) *sh4* { diff --git a/Source/JavaScriptCore/bytecode/ArrayProfile.cpp b/Source/JavaScriptCore/bytecode/ArrayProfile.cpp index de7f67887..5a87380fd 100644 --- a/Source/JavaScriptCore/bytecode/ArrayProfile.cpp +++ b/Source/JavaScriptCore/bytecode/ArrayProfile.cpp @@ -26,6 +26,7 @@ #include "config.h" #include "ArrayProfile.h" +#include "CodeBlock.h" #include namespace JSC { @@ -38,14 +39,14 @@ const char* arrayModesToString(ArrayModes arrayModes) if (arrayModes == ALL_ARRAY_MODES) return "TOP"; - bool isNonArray = !!(arrayModes & NonArray); - bool isNonArrayWithContiguous = !!(arrayModes & NonArrayWithContiguous); - bool isNonArrayWithArrayStorage = !!(arrayModes & NonArrayWithArrayStorage); - bool isNonArrayWithSlowPutArrayStorage = !!(arrayModes & NonArrayWithSlowPutArrayStorage); - bool isArray = !!(arrayModes & ArrayClass); - bool isArrayWithContiguous = !!(arrayModes & ArrayWithContiguous); - bool isArrayWithArrayStorage = !!(arrayModes & ArrayWithArrayStorage); - bool isArrayWithSlowPutArrayStorage = !!(arrayModes & ArrayWithSlowPutArrayStorage); + bool isNonArray = !!(arrayModes & asArrayModes(NonArray)); + bool isNonArrayWithContiguous = !!(arrayModes & asArrayModes(NonArrayWithContiguous)); + bool isNonArrayWithArrayStorage = !!(arrayModes & asArrayModes(NonArrayWithArrayStorage)); + bool isNonArrayWithSlowPutArrayStorage = !!(arrayModes & asArrayModes(NonArrayWithSlowPutArrayStorage)); + bool isArray = !!(arrayModes & asArrayModes(ArrayClass)); + bool isArrayWithContiguous = !!(arrayModes & asArrayModes(ArrayWithContiguous)); + bool isArrayWithArrayStorage = !!(arrayModes & asArrayModes(ArrayWithArrayStorage)); + bool isArrayWithSlowPutArrayStorage = !!(arrayModes & asArrayModes(ArrayWithSlowPutArrayStorage)); static char result[256]; snprintf( @@ -64,12 +65,14 @@ const char* arrayModesToString(ArrayModes arrayModes) return result; } -void ArrayProfile::computeUpdatedPrediction(OperationInProgress operation) +void ArrayProfile::computeUpdatedPrediction(CodeBlock* codeBlock, OperationInProgress operation) { if (m_lastSeenStructure) { m_observedArrayModes |= arrayModeFromStructure(m_lastSeenStructure); m_mayInterceptIndexedAccesses |= m_lastSeenStructure->typeInfo().interceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero(); + if (!codeBlock->globalObject()->isOriginalArrayStructure(m_lastSeenStructure)) + m_usesOriginalArrayStructures = false; if (!m_structureIsPolymorphic) { if (!m_expectedStructure) m_expectedStructure = m_lastSeenStructure; diff --git a/Source/JavaScriptCore/bytecode/ArrayProfile.h b/Source/JavaScriptCore/bytecode/ArrayProfile.h index ffc136258..376684fc1 100644 --- a/Source/JavaScriptCore/bytecode/ArrayProfile.h +++ b/Source/JavaScriptCore/bytecode/ArrayProfile.h @@ -33,6 +33,7 @@ namespace JSC { +class CodeBlock; class LLIntOffsetsExtractor; // This is a bitfield where each bit represents an IndexingType that we have seen. @@ -87,6 +88,7 @@ public: , m_structureIsPolymorphic(false) , m_mayStoreToHole(false) , m_mayInterceptIndexedAccesses(false) + , m_usesOriginalArrayStructures(true) , m_observedArrayModes(0) { } @@ -98,6 +100,7 @@ public: , m_structureIsPolymorphic(false) , m_mayStoreToHole(false) , m_mayInterceptIndexedAccesses(false) + , m_usesOriginalArrayStructures(true) , m_observedArrayModes(0) { } @@ -113,7 +116,7 @@ public: m_lastSeenStructure = structure; } - void computeUpdatedPrediction(OperationInProgress operation = NoOperation); + void computeUpdatedPrediction(CodeBlock*, OperationInProgress = NoOperation); Structure* expectedStructure() const { return m_expectedStructure; } bool structureIsPolymorphic() const @@ -129,6 +132,8 @@ public: bool mayStoreToHole() const { return m_mayStoreToHole; } + bool usesOriginalArrayStructures() const { return m_usesOriginalArrayStructures; } + private: friend class LLIntOffsetsExtractor; @@ -138,6 +143,7 @@ private: bool m_structureIsPolymorphic; bool m_mayStoreToHole; // This flag may become overloaded to indicate other special cases that were encountered during array access, as it depends on indexing type. Since we currently have basically just one indexing type (two variants of ArrayStorage), this flag for now just means exactly what its name implies. bool m_mayInterceptIndexedAccesses; + bool m_usesOriginalArrayStructures; ArrayModes m_observedArrayModes; }; diff --git a/Source/JavaScriptCore/bytecode/CodeBlock.cpp b/Source/JavaScriptCore/bytecode/CodeBlock.cpp index 7f86186a0..ceae3fcb2 100644 --- a/Source/JavaScriptCore/bytecode/CodeBlock.cpp +++ b/Source/JavaScriptCore/bytecode/CodeBlock.cpp @@ -43,7 +43,6 @@ #include "JSNameScope.h" #include "JSValue.h" #include "LowLevelInterpreter.h" -#include "MethodCallLinkStatus.h" #include "RepatchBuffer.h" #include "SlotVisitorInlineMethods.h" #include @@ -283,9 +282,6 @@ void CodeBlock::printGetByIdCacheStatus(ExecState* exec, int location) { Instruction* instruction = instructions().begin() + location; - if (exec->interpreter()->getOpcodeID(instruction[0].u.opcode) == op_method_check) - instruction++; - Identifier& ident = identifier(instruction[3].u.operand); UNUSED_PARAM(ident); // tell the compiler to shut up in certain platform configurations. @@ -496,8 +492,8 @@ void CodeBlock::dump(ExecState* exec) static_cast(instructions().size() * sizeof(Instruction)), this, codeTypeToString(codeType()), m_numParameters, m_numCalleeRegisters, m_numVars); - if (m_symbolTable->captureCount()) - dataLog("; %d captured var(s)", m_symbolTable->captureCount()); + if (symbolTable()->captureCount()) + dataLog("; %d captured var(s)", symbolTable()->captureCount()); if (usesArguments()) { dataLog( "; uses arguments, in r%d, r%d", @@ -531,13 +527,13 @@ void CodeBlock::dump(ExecState* exec) } while (i < m_constantRegisters.size()); } - if (m_rareData && !m_rareData->m_regexps.isEmpty()) { + if (size_t count = m_unlinkedCode->numberOfRegExps()) { dataLog("\nm_regexps:\n"); size_t i = 0; do { - dataLog(" re%u = %s\n", static_cast(i), regexpToSourceString(m_rareData->m_regexps[i].get()).utf8().data()); + dataLog(" re%u = %s\n", static_cast(i), regexpToSourceString(m_unlinkedCode->regexp(i)).utf8().data()); ++i; - } while (i < m_rareData->m_regexps.size()); + } while (i < count); } #if ENABLE(JIT) @@ -671,7 +667,7 @@ void CodeBlock::dump(ExecState* exec, const Vector::const_iterator& int dst = (++it)->u.operand; int argv = (++it)->u.operand; int argc = (++it)->u.operand; - dataLog("[%4d] new_array_buffer %s, %d, %d", location, registerName(exec, dst).data(), argv, argc); + dataLog("[%4d] new_array_buffer\t %s, %d, %d", location, registerName(exec, dst).data(), argv, argc); dumpBytecodeCommentAndNewLine(location); break; } @@ -679,7 +675,7 @@ void CodeBlock::dump(ExecState* exec, const Vector::const_iterator& int r0 = (++it)->u.operand; int re0 = (++it)->u.operand; dataLog("[%4d] new_regexp\t %s, ", location, registerName(exec, r0).data()); - if (r0 >=0 && r0 < (int)numberOfRegExps()) + if (r0 >=0 && r0 < (int)m_unlinkedCode->numberOfRegExps()) dataLog("%s", regexpName(re0, regexp(re0)).data()); else dataLog("bad_regexp(%d)", re0); @@ -889,11 +885,22 @@ void CodeBlock::dump(ExecState* exec, const Vector::const_iterator& it++; break; } + case op_init_global_const_nop: { + dataLog("[%4d] init_global_const_nop\t", location); + dumpBytecodeCommentAndNewLine(location); + it++; + it++; + it++; + it++; + break; + } case op_init_global_const: { WriteBarrier* registerPointer = (++it)->u.registerPointer; int r0 = (++it)->u.operand; dataLog("[%4d] init_global_const\t g%d(%p), %s", location, m_globalObject->findRegisterIndex(registerPointer), registerPointer, registerName(exec, r0).data()); dumpBytecodeCommentAndNewLine(location); + it++; + it++; break; } case op_init_global_const_check: { @@ -1017,42 +1024,6 @@ void CodeBlock::dump(ExecState* exec, const Vector::const_iterator& dumpBytecodeCommentAndNewLine(location); break; } - case op_method_check: { - dataLog("[%4d] method_check", location); -#if ENABLE(JIT) - if (numberOfMethodCallLinkInfos()) { - MethodCallLinkInfo& methodCall = getMethodCallLinkInfo(location); - dataLog(" jit("); - if (!methodCall.seen) - dataLog("not seen"); - else { - // Use the fact that MethodCallLinkStatus already does smart things - // for decoding seen method calls. - MethodCallLinkStatus status = MethodCallLinkStatus::computeFor(this, location); - if (!status) - dataLog("not set"); - else { - dataLog("function = %p (executable = ", status.function()); - JSCell* functionAsCell = getJSFunction(status.function()); - if (functionAsCell) - dataLog("%p", jsCast(functionAsCell)->executable()); - else - dataLog("N/A"); - dataLog("), struct = %p", status.structure()); - if (status.needsPrototypeCheck()) - dataLog(", prototype = %p, struct = %p", status.prototype(), status.prototypeStructure()); - } - } - dataLog(")"); - } -#endif - dumpBytecodeCommentAndNewLine(location); - ++it; - printGetByIdOp(exec, location, it); - printGetByIdCacheStatus(exec, location); - dataLog("\n"); - break; - } case op_del_by_id: { int r0 = (++it)->u.operand; int r1 = (++it)->u.operand; @@ -1431,9 +1402,10 @@ void CodeBlock::dump(ExecState* exec, const Vector::const_iterator& dumpBytecodeCommentAndNewLine(location); break; } - case op_throw_reference_error: { + case op_throw_static_error: { int k0 = (++it)->u.operand; - dataLog("[%4d] throw_reference_error\t %s", location, constantName(exec, k0, getConstant(k0)).data()); + int k1 = (++it)->u.operand; + dataLog("[%4d] throw_static_error\t %s, %s", location, constantName(exec, k0, getConstant(k0)).data(), k1 ? "true" : "false"); dumpBytecodeCommentAndNewLine(location); break; } @@ -1531,9 +1503,9 @@ void CodeBlock::dumpStatistics() FOR_EACH_MEMBER_VECTOR(GET_STATS) #undef GET_STATS - if (!codeBlock->m_symbolTable.isEmpty()) { + if (codeBlock->symbolTable() && !codeBlock->symbolTable()->isEmpty()) { symbolTableIsNotEmpty++; - symbolTableTotalSize += (codeBlock->m_symbolTable.capacity() * (sizeof(SymbolTable::KeyType) + sizeof(SymbolTable::MappedType))); + symbolTableTotalSize += (codeBlock->symbolTable()->capacity() * (sizeof(SymbolTable::KeyType) + sizeof(SymbolTable::MappedType))); } if (codeBlock->m_rareData) { @@ -1601,34 +1573,26 @@ CodeBlock::CodeBlock(CopyParsedBlockTag, CodeBlock& other) , m_numCalleeRegisters(other.m_numCalleeRegisters) , m_numVars(other.m_numVars) , m_isConstructor(other.m_isConstructor) + , m_unlinkedCode(*other.m_globalData, other.m_ownerExecutable.get(), other.m_unlinkedCode.get()) , m_ownerExecutable(*other.m_globalData, other.m_ownerExecutable.get(), other.m_ownerExecutable.get()) , m_globalData(other.m_globalData) , m_instructions(other.m_instructions) , m_thisRegister(other.m_thisRegister) , m_argumentsRegister(other.m_argumentsRegister) , m_activationRegister(other.m_activationRegister) - , m_globalObjectConstant(other.m_globalObjectConstant) - , m_needsFullScopeChain(other.m_needsFullScopeChain) - , m_usesEval(other.m_usesEval) - , m_isNumericCompareFunction(other.m_isNumericCompareFunction) , m_isStrictMode(other.m_isStrictMode) - , m_codeType(other.m_codeType) , m_source(other.m_source) , m_sourceOffset(other.m_sourceOffset) #if ENABLE(VALUE_PROFILER) , m_executionEntryCount(0) #endif - , m_jumpTargets(other.m_jumpTargets) - , m_loopTargets(other.m_loopTargets) , m_identifiers(other.m_identifiers) , m_constantRegisters(other.m_constantRegisters) , m_functionDecls(other.m_functionDecls) , m_functionExprs(other.m_functionExprs) - , m_symbolTable(*other.m_globalData, other.m_ownerExecutable.get(), other.symbolTable()) , m_osrExitCounter(0) , m_optimizationDelayCounter(0) , m_reoptimizationRetryCounter(0) - , m_lineInfo(other.m_lineInfo) , m_resolveOperations(other.m_resolveOperations) , m_putToBaseOperations(other.m_putToBaseOperations) #if ENABLE(BYTECODE_COMMENTS) @@ -1646,36 +1610,31 @@ CodeBlock::CodeBlock(CopyParsedBlockTag, CodeBlock& other) createRareDataIfNecessary(); m_rareData->m_exceptionHandlers = other.m_rareData->m_exceptionHandlers; - m_rareData->m_regexps = other.m_rareData->m_regexps; m_rareData->m_constantBuffers = other.m_rareData->m_constantBuffers; m_rareData->m_immediateSwitchJumpTables = other.m_rareData->m_immediateSwitchJumpTables; m_rareData->m_characterSwitchJumpTables = other.m_rareData->m_characterSwitchJumpTables; m_rareData->m_stringSwitchJumpTables = other.m_rareData->m_stringSwitchJumpTables; - m_rareData->m_expressionInfo = other.m_rareData->m_expressionInfo; } } -CodeBlock::CodeBlock(ScriptExecutable* ownerExecutable, CodeType codeType, JSGlobalObject *globalObject, PassRefPtr sourceProvider, unsigned sourceOffset, bool isConstructor, PassOwnPtr alternative) +CodeBlock::CodeBlock(ScriptExecutable* ownerExecutable, UnlinkedCodeBlock* unlinkedCodeBlock, JSGlobalObject* globalObject, unsigned baseScopeDepth, PassRefPtr sourceProvider, unsigned sourceOffset, PassOwnPtr alternative) : m_globalObject(globalObject->globalData(), ownerExecutable, globalObject) , m_heap(&m_globalObject->globalData().heap) - , m_numCalleeRegisters(0) - , m_numVars(0) - , m_isConstructor(isConstructor) - , m_numParameters(0) + , m_numCalleeRegisters(unlinkedCodeBlock->m_numCalleeRegisters) + , m_numVars(unlinkedCodeBlock->m_numVars) + , m_isConstructor(unlinkedCodeBlock->isConstructor()) + , m_unlinkedCode(globalObject->globalData(), ownerExecutable, unlinkedCodeBlock) , m_ownerExecutable(globalObject->globalData(), ownerExecutable, ownerExecutable) - , m_globalData(0) - , m_argumentsRegister(-1) - , m_needsFullScopeChain(ownerExecutable->needsActivation()) - , m_usesEval(ownerExecutable->usesEval()) - , m_isNumericCompareFunction(false) - , m_isStrictMode(ownerExecutable->isStrictMode()) - , m_codeType(codeType) + , m_globalData(unlinkedCodeBlock->globalData()) + , m_thisRegister(unlinkedCodeBlock->thisRegister()) + , m_argumentsRegister(unlinkedCodeBlock->argumentsRegister()) + , m_activationRegister(unlinkedCodeBlock->activationRegister()) + , m_isStrictMode(unlinkedCodeBlock->isStrictMode()) , m_source(sourceProvider) , m_sourceOffset(sourceOffset) #if ENABLE(VALUE_PROFILER) , m_executionEntryCount(0) #endif - , m_symbolTable(globalObject->globalData(), ownerExecutable, SharedSymbolTable::create(globalObject->globalData())) , m_alternative(alternative) , m_osrExitCounter(0) , m_optimizationDelayCounter(0) @@ -1684,7 +1643,10 @@ CodeBlock::CodeBlock(ScriptExecutable* ownerExecutable, CodeType codeType, JSGlo , m_bytecodeCommentIterator(0) #endif { + m_globalData->startedCompiling(this); + ASSERT(m_source); + setNumParameters(unlinkedCodeBlock->numParameters()); optimizeAfterWarmUp(); jitAfterWarmUp(); @@ -1692,9 +1654,208 @@ CodeBlock::CodeBlock(ScriptExecutable* ownerExecutable, CodeType codeType, JSGlo #if DUMP_CODE_BLOCK_STATISTICS liveCodeBlockSet.add(this); #endif - // We have a stub putToBase operation to allow resolve_base to - // remain branchless - m_putToBaseOperations.append(PutToBaseOperation(isStrictMode())); + setIdentifiers(unlinkedCodeBlock->identifiers()); + setConstantRegisters(unlinkedCodeBlock->constantRegisters()); + + m_functionDecls.grow(unlinkedCodeBlock->numberOfFunctionDecls()); + for (size_t count = unlinkedCodeBlock->numberOfFunctionDecls(), i = 0; i < count; ++i) { + UnlinkedFunctionExecutable* unlinkedExecutable = unlinkedCodeBlock->functionDecl(i); + unsigned lineCount = unlinkedExecutable->lineCount(); + unsigned firstLine = ownerExecutable->lineNo() + unlinkedExecutable->firstLineOffset(); + unsigned startOffset = sourceOffset + unlinkedExecutable->startOffset(); + unsigned sourceLength = unlinkedExecutable->sourceLength(); + SourceCode code(m_source, startOffset, startOffset + sourceLength, firstLine); + FunctionExecutable* executable = FunctionExecutable::create(*m_globalData, code, unlinkedExecutable, firstLine, firstLine + lineCount); + m_functionDecls[i].set(*m_globalData, ownerExecutable, executable); + } + + m_functionExprs.grow(unlinkedCodeBlock->numberOfFunctionExprs()); + for (size_t count = unlinkedCodeBlock->numberOfFunctionExprs(), i = 0; i < count; ++i) { + UnlinkedFunctionExecutable* unlinkedExecutable = unlinkedCodeBlock->functionExpr(i); + unsigned lineCount = unlinkedExecutable->lineCount(); + unsigned firstLine = ownerExecutable->lineNo() + unlinkedExecutable->firstLineOffset(); + unsigned startOffset = sourceOffset + unlinkedExecutable->startOffset(); + unsigned sourceLength = unlinkedExecutable->sourceLength(); + SourceCode code(m_source, startOffset, startOffset + sourceLength, firstLine); + FunctionExecutable* executable = FunctionExecutable::create(*m_globalData, code, unlinkedExecutable, firstLine, firstLine + lineCount); + m_functionExprs[i].set(*m_globalData, ownerExecutable, executable); + } + + if (unlinkedCodeBlock->hasRareData()) { + createRareDataIfNecessary(); + if (size_t count = unlinkedCodeBlock->constantBufferCount()) { + m_rareData->m_constantBuffers.grow(count); + for (size_t i = 0; i < count; i++) { + const UnlinkedCodeBlock::ConstantBuffer& buffer = unlinkedCodeBlock->constantBuffer(i); + m_rareData->m_constantBuffers[i] = buffer; + } + } + if (size_t count = unlinkedCodeBlock->numberOfExceptionHandlers()) { + m_rareData->m_exceptionHandlers.grow(count); + for (size_t i = 0; i < count; i++) { + const UnlinkedHandlerInfo& handler = unlinkedCodeBlock->exceptionHandler(i); + m_rareData->m_exceptionHandlers[i].start = handler.start; + m_rareData->m_exceptionHandlers[i].end = handler.end; + m_rareData->m_exceptionHandlers[i].target = handler.target; + m_rareData->m_exceptionHandlers[i].scopeDepth = handler.scopeDepth + baseScopeDepth; +#if ENABLE(JIT) && ENABLE(LLINT) + m_rareData->m_exceptionHandlers[i].nativeCode = CodeLocationLabel(MacroAssemblerCodePtr::createFromExecutableAddress(LLInt::getCodePtr(llint_op_catch))); +#endif + } + } + + if (size_t count = unlinkedCodeBlock->numberOfStringSwitchJumpTables()) { + m_rareData->m_stringSwitchJumpTables.grow(count); + for (size_t i = 0; i < count; i++) { + UnlinkedStringJumpTable::StringOffsetTable::iterator ptr = unlinkedCodeBlock->stringSwitchJumpTable(i).offsetTable.begin(); + UnlinkedStringJumpTable::StringOffsetTable::iterator end = unlinkedCodeBlock->stringSwitchJumpTable(i).offsetTable.end(); + for (; ptr != end; ++ptr) { + OffsetLocation offset; + offset.branchOffset = ptr->value; + m_rareData->m_stringSwitchJumpTables[i].offsetTable.add(ptr->key, offset); + } + } + } + + if (size_t count = unlinkedCodeBlock->numberOfImmediateSwitchJumpTables()) { + m_rareData->m_immediateSwitchJumpTables.grow(count); + for (size_t i = 0; i < count; i++) { + UnlinkedSimpleJumpTable& sourceTable = unlinkedCodeBlock->immediateSwitchJumpTable(i); + SimpleJumpTable& destTable = m_rareData->m_immediateSwitchJumpTables[i]; + destTable.branchOffsets = sourceTable.branchOffsets; + destTable.min = sourceTable.min; + } + } + + if (size_t count = unlinkedCodeBlock->numberOfCharacterSwitchJumpTables()) { + m_rareData->m_characterSwitchJumpTables.grow(count); + for (size_t i = 0; i < count; i++) { + UnlinkedSimpleJumpTable& sourceTable = unlinkedCodeBlock->characterSwitchJumpTable(i); + SimpleJumpTable& destTable = m_rareData->m_characterSwitchJumpTables[i]; + destTable.branchOffsets = sourceTable.branchOffsets; + destTable.min = sourceTable.min; + } + } + } + + // Allocate metadata buffers for the bytecode +#if ENABLE(LLINT) + if (size_t size = unlinkedCodeBlock->numberOfLLintCallLinkInfos()) + m_llintCallLinkInfos.grow(size); +#endif +#if ENABLE(DFG_JIT) + if (size_t size = unlinkedCodeBlock->numberOfArrayProfiles()) + m_arrayProfiles.grow(size); + if (size_t size = unlinkedCodeBlock->numberOfValueProfiles()) + m_valueProfiles.grow(size); +#endif + if (size_t size = unlinkedCodeBlock->numberOfResolveOperations()) + m_resolveOperations.grow(size); + size_t putToBaseCount = unlinkedCodeBlock->numberOfPutToBaseOperations(); + m_putToBaseOperations.reserveCapacity(putToBaseCount); + for (size_t i = 0; i < putToBaseCount; ++i) + m_putToBaseOperations.append(PutToBaseOperation(isStrictMode())); + + ASSERT(m_putToBaseOperations.capacity() == putToBaseCount); + + // Copy and translate the UnlinkedInstructions + size_t instructionCount = unlinkedCodeBlock->instructions().size(); + UnlinkedInstruction* pc = unlinkedCodeBlock->instructions().data(); + Vector instructions(instructionCount); + for (size_t i = 0; i < unlinkedCodeBlock->instructions().size(); ) { + unsigned opLength = opcodeLength(pc[i].u.opcode); + instructions[i] = globalData()->interpreter->getOpcode(pc[i].u.opcode); + for (size_t j = 1; j < opLength; ++j) { + if (sizeof(int32_t) != sizeof(intptr_t)) + instructions[i + j].u.pointer = 0; + instructions[i + j].u.operand = pc[i + j].u.operand; + } + switch (pc[i].u.opcode) { +#if ENABLE(DFG_JIT) + case op_get_by_val: + case op_get_argument_by_val: { + int arrayProfileIndex = pc[i + opLength - 2].u.operand; + m_arrayProfiles[arrayProfileIndex] = ArrayProfile(i); + + instructions[i + opLength - 2] = &m_arrayProfiles[arrayProfileIndex]; + // fallthrough + } + case op_convert_this: + case op_resolve: + case op_resolve_base: + case op_resolve_with_base: + case op_resolve_with_this: + case op_get_by_id: + case op_call_put_result: { + ValueProfile* profile = &m_valueProfiles[pc[i + opLength - 1].u.operand]; + ASSERT(profile->m_bytecodeOffset == -1); + profile->m_bytecodeOffset = i; + instructions[i + opLength - 1] = profile; + break; + } + case op_put_by_val: { + int arrayProfileIndex = pc[i + opLength - 1].u.operand; + m_arrayProfiles[arrayProfileIndex] = ArrayProfile(i); + instructions[i + opLength - 1] = &m_arrayProfiles[arrayProfileIndex]; + break; + } + + case op_call: + case op_call_eval: { + int arrayProfileIndex = pc[i + opLength - 1].u.operand; + m_arrayProfiles[arrayProfileIndex] = ArrayProfile(i); + instructions[i + opLength - 1] = &m_arrayProfiles[arrayProfileIndex]; + // fallthrough + } +#endif +#if ENABLE(LLINT) + case op_construct: + instructions[i + 4] = &m_llintCallLinkInfos[pc[i + 4].u.operand]; + break; +#endif + case op_get_by_id_out_of_line: + case op_get_by_id_self: + case op_get_by_id_proto: + case op_get_by_id_chain: + case op_get_by_id_getter_self: + case op_get_by_id_getter_proto: + case op_get_by_id_getter_chain: + case op_get_by_id_custom_self: + case op_get_by_id_custom_proto: + case op_get_by_id_custom_chain: + case op_get_by_id_generic: + case op_get_array_length: + case op_get_string_length: + CRASH(); + + case op_init_global_const_nop: { + ASSERT(codeType() == GlobalCode); + Identifier ident = identifier(pc[i + 4].u.operand); + SymbolTableEntry entry = globalObject->symbolTable()->get(ident.impl()); + if (entry.isNull()) + break; + + if (entry.couldBeWatched()) { + instructions[i + 0] = globalData()->interpreter->getOpcode(op_init_global_const_check); + instructions[i + 1] = &globalObject->registerAt(entry.getIndex()); + instructions[i + 3] = entry.addressOfIsWatched(); + break; + } + + instructions[i + 0] = globalData()->interpreter->getOpcode(op_init_global_const); + instructions[i + 1] = &globalObject->registerAt(entry.getIndex()); + break; + } + default: + break; + } + i += opLength; + } + m_instructions = WTF::RefCountedArray(instructions); + + if (BytecodeGenerator::dumpsGeneratedCode()) + dump(m_globalObject->globalExec()); + m_globalData->finishedCompiling(this); } CodeBlock::~CodeBlock() @@ -1745,15 +1906,6 @@ void CodeBlock::setNumParameters(int newValue) #endif } -void CodeBlock::addParameter() -{ - m_numParameters++; - -#if ENABLE(VALUE_PROFILER) - m_argumentValueProfiles.append(ValueProfile()); -#endif -} - void CodeBlock::visitStructures(SlotVisitor& visitor, Instruction* vPC) { Interpreter* interpreter = m_globalData->interpreter; @@ -1836,6 +1988,8 @@ void CodeBlock::visitAggregate(SlotVisitor& visitor) if (!!m_alternative) m_alternative->visitAggregate(visitor); + visitor.append(&m_unlinkedCode); + // There are three things that may use unconditional finalizers: lazy bytecode freeing, // inline cache clearing, and jettisoning. The probability of us wanting to do at // least one of those things is probably quite close to 1. So we add one no matter what @@ -1950,8 +2104,9 @@ void CodeBlock::finalizeUnconditionally() #if ENABLE(LLINT) Interpreter* interpreter = m_globalData->interpreter; if (!!numberOfInstructions()) { - for (size_t size = m_propertyAccessInstructions.size(), i = 0; i < size; ++i) { - Instruction* curInstruction = &instructions()[m_propertyAccessInstructions[i]]; + const Vector& propertyAccessInstructions = m_unlinkedCode->propertyAccessInstructions(); + for (size_t size = propertyAccessInstructions.size(), i = 0; i < size; ++i) { + Instruction* curInstruction = &instructions()[propertyAccessInstructions[i]]; switch (interpreter->getOpcodeID(curInstruction[0].u.opcode)) { case op_get_by_id: case op_get_by_id_out_of_line: @@ -2061,36 +2216,6 @@ void CodeBlock::finalizeUnconditionally() resetStubInternal(repatchBuffer, stubInfo); } - - for (size_t size = m_methodCallLinkInfos.size(), i = 0; i < size; ++i) { - if (!m_methodCallLinkInfos[i].cachedStructure) - continue; - - ASSERT(m_methodCallLinkInfos[i].seenOnce()); - ASSERT(!!m_methodCallLinkInfos[i].cachedPrototypeStructure); - - if (!Heap::isMarked(m_methodCallLinkInfos[i].cachedStructure.get()) - || !Heap::isMarked(m_methodCallLinkInfos[i].cachedPrototypeStructure.get()) - || !Heap::isMarked(m_methodCallLinkInfos[i].cachedFunction.get()) - || !Heap::isMarked(m_methodCallLinkInfos[i].cachedPrototype.get())) { - if (verboseUnlinking) - dataLog("Clearing method call in %p.\n", this); - m_methodCallLinkInfos[i].reset(repatchBuffer, getJITType()); - - StructureStubInfo& stubInfo = getStubInfo(m_methodCallLinkInfos[i].bytecodeIndex); - - AccessType accessType = static_cast(stubInfo.accessType); - - if (accessType != access_unset) { - ASSERT(isGetByIdAccess(accessType)); - if (getJITCode().jitType() == JITCode::DFGJIT) - DFG::dfgResetGetByID(repatchBuffer, stubInfo); - else - JIT::resetPatchGetById(repatchBuffer, &stubInfo); - stubInfo.reset(); - } - } - } } #endif } @@ -2133,14 +2258,9 @@ void CodeBlock::stronglyVisitStrongReferences(SlotVisitor& visitor) { visitor.append(&m_globalObject); visitor.append(&m_ownerExecutable); - visitor.append(&m_symbolTable); - if (m_rareData) { + visitor.append(&m_unlinkedCode); + if (m_rareData) m_rareData->m_evalCodeCache.visitAggregate(visitor); - size_t regExpCount = m_rareData->m_regexps.size(); - WriteBarrier* regexps = m_rareData->m_regexps.data(); - for (size_t i = 0; i < regExpCount; i++) - visitor.append(regexps + i); - } visitor.appendValues(m_constantRegisters.data(), m_constantRegisters.size()); for (size_t i = 0; i < m_functionExprs.size(); ++i) visitor.append(&m_functionExprs[i]); @@ -2267,76 +2387,27 @@ HandlerInfo* CodeBlock::handlerForBytecodeOffset(unsigned bytecodeOffset) int CodeBlock::lineNumberForBytecodeOffset(unsigned bytecodeOffset) { ASSERT(bytecodeOffset < instructions().size()); - - Vector& lineInfo = m_lineInfo; - - int low = 0; - int high = lineInfo.size(); - while (low < high) { - int mid = low + (high - low) / 2; - if (lineInfo[mid].instructionOffset <= bytecodeOffset) - low = mid + 1; - else - high = mid; - } - - if (!low) - return m_ownerExecutable->source().firstLine(); - return lineInfo[low - 1].lineNumber; + return m_ownerExecutable->lineNo() + m_unlinkedCode->lineNumberForBytecodeOffset(bytecodeOffset); } void CodeBlock::expressionRangeForBytecodeOffset(unsigned bytecodeOffset, int& divot, int& startOffset, int& endOffset) { - ASSERT(bytecodeOffset < instructions().size()); - - if (!m_rareData) { - startOffset = 0; - endOffset = 0; - divot = 0; - return; - } - - Vector& expressionInfo = m_rareData->m_expressionInfo; - - int low = 0; - int high = expressionInfo.size(); - while (low < high) { - int mid = low + (high - low) / 2; - if (expressionInfo[mid].instructionOffset <= bytecodeOffset) - low = mid + 1; - else - high = mid; - } - - ASSERT(low); - if (!low) { - startOffset = 0; - endOffset = 0; - divot = 0; - return; - } - - startOffset = expressionInfo[low - 1].startOffset; - endOffset = expressionInfo[low - 1].endOffset; - divot = expressionInfo[low - 1].divotPoint + m_sourceOffset; - return; + m_unlinkedCode->expressionRangeForBytecodeOffset(bytecodeOffset, divot, startOffset, endOffset); + divot += m_sourceOffset; } void CodeBlock::shrinkToFit(ShrinkMode shrinkMode) { - m_propertyAccessInstructions.shrinkToFit(); #if ENABLE(LLINT) m_llintCallLinkInfos.shrinkToFit(); #endif #if ENABLE(JIT) m_structureStubInfos.shrinkToFit(); m_callLinkInfos.shrinkToFit(); - m_methodCallLinkInfos.shrinkToFit(); #endif #if ENABLE(VALUE_PROFILER) if (shrinkMode == EarlyShrink) m_argumentValueProfiles.shrinkToFit(); - m_valueProfiles.shrinkToFit(); m_rareCaseProfiles.shrinkToFit(); m_specialFastCaseProfiles.shrinkToFit(); #endif @@ -2348,15 +2419,11 @@ void CodeBlock::shrinkToFit(ShrinkMode shrinkMode) m_constantRegisters.shrinkToFit(); } // else don't shrink these, because we would have already pointed pointers into these tables. - m_resolveOperations.shrinkToFit(); - m_lineInfo.shrinkToFit(); if (m_rareData) { m_rareData->m_exceptionHandlers.shrinkToFit(); - m_rareData->m_regexps.shrinkToFit(); m_rareData->m_immediateSwitchJumpTables.shrinkToFit(); m_rareData->m_characterSwitchJumpTables.shrinkToFit(); m_rareData->m_stringSwitchJumpTables.shrinkToFit(); - m_rareData->m_expressionInfo.shrinkToFit(); #if ENABLE(JIT) m_rareData->m_callReturnIndexVector.shrinkToFit(); #endif @@ -2384,7 +2451,7 @@ void CodeBlock::createActivation(CallFrame* callFrame) ASSERT(codeType() == FunctionCode); ASSERT(needsFullScopeChain()); ASSERT(!callFrame->uncheckedR(activationRegister()).jsValue()); - JSActivation* activation = JSActivation::create(callFrame->globalData(), callFrame, static_cast(ownerExecutable())); + JSActivation* activation = JSActivation::create(callFrame->globalData(), callFrame, this); callFrame->uncheckedR(activationRegister()) = JSValue(activation); callFrame->setScope(activation); } @@ -2410,7 +2477,7 @@ void CodeBlock::unlinkCalls() m_llintCallLinkInfos[i].unlink(); } #endif - if (!(m_callLinkInfos.size() || m_methodCallLinkInfos.size())) + if (!m_callLinkInfos.size()) return; if (!m_globalData->canUseJIT()) return; @@ -2725,7 +2792,7 @@ void CodeBlock::updateAllPredictionsAndCountLiveness( // site also has a value profile site - so we already know whether or not it's // live. for (unsigned i = m_arrayProfiles.size(); i--;) - m_arrayProfiles[i].computeUpdatedPrediction(operation); + m_arrayProfiles[i].computeUpdatedPrediction(this, operation); } void CodeBlock::updateAllPredictions(OperationInProgress operation) @@ -2879,8 +2946,8 @@ bool CodeBlock::usesOpcode(OpcodeID opcodeID) String CodeBlock::nameForRegister(int registerNumber) { - SymbolTable::iterator end = m_symbolTable->end(); - for (SymbolTable::iterator ptr = m_symbolTable->begin(); ptr != end; ++ptr) { + SymbolTable::iterator end = symbolTable()->end(); + for (SymbolTable::iterator ptr = symbolTable()->begin(); ptr != end; ++ptr) { if (ptr->value.getIndex() == registerNumber) return String(ptr->key); } diff --git a/Source/JavaScriptCore/bytecode/CodeBlock.h b/Source/JavaScriptCore/bytecode/CodeBlock.h index fe588c787..a28064940 100644 --- a/Source/JavaScriptCore/bytecode/CodeBlock.h +++ b/Source/JavaScriptCore/bytecode/CodeBlock.h @@ -50,7 +50,6 @@ #include "ExecutionCounter.h" #include "ExpressionRangeInfo.h" #include "HandlerInfo.h" -#include "MethodCallLinkInfo.h" #include "Options.h" #include "Instruction.h" #include "JITCode.h" @@ -121,7 +120,7 @@ namespace JSC { protected: CodeBlock(CopyParsedBlockTag, CodeBlock& other); - CodeBlock(ScriptExecutable* ownerExecutable, CodeType, JSGlobalObject*, PassRefPtr, unsigned sourceOffset, bool isConstructor, PassOwnPtr alternative); + CodeBlock(ScriptExecutable* ownerExecutable, UnlinkedCodeBlock*, JSGlobalObject*, unsigned baseScopeDepth, PassRefPtr, unsigned sourceOffset, PassOwnPtr alternative); WriteBarrier m_globalObject; Heap* m_heap; @@ -131,7 +130,6 @@ namespace JSC { int numParameters() const { return m_numParameters; } void setNumParameters(int newValue); - void addParameter(); int* addressOfNumParameters() { return &m_numParameters; } static ptrdiff_t offsetOfNumParameters() { return OBJECT_OFFSETOF(CodeBlock, m_numParameters); } @@ -249,16 +247,6 @@ namespace JSC { { return *(binarySearch(m_callLinkInfos.begin(), m_callLinkInfos.size(), bytecodeIndex)); } - - MethodCallLinkInfo& getMethodCallLinkInfo(ReturnAddressPtr returnAddress) - { - return *(binarySearch(m_methodCallLinkInfos.begin(), m_methodCallLinkInfos.size(), returnAddress.value())); - } - - MethodCallLinkInfo& getMethodCallLinkInfo(unsigned bytecodeIndex) - { - return *(binarySearch(m_methodCallLinkInfos.begin(), m_methodCallLinkInfos.size(), bytecodeIndex)); - } #endif // ENABLE(JIT) #if ENABLE(LLINT) @@ -445,8 +433,7 @@ namespace JSC { return static_cast(returnAddress) - instructions().begin(); } - void setIsNumericCompareFunction(bool isNumericCompareFunction) { m_isNumericCompareFunction = isNumericCompareFunction; } - bool isNumericCompareFunction() { return m_isNumericCompareFunction; } + bool isNumericCompareFunction() { return m_unlinkedCode->isNumericCompareFunction(); } unsigned numberOfInstructions() const { return m_instructions.size(); } RefCountedArray& instructions() { return m_instructions; } @@ -535,10 +522,8 @@ namespace JSC { void setThisRegister(int thisRegister) { m_thisRegister = thisRegister; } int thisRegister() const { return m_thisRegister; } - void setNeedsFullScopeChain(bool needsFullScopeChain) { m_needsFullScopeChain = needsFullScopeChain; } - bool needsFullScopeChain() const { return m_needsFullScopeChain; } - void setUsesEval(bool usesEval) { m_usesEval = usesEval; } - bool usesEval() const { return m_usesEval; } + bool needsFullScopeChain() const { return m_unlinkedCode->needsFullScopeChain(); } + bool usesEval() const { return m_unlinkedCode->usesEval(); } void setArgumentsRegister(int argumentsRegister) { @@ -600,37 +585,28 @@ namespace JSC { if (usesArguments() && operand == unmodifiedArgumentsRegister(argumentsRegister())) return true; - return operand >= m_symbolTable->captureStart() - && operand < m_symbolTable->captureEnd(); + // We're in global code so there are no locals to capture + if (!symbolTable()) + return false; + + return operand >= symbolTable()->captureStart() + && operand < symbolTable()->captureEnd(); } - CodeType codeType() const { return m_codeType; } + CodeType codeType() const { return m_unlinkedCode->codeType(); } SourceProvider* source() const { return m_source.get(); } unsigned sourceOffset() const { return m_sourceOffset; } - size_t numberOfJumpTargets() const { return m_jumpTargets.size(); } - void addJumpTarget(unsigned jumpTarget) { m_jumpTargets.append(jumpTarget); } - unsigned jumpTarget(int index) const { return m_jumpTargets[index]; } - unsigned lastJumpTarget() const { return m_jumpTargets.last(); } + size_t numberOfJumpTargets() const { return m_unlinkedCode->numberOfJumpTargets(); } + unsigned jumpTarget(int index) const { return m_unlinkedCode->jumpTarget(index); } void createActivation(CallFrame*); void clearEvalCache(); String nameForRegister(int registerNumber); - - void addPropertyAccessInstruction(unsigned propertyAccessInstruction) - { - m_propertyAccessInstructions.append(propertyAccessInstruction); - } -#if ENABLE(LLINT) - LLIntCallLinkInfo* addLLIntCallLinkInfo() - { - m_llintCallLinkInfos.append(LLIntCallLinkInfo()); - return &m_llintCallLinkInfos.last(); - } -#endif + #if ENABLE(JIT) void setNumberOfStructureStubInfos(size_t size) { m_structureStubInfos.grow(size); } size_t numberOfStructureStubInfos() const { return m_structureStubInfos.size(); } @@ -643,10 +619,6 @@ namespace JSC { void setNumberOfCallLinkInfos(size_t size) { m_callLinkInfos.grow(size); } size_t numberOfCallLinkInfos() const { return m_callLinkInfos.size(); } CallLinkInfo& callLinkInfo(int index) { return m_callLinkInfos[index]; } - - void addMethodCallLinkInfos(unsigned n) { ASSERT(m_globalData->canUseJIT()); m_methodCallLinkInfos.grow(n); } - MethodCallLinkInfo& methodCallLinkInfo(int index) { return m_methodCallLinkInfos[index]; } - size_t numberOfMethodCallLinkInfos() { return m_methodCallLinkInfos.size(); } #endif #if ENABLE(VALUE_PROFILER) @@ -662,14 +634,7 @@ namespace JSC { ASSERT(result->m_bytecodeOffset == -1); return result; } - - ValueProfile* addValueProfile(int bytecodeOffset) - { - ASSERT(bytecodeOffset != -1); - ASSERT(m_valueProfiles.isEmpty() || m_valueProfiles.last().m_bytecodeOffset < bytecodeOffset); - m_valueProfiles.append(ValueProfile(bytecodeOffset)); - return &m_valueProfiles.last(); - } + unsigned numberOfValueProfiles() { return m_valueProfiles.size(); } ValueProfile* valueProfile(int index) { @@ -795,25 +760,24 @@ namespace JSC { // Exception handling support size_t numberOfExceptionHandlers() const { return m_rareData ? m_rareData->m_exceptionHandlers.size() : 0; } - void addExceptionHandler(const HandlerInfo& hanler) { createRareDataIfNecessary(); return m_rareData->m_exceptionHandlers.append(hanler); } - HandlerInfo& exceptionHandler(int index) { ASSERT(m_rareData); return m_rareData->m_exceptionHandlers[index]; } - - void addExpressionInfo(const ExpressionRangeInfo& expressionInfo) + void allocateHandlers(const Vector& unlinkedHandlers) { + size_t count = unlinkedHandlers.size(); + if (!count) + return; createRareDataIfNecessary(); - m_rareData->m_expressionInfo.append(expressionInfo); - } - - void addLineInfo(unsigned bytecodeOffset, int lineNo) - { - Vector& lineInfo = m_lineInfo; - if (!lineInfo.size() || lineInfo.last().lineNumber != lineNo) { - LineInfo info = { bytecodeOffset, lineNo }; - lineInfo.append(info); + m_rareData->m_exceptionHandlers.resize(count); + for (size_t i = 0; i < count; ++i) { + m_rareData->m_exceptionHandlers[i].start = unlinkedHandlers[i].start; + m_rareData->m_exceptionHandlers[i].end = unlinkedHandlers[i].end; + m_rareData->m_exceptionHandlers[i].target = unlinkedHandlers[i].target; + m_rareData->m_exceptionHandlers[i].scopeDepth = unlinkedHandlers[i].scopeDepth; } + } + HandlerInfo& exceptionHandler(int index) { ASSERT(m_rareData); return m_rareData->m_exceptionHandlers[index]; } - bool hasExpressionInfo() { return m_rareData && m_rareData->m_expressionInfo.size(); } + bool hasExpressionInfo() { return m_unlinkedCode->hasExpressionInfo(); } #if ENABLE(JIT) Vector& callReturnIndexVector() @@ -888,6 +852,8 @@ namespace JSC { m_constantRegisters.last().set(m_globalObject->globalData(), m_ownerExecutable.get(), v); return result; } + + unsigned addOrFindConstant(JSValue); WriteBarrier& constantRegister(int index) { return m_constantRegisters[index - FirstConstantRegisterIndex]; } ALWAYS_INLINE bool isConstantRegisterIndex(int index) const { return index >= FirstConstantRegisterIndex; } @@ -911,20 +877,7 @@ namespace JSC { } FunctionExecutable* functionExpr(int index) { return m_functionExprs[index].get(); } - unsigned addRegExp(RegExp* r) - { - createRareDataIfNecessary(); - unsigned size = m_rareData->m_regexps.size(); - m_rareData->m_regexps.append(WriteBarrier(*m_globalData, ownerExecutable(), r)); - return size; - } - unsigned numberOfRegExps() const - { - if (!m_rareData) - return 0; - return m_rareData->m_regexps.size(); - } - RegExp* regexp(int index) const { ASSERT(m_rareData); return m_rareData->m_regexps[index].get(); } + RegExp* regexp(int index) const { return m_unlinkedCode->regexp(index); } unsigned numberOfConstantBuffers() const { @@ -939,10 +892,6 @@ namespace JSC { m_rareData->m_constantBuffers.append(buffer); return size; } - unsigned addConstantBuffer(unsigned length) - { - return addConstantBuffer(Vector(length)); - } Vector& constantBufferAsVector(unsigned index) { @@ -979,7 +928,7 @@ namespace JSC { StringJumpTable& stringSwitchJumpTable(int tableIndex) { ASSERT(m_rareData); return m_rareData->m_stringSwitchJumpTables[tableIndex]; } - SharedSymbolTable* symbolTable() { return m_symbolTable.get(); } + SharedSymbolTable* symbolTable() const { return m_unlinkedCode->symbolTable(); } EvalCodeCache& evalCodeCache() { createRareDataIfNecessary(); return m_rareData->m_evalCodeCache; } @@ -1216,9 +1165,6 @@ namespace JSC { int m_numVars; bool m_isConstructor; - int globalObjectConstant() const { return m_globalObjectConstant; } - void setGlobalObjectConstant(int globalRegister) { m_globalObjectConstant = globalRegister; } - protected: #if ENABLE(JIT) virtual bool jitCompileImpl(ExecState*) = 0; @@ -1226,6 +1172,8 @@ namespace JSC { virtual void visitWeakReferences(SlotVisitor&); virtual void finalizeUnconditionally(); + UnlinkedCodeBlock* unlinkedCodeBlock() const { return m_unlinkedCode.get(); } + private: friend class DFGCodeBlocks; @@ -1237,7 +1185,21 @@ namespace JSC { #if ENABLE(VALUE_PROFILER) void updateAllPredictionsAndCountLiveness(OperationInProgress, unsigned& numberOfLiveNonArgumentValueProfiles, unsigned& numberOfSamplesInProfiles); #endif - + + void setIdentifiers(const Vector& identifiers) + { + ASSERT(m_identifiers.isEmpty()); + m_identifiers.appendVector(identifiers); + } + + void setConstantRegisters(const Vector >& constants) + { + size_t count = constants.size(); + m_constantRegisters.resize(count); + for (size_t i = 0; i < count; i++) + m_constantRegisters[i].set(*m_globalData, ownerExecutable(), constants[i].get()); + } + void dump(ExecState*, const Vector::const_iterator& begin, Vector::const_iterator&); CString registerName(ExecState*, int r) const; @@ -1287,30 +1249,21 @@ namespace JSC { #if ENABLE(JIT) void resetStubInternal(RepatchBuffer&, StructureStubInfo&); #endif - + WriteBarrier m_unlinkedCode; int m_numParameters; - WriteBarrier m_ownerExecutable; JSGlobalData* m_globalData; RefCountedArray m_instructions; - int m_thisRegister; int m_argumentsRegister; int m_activationRegister; - int m_globalObjectConstant; - bool m_needsFullScopeChain; - bool m_usesEval; - bool m_isNumericCompareFunction; bool m_isStrictMode; - CodeType m_codeType; - RefPtr m_source; unsigned m_sourceOffset; - Vector m_propertyAccessInstructions; #if ENABLE(LLINT) SegmentedVector m_llintCallLinkInfos; SentinelLinkedList > m_incomingLLIntCalls; @@ -1319,7 +1272,6 @@ namespace JSC { Vector m_structureStubInfos; Vector m_byValInfos; Vector m_callLinkInfos; - Vector m_methodCallLinkInfos; JITCode m_jitCode; MacroAssemblerCodePtr m_jitCodeWithArityCheck; SentinelLinkedList > m_incomingCalls; @@ -1382,18 +1334,15 @@ namespace JSC { unsigned m_executionEntryCount; #endif - Vector m_jumpTargets; - Vector m_loopTargets; - // Constant Pool Vector m_identifiers; COMPILE_ASSERT(sizeof(Register) == sizeof(WriteBarrier), Register_must_be_same_size_as_WriteBarrier_Unknown); + // TODO: This could just be a pointer to m_unlinkedCodeBlock's data, but the DFG mutates + // it, so we're stuck with it for now. Vector > m_constantRegisters; Vector > m_functionDecls; Vector > m_functionExprs; - WriteBarrier m_symbolTable; - OwnPtr m_alternative; ExecutionCounter m_llintExecuteCounter; @@ -1404,22 +1353,14 @@ namespace JSC { uint16_t m_optimizationDelayCounter; uint16_t m_reoptimizationRetryCounter; - Vector m_lineInfo; -#if ENABLE(BYTECODE_COMMENTS) - Vector m_bytecodeComments; - size_t m_bytecodeCommentIterator; -#endif Vector m_resolveOperations; - Vector m_putToBaseOperations; + Vector m_putToBaseOperations; struct RareData { WTF_MAKE_FAST_ALLOCATED; public: Vector m_exceptionHandlers; - // Rare Constants - Vector > m_regexps; - // Buffers used for large array literals Vector > m_constantBuffers; @@ -1430,9 +1371,6 @@ namespace JSC { EvalCodeCache m_evalCodeCache; - // Expression info - present if debugging. - Vector m_expressionInfo; - // Line info - present if profiling or debugging. #if ENABLE(JIT) Vector m_callReturnIndexVector; #endif @@ -1460,8 +1398,8 @@ namespace JSC { { } - GlobalCodeBlock(ScriptExecutable* ownerExecutable, CodeType codeType, JSGlobalObject* globalObject, PassRefPtr sourceProvider, unsigned sourceOffset, PassOwnPtr alternative) - : CodeBlock(ownerExecutable, codeType, globalObject, sourceProvider, sourceOffset, false, alternative) + GlobalCodeBlock(ScriptExecutable* ownerExecutable, UnlinkedCodeBlock* unlinkedCodeBlock, JSGlobalObject* globalObject, unsigned baseScopeDepth, PassRefPtr sourceProvider, unsigned sourceOffset, PassOwnPtr alternative) + : CodeBlock(ownerExecutable, unlinkedCodeBlock, globalObject, baseScopeDepth, sourceProvider, sourceOffset, alternative) { } }; @@ -1473,11 +1411,11 @@ namespace JSC { { } - ProgramCodeBlock(ProgramExecutable* ownerExecutable, CodeType codeType, JSGlobalObject* globalObject, PassRefPtr sourceProvider, PassOwnPtr alternative) - : GlobalCodeBlock(ownerExecutable, codeType, globalObject, sourceProvider, 0, alternative) + ProgramCodeBlock(ProgramExecutable* ownerExecutable, UnlinkedProgramCodeBlock* unlinkedCodeBlock, JSGlobalObject* globalObject, PassRefPtr sourceProvider, PassOwnPtr alternative) + : GlobalCodeBlock(ownerExecutable, unlinkedCodeBlock, globalObject, 0, sourceProvider, 0, alternative) { } - + #if ENABLE(JIT) protected: virtual JSObject* compileOptimized(ExecState*, JSScope*, unsigned bytecodeIndex); @@ -1492,26 +1430,16 @@ namespace JSC { public: EvalCodeBlock(CopyParsedBlockTag, EvalCodeBlock& other) : GlobalCodeBlock(CopyParsedBlock, other) - , m_baseScopeDepth(other.m_baseScopeDepth) - , m_variables(other.m_variables) { } - EvalCodeBlock(EvalExecutable* ownerExecutable, JSGlobalObject* globalObject, PassRefPtr sourceProvider, int baseScopeDepth, PassOwnPtr alternative) - : GlobalCodeBlock(ownerExecutable, EvalCode, globalObject, sourceProvider, 0, alternative) - , m_baseScopeDepth(baseScopeDepth) + EvalCodeBlock(EvalExecutable* ownerExecutable, UnlinkedEvalCodeBlock* unlinkedCodeBlock, JSGlobalObject* globalObject, PassRefPtr sourceProvider, int baseScopeDepth, PassOwnPtr alternative) + : GlobalCodeBlock(ownerExecutable, unlinkedCodeBlock, globalObject, baseScopeDepth, sourceProvider, 0, alternative) { } - int baseScopeDepth() const { return m_baseScopeDepth; } - - const Identifier& variable(unsigned index) { return m_variables[index]; } - unsigned numVariables() { return m_variables.size(); } - void adoptVariables(Vector& variables) - { - ASSERT(m_variables.isEmpty()); - m_variables.swap(variables); - } + const Identifier& variable(unsigned index) { return unlinkedEvalCodeBlock()->variable(index); } + unsigned numVariables() { return unlinkedEvalCodeBlock()->numVariables(); } #if ENABLE(JIT) protected: @@ -1523,8 +1451,7 @@ namespace JSC { #endif private: - int m_baseScopeDepth; - Vector m_variables; + UnlinkedEvalCodeBlock* unlinkedEvalCodeBlock() const { return jsCast(unlinkedCodeBlock()); } }; class FunctionCodeBlock : public CodeBlock { @@ -1534,8 +1461,8 @@ namespace JSC { { } - FunctionCodeBlock(FunctionExecutable* ownerExecutable, CodeType codeType, JSGlobalObject* globalObject, PassRefPtr sourceProvider, unsigned sourceOffset, bool isConstructor, PassOwnPtr alternative = nullptr) - : CodeBlock(ownerExecutable, codeType, globalObject, sourceProvider, sourceOffset, isConstructor, alternative) + FunctionCodeBlock(FunctionExecutable* ownerExecutable, UnlinkedFunctionCodeBlock* unlinkedCodeBlock, JSGlobalObject* globalObject, PassRefPtr sourceProvider, unsigned sourceOffset, PassOwnPtr alternative = nullptr) + : CodeBlock(ownerExecutable, unlinkedCodeBlock, globalObject, 0, sourceProvider, sourceOffset, alternative) { } diff --git a/Source/JavaScriptCore/bytecode/DFGExitProfile.h b/Source/JavaScriptCore/bytecode/DFGExitProfile.h index 57fb06bda..60d313ad4 100644 --- a/Source/JavaScriptCore/bytecode/DFGExitProfile.h +++ b/Source/JavaScriptCore/bytecode/DFGExitProfile.h @@ -36,6 +36,7 @@ enum ExitKind { ExitKindUnset, BadType, // We exited because a type prediction was wrong. BadCache, // We exited because an inline cache was wrong. + BadWeakConstantCache, // We exited because a cache on a weak constant (usually a prototype) was wrong. BadIndexingType, // We exited because an indexing type was wrong. Overflow, // We exited because of overflow. NegativeZero, // We exited because we encountered negative zero. @@ -55,6 +56,8 @@ inline const char* exitKindToString(ExitKind kind) return "BadType"; case BadCache: return "BadCache"; + case BadWeakConstantCache: + return "BadWeakConstantCache"; case Overflow: return "Overflow"; case NegativeZero: diff --git a/Source/JavaScriptCore/bytecode/GetByIdStatus.cpp b/Source/JavaScriptCore/bytecode/GetByIdStatus.cpp index e44568a26..605a81c2f 100644 --- a/Source/JavaScriptCore/bytecode/GetByIdStatus.cpp +++ b/Source/JavaScriptCore/bytecode/GetByIdStatus.cpp @@ -41,9 +41,6 @@ GetByIdStatus GetByIdStatus::computeFromLLInt(CodeBlock* profiledBlock, unsigned #if ENABLE(LLINT) Instruction* instruction = profiledBlock->instructions().begin() + bytecodeIndex; - if (instruction[0].u.opcode == LLInt::getOpcode(llint_op_method_check)) - instruction++; - if (instruction[0].u.opcode == LLInt::getOpcode(llint_op_get_array_length)) return GetByIdStatus(NoInformation, false); diff --git a/Source/JavaScriptCore/bytecode/MethodCallLinkInfo.cpp b/Source/JavaScriptCore/bytecode/MethodCallLinkInfo.cpp deleted file mode 100644 index 1fcf5850f..000000000 --- a/Source/JavaScriptCore/bytecode/MethodCallLinkInfo.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) 2012 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "MethodCallLinkInfo.h" - -#if ENABLE(JIT) - -#include "JITStubs.h" -#include "RepatchBuffer.h" - -namespace JSC { - -void MethodCallLinkInfo::reset(RepatchBuffer& repatchBuffer, JITCode::JITType jitType) -{ - cachedStructure.clearToMaxUnsigned(); - cachedPrototype.clear(); - cachedPrototypeStructure.clearToMaxUnsigned(); - cachedFunction.clear(); - - ASSERT_UNUSED(jitType, jitType == JITCode::BaselineJIT); - - repatchBuffer.relink(callReturnLocation, cti_op_get_by_id_method_check); -} - -} // namespace JSC - -#endif // ENABLE(JIT) diff --git a/Source/JavaScriptCore/bytecode/MethodCallLinkInfo.h b/Source/JavaScriptCore/bytecode/MethodCallLinkInfo.h deleted file mode 100644 index 2243bc24e..000000000 --- a/Source/JavaScriptCore/bytecode/MethodCallLinkInfo.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (C) 2012 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef MethodCallLinkInfo_h -#define MethodCallLinkInfo_h - -#include "CodeLocation.h" -#include "JITCode.h" -#include "JITWriteBarrier.h" -#include - -namespace JSC { - -#if ENABLE(JIT) - -class RepatchBuffer; - -struct MethodCallLinkInfo { - MethodCallLinkInfo() - : seen(false) - { - } - - bool seenOnce() - { - return seen; - } - - void setSeen() - { - seen = true; - } - - void reset(RepatchBuffer&, JITCode::JITType); - - unsigned bytecodeIndex; - CodeLocationCall callReturnLocation; - JITWriteBarrier cachedStructure; - JITWriteBarrier cachedPrototypeStructure; - // We'd like this to actually be JSFunction, but InternalFunction and JSFunction - // don't have a common parent class and we allow specialisation on both - JITWriteBarrier cachedFunction; - JITWriteBarrier cachedPrototype; - bool seen; -}; - -inline void* getMethodCallLinkInfoReturnLocation(MethodCallLinkInfo* methodCallLinkInfo) -{ - return methodCallLinkInfo->callReturnLocation.executableAddress(); -} - -inline unsigned getMethodCallLinkInfoBytecodeIndex(MethodCallLinkInfo* methodCallLinkInfo) -{ - return methodCallLinkInfo->bytecodeIndex; -} - -#endif // ENABLE(JIT) - -} // namespace JSC - -#endif // MethodCallLinkInfo_h diff --git a/Source/JavaScriptCore/bytecode/MethodCallLinkStatus.cpp b/Source/JavaScriptCore/bytecode/MethodCallLinkStatus.cpp deleted file mode 100644 index 795b41b69..000000000 --- a/Source/JavaScriptCore/bytecode/MethodCallLinkStatus.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (C) 2012 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "MethodCallLinkStatus.h" - -#include "CodeBlock.h" - -namespace JSC { - -MethodCallLinkStatus MethodCallLinkStatus::computeFor(CodeBlock* profiledBlock, unsigned bytecodeIndex) -{ - UNUSED_PARAM(profiledBlock); - UNUSED_PARAM(bytecodeIndex); -#if ENABLE(JIT) && ENABLE(VALUE_PROFILER) - // NOTE: This does not have an LLInt fall-back because LLInt does not do any method - // call link caching. - if (!profiledBlock->numberOfMethodCallLinkInfos()) - return MethodCallLinkStatus(); - - MethodCallLinkInfo& methodCall = profiledBlock->getMethodCallLinkInfo(bytecodeIndex); - - if (!methodCall.seen || !methodCall.cachedStructure) - return MethodCallLinkStatus(); - - if (methodCall.cachedPrototype.get() == profiledBlock->globalObject()->methodCallDummy()) { - return MethodCallLinkStatus( - methodCall.cachedStructure.get(), - 0, - methodCall.cachedFunction.get(), - 0); - } - - return MethodCallLinkStatus( - methodCall.cachedStructure.get(), - methodCall.cachedPrototypeStructure.get(), - methodCall.cachedFunction.get(), - methodCall.cachedPrototype.get()); -#else // ENABLE(JIT) - return MethodCallLinkStatus(); -#endif // ENABLE(JIT) -} - -} // namespace JSC diff --git a/Source/JavaScriptCore/bytecode/MethodCallLinkStatus.h b/Source/JavaScriptCore/bytecode/MethodCallLinkStatus.h deleted file mode 100644 index c3d11a1d8..000000000 --- a/Source/JavaScriptCore/bytecode/MethodCallLinkStatus.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (C) 2012 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef MethodCallLinkStatus_h -#define MethodCallLinkStatus_h - -namespace JSC { - -class CodeBlock; -class JSObject; -class Structure; - -class MethodCallLinkStatus { -public: - MethodCallLinkStatus() - : m_structure(0) - , m_prototypeStructure(0) - , m_function(0) - , m_prototype(0) - { - } - - MethodCallLinkStatus( - Structure* structure, - Structure* prototypeStructure, - JSObject* function, - JSObject* prototype) - : m_structure(structure) - , m_prototypeStructure(prototypeStructure) - , m_function(function) - , m_prototype(prototype) - { - if (!m_function) { - ASSERT(!m_structure); - ASSERT(!m_prototypeStructure); - ASSERT(!m_prototype); - } else - ASSERT(m_structure); - - ASSERT(!m_prototype == !m_prototypeStructure); - } - - static MethodCallLinkStatus computeFor(CodeBlock*, unsigned bytecodeIndex); - - bool isSet() const { return !!m_function; } - bool operator!() const { return !m_function; } - - bool needsPrototypeCheck() const { return !!m_prototype; } - - Structure* structure() { return m_structure; } - Structure* prototypeStructure() { return m_prototypeStructure; } - JSObject* function() const { return m_function; } - JSObject* prototype() const { return m_prototype; } - -private: - Structure* m_structure; - Structure* m_prototypeStructure; - JSObject* m_function; - JSObject* m_prototype; -}; - -} // namespace JSC - -#endif // MethodCallLinkStatus_h - diff --git a/Source/JavaScriptCore/bytecode/Opcode.h b/Source/JavaScriptCore/bytecode/Opcode.h index 3ce56c80e..8979d0b7b 100644 --- a/Source/JavaScriptCore/bytecode/Opcode.h +++ b/Source/JavaScriptCore/bytecode/Opcode.h @@ -118,7 +118,8 @@ namespace JSC { macro(op_put_to_base, 5) \ macro(op_put_to_base_variable, 5) \ \ - macro(op_init_global_const, 3) \ + macro(op_init_global_const_nop, 5) \ + macro(op_init_global_const, 5) \ macro(op_init_global_const_check, 5) \ macro(op_get_by_id, 9) /* has value profiling */ \ macro(op_get_by_id_out_of_line, 9) /* has value profiling */ \ @@ -190,7 +191,6 @@ namespace JSC { macro(op_ret, 2) \ macro(op_call_put_result, 3) /* has value profiling */ \ macro(op_ret_object_or_this, 3) \ - macro(op_method_check, 1) \ \ macro(op_construct, 6) \ macro(op_strcat, 4) \ @@ -205,7 +205,7 @@ namespace JSC { \ macro(op_catch, 2) \ macro(op_throw, 2) \ - macro(op_throw_reference_error, 2) \ + macro(op_throw_static_error, 3) \ \ macro(op_debug, 5) \ macro(op_profile_will_call, 2) \ diff --git a/Source/JavaScriptCore/bytecode/SpeculatedType.h b/Source/JavaScriptCore/bytecode/SpeculatedType.h index 9d2c61ae8..09ba9fdfa 100644 --- a/Source/JavaScriptCore/bytecode/SpeculatedType.h +++ b/Source/JavaScriptCore/bytecode/SpeculatedType.h @@ -284,6 +284,11 @@ inline bool mergeSpeculation(T& left, SpeculatedType right) return result; } +inline bool speculationChecked(SpeculatedType actual, SpeculatedType desired) +{ + return (actual | desired) == desired; +} + SpeculatedType speculationFromClassInfo(const ClassInfo*); SpeculatedType speculationFromStructure(Structure*); SpeculatedType speculationFromCell(JSCell*); diff --git a/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.cpp b/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.cpp new file mode 100644 index 000000000..8aa48404a --- /dev/null +++ b/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.cpp @@ -0,0 +1,294 @@ +/* + * Copyright (C) 2012 Apple Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#include "UnlinkedCodeBlock.h" + +#include "BytecodeGenerator.h" +#include "ClassInfo.h" +#include "CodeCache.h" +#include "Executable.h" +#include "JSString.h" +#include "SourceProvider.h" +#include "Structure.h" +#include "SymbolTable.h" + +namespace JSC { + +const ClassInfo UnlinkedFunctionExecutable::s_info = { "UnlinkedFunctionExecutable", 0, 0, 0, CREATE_METHOD_TABLE(UnlinkedFunctionExecutable) }; +const ClassInfo UnlinkedCodeBlock::s_info = { "UnlinkedCodeBlock", 0, 0, 0, CREATE_METHOD_TABLE(UnlinkedCodeBlock) }; +const ClassInfo UnlinkedGlobalCodeBlock::s_info = { "UnlinkedGlobalCodeBlock", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(UnlinkedGlobalCodeBlock) }; +const ClassInfo UnlinkedProgramCodeBlock::s_info = { "UnlinkedProgramCodeBlock", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(UnlinkedProgramCodeBlock) }; +const ClassInfo UnlinkedEvalCodeBlock::s_info = { "UnlinkedEvalCodeBlock", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(UnlinkedEvalCodeBlock) }; +const ClassInfo UnlinkedFunctionCodeBlock::s_info = { "UnlinkedFunctionCodeBlock", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(UnlinkedFunctionCodeBlock) }; + +unsigned UnlinkedCodeBlock::addOrFindConstant(JSValue v) +{ + unsigned numberOfConstants = numberOfConstantRegisters(); + for (unsigned i = 0; i < numberOfConstants; ++i) { + if (getConstant(FirstConstantRegisterIndex + i) == v) + return i; + } + return addConstant(v); +} + +UnlinkedFunctionExecutable::UnlinkedFunctionExecutable(JSGlobalData* globalData, Structure* structure, const SourceCode& source, FunctionBodyNode* node) + : Base(*globalData, structure) + , m_numCapturedVariables(node->capturedVariableCount()) + , m_forceUsesArguments(node->usesArguments()) + , m_isInStrictContext(node->isStrictMode()) + , m_hasCapturedVariables(node->hasCapturedVariables()) + , m_name(node->ident()) + , m_inferredName(node->inferredName()) + , m_parameters(node->parameters()) + , m_firstLineOffset(node->firstLine() - source.firstLine()) + , m_lineCount(node->lastLine() - node->firstLine()) + , m_startOffset(node->source().startOffset() - source.startOffset()) + , m_sourceLength(node->source().length()) + , m_features(node->features()) + , m_functionNameIsInScopeToggle(node->functionNameIsInScopeToggle()) +{ +} + +void UnlinkedFunctionExecutable::visitChildren(JSCell* cell, SlotVisitor& visitor) +{ + UnlinkedFunctionExecutable* thisObject = jsCast(cell); + ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info); + COMPILE_ASSERT(StructureFlags & OverridesVisitChildren, OverridesVisitChildrenWithoutSettingFlag); + ASSERT(thisObject->structure()->typeInfo().overridesVisitChildren()); + Base::visitChildren(thisObject, visitor); + visitor.append(&thisObject->m_codeBlockForCall); + visitor.append(&thisObject->m_codeBlockForConstruct); + visitor.append(&thisObject->m_nameValue); + visitor.append(&thisObject->m_symbolTableForCall); + visitor.append(&thisObject->m_symbolTableForConstruct); +} + +FunctionExecutable* UnlinkedFunctionExecutable::link(JSGlobalData& globalData, const SourceCode& source, size_t lineOffset, size_t sourceOffset) +{ + unsigned firstLine = lineOffset + m_firstLineOffset; + unsigned startOffset = sourceOffset + m_startOffset; + SourceCode code(source.provider(), startOffset, startOffset + m_sourceLength, firstLine); + return FunctionExecutable::create(globalData, code, this, firstLine, firstLine + m_lineCount); +} + +UnlinkedFunctionExecutable* UnlinkedFunctionExecutable::fromGlobalCode(const Identifier& name, ExecState* exec, Debugger*, const SourceCode& source, JSObject** exception) +{ + ParserError error; + CodeCache* codeCache = exec->globalData().codeCache(); + UnlinkedFunctionExecutable* executable = codeCache->getFunctionExecutableFromGlobalCode(exec->globalData(), name, source, error); + if (error.m_type != ParserError::ErrorNone) { + *exception = error.toErrorObject(exec->lexicalGlobalObject(), source); + return 0; + } + + return executable; +} + +UnlinkedFunctionCodeBlock* UnlinkedFunctionExecutable::codeBlockFor(JSGlobalData& globalData, const SourceCode& source, CodeSpecializationKind specializationKind, DebuggerMode debuggerMode, ProfilerMode profilerMode, ParserError& error) +{ + switch (specializationKind) { + case CodeForCall: + if (m_codeBlockForCall) + return m_codeBlockForCall.get(); + break; + case CodeForConstruct: + if (m_codeBlockForConstruct) + return m_codeBlockForConstruct.get(); + break; + } + + UnlinkedFunctionCodeBlock* result = globalData.codeCache()->getFunctionCodeBlock(globalData, this, source, specializationKind, debuggerMode, profilerMode, error); + + if (error.m_type != ParserError::ErrorNone) + return 0; + + switch (specializationKind) { + case CodeForCall: + m_codeBlockForCall.set(globalData, this, result); + m_symbolTableForCall.set(globalData, this, result->symbolTable()); + break; + case CodeForConstruct: + m_codeBlockForConstruct.set(globalData, this, result); + m_symbolTableForConstruct.set(globalData, this, result->symbolTable()); + break; + } + return result; +} + +String UnlinkedFunctionExecutable::paramString() const +{ + FunctionParameters& parameters = *m_parameters; + StringBuilder builder; + for (size_t pos = 0; pos < parameters.size(); ++pos) { + if (!builder.isEmpty()) + builder.appendLiteral(", "); + builder.append(parameters[pos].string()); + } + return builder.toString(); +} + +UnlinkedCodeBlock::UnlinkedCodeBlock(JSGlobalData* globalData, Structure* structure, CodeType codeType, const ExecutableInfo& info) + : Base(*globalData, structure) + , m_numVars(0) + , m_numCalleeRegisters(0) + , m_numParameters(0) + , m_globalData(globalData) + , m_argumentsRegister(-1) + , m_needsFullScopeChain(info.m_needsActivation) + , m_usesEval(info.m_usesEval) + , m_isNumericCompareFunction(false) + , m_isStrictMode(info.m_isStrictMode) + , m_isConstructor(info.m_isConstructor) + , m_hasCapturedVariables(false) + , m_firstLine(0) + , m_lineCount(0) + , m_features(0) + , m_codeType(codeType) + , m_resolveOperationCount(0) + , m_putToBaseOperationCount(1) + , m_arrayProfileCount(0) + , m_valueProfileCount(0) + , m_llintCallLinkInfoCount(0) +#if ENABLE(BYTECODE_COMMENTS) + , m_bytecodeCommentIterator(0) +#endif +{ + +} + +void UnlinkedCodeBlock::visitChildren(JSCell* cell, SlotVisitor& visitor) +{ + UnlinkedCodeBlock* thisObject = jsCast(cell); + ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info); + COMPILE_ASSERT(StructureFlags & OverridesVisitChildren, OverridesVisitChildrenWithoutSettingFlag); + ASSERT(thisObject->structure()->typeInfo().overridesVisitChildren()); + Base::visitChildren(thisObject, visitor); + visitor.append(&thisObject->m_symbolTable); + for (FunctionExpressionVector::iterator ptr = thisObject->m_functionDecls.begin(), end = thisObject->m_functionDecls.end(); ptr != end; ++ptr) + visitor.append(ptr); + for (FunctionExpressionVector::iterator ptr = thisObject->m_functionExprs.begin(), end = thisObject->m_functionExprs.end(); ptr != end; ++ptr) + visitor.append(ptr); + visitor.appendValues(thisObject->m_constantRegisters.data(), thisObject->m_constantRegisters.size()); + if (thisObject->m_rareData) { + for (size_t i = 0, end = thisObject->m_rareData->m_regexps.size(); i != end; i++) + visitor.append(&thisObject->m_rareData->m_regexps[i]); + } +} + +int UnlinkedCodeBlock::lineNumberForBytecodeOffset(unsigned bytecodeOffset) +{ + ASSERT(bytecodeOffset < instructions().size()); + Vector& lineInfo = m_lineInfo; + + int low = 0; + int high = lineInfo.size(); + while (low < high) { + int mid = low + (high - low) / 2; + if (lineInfo[mid].instructionOffset <= bytecodeOffset) + low = mid + 1; + else + high = mid; + } + + if (!low) + return 0; + return lineInfo[low - 1].lineNumber; +} + +void UnlinkedCodeBlock::expressionRangeForBytecodeOffset(unsigned bytecodeOffset, int& divot, int& startOffset, int& endOffset) +{ + ASSERT(bytecodeOffset < instructions().size()); + + if (!m_expressionInfo.size()) { + startOffset = 0; + endOffset = 0; + divot = 0; + return; + } + + Vector& expressionInfo = m_expressionInfo; + + int low = 0; + int high = expressionInfo.size(); + while (low < high) { + int mid = low + (high - low) / 2; + if (expressionInfo[mid].instructionOffset <= bytecodeOffset) + low = mid + 1; + else + high = mid; + } + + ASSERT(low); + if (!low) { + startOffset = 0; + endOffset = 0; + divot = 0; + return; + } + + startOffset = expressionInfo[low - 1].startOffset; + endOffset = expressionInfo[low - 1].endOffset; + divot = expressionInfo[low - 1].divotPoint; +} + +void UnlinkedProgramCodeBlock::visitChildren(JSCell* cell, SlotVisitor& visitor) +{ + UnlinkedProgramCodeBlock* thisObject = jsCast(cell); + ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info); + COMPILE_ASSERT(StructureFlags & OverridesVisitChildren, OverridesVisitChildrenWithoutSettingFlag); + ASSERT(thisObject->structure()->typeInfo().overridesVisitChildren()); + Base::visitChildren(thisObject, visitor); + for (size_t i = 0, end = thisObject->m_functionDeclarations.size(); i != end; i++) + visitor.append(&thisObject->m_functionDeclarations[i].second); +} + +UnlinkedCodeBlock::~UnlinkedCodeBlock() +{ +} + +void UnlinkedProgramCodeBlock::destroy(JSCell* cell) +{ + jsCast(cell)->~UnlinkedProgramCodeBlock(); +} + +void UnlinkedEvalCodeBlock::destroy(JSCell* cell) +{ + jsCast(cell)->~UnlinkedEvalCodeBlock(); +} + +void UnlinkedFunctionCodeBlock::destroy(JSCell* cell) +{ + jsCast(cell)->~UnlinkedFunctionCodeBlock(); +} + +void UnlinkedFunctionExecutable::destroy(JSCell* cell) +{ + jsCast(cell)->~UnlinkedFunctionExecutable(); +} + +} + diff --git a/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h b/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h new file mode 100644 index 000000000..bf3f5fdff --- /dev/null +++ b/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h @@ -0,0 +1,700 @@ +/* + * Copyright (C) 2012 Apple Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef UnlinkedCodeBlock_h +#define UnlinkedCodeBlock_h + +#include "BytecodeConventions.h" +#include "CodeSpecializationKind.h" +#include "CodeType.h" +#include "ExpressionRangeInfo.h" +#include "Identifier.h" +#include "JSCell.h" +#include "LineInfo.h" +#include "Nodes.h" +#include "RegExp.h" +#include "SpecialPointer.h" + +#include +#include + +namespace JSC { + +class Debugger; +class FunctionBodyNode; +class FunctionExecutable; +class FunctionParameters; +struct ParserError; +class ScriptExecutable; +class SourceCode; +class SourceProvider; +class SharedSymbolTable; +class UnlinkedCodeBlock; +class UnlinkedFunctionCodeBlock; + +typedef unsigned UnlinkedValueProfile; +typedef unsigned UnlinkedArrayProfile; +typedef unsigned UnlinkedLLIntCallLinkInfo; + +struct ExecutableInfo { + ExecutableInfo(bool needsActivation, bool usesEval, bool isStrictMode, bool isConstructor) + : m_needsActivation(needsActivation) + , m_usesEval(usesEval) + , m_isStrictMode(isStrictMode) + , m_isConstructor(isConstructor) + { + } + bool m_needsActivation; + bool m_usesEval; + bool m_isStrictMode; + bool m_isConstructor; +}; + +class UnlinkedFunctionExecutable : public JSCell { +public: + friend class CodeCache; + typedef JSCell Base; + static UnlinkedFunctionExecutable* create(JSGlobalData* globalData, const SourceCode& source, FunctionBodyNode* node) + { + UnlinkedFunctionExecutable* instance = new (NotNull, allocateCell(globalData->heap)) UnlinkedFunctionExecutable(globalData, globalData->unlinkedFunctionExecutableStructure.get(), source, node); + instance->finishCreation(*globalData); + return instance; + } + + const Identifier& name() const { return m_name; } + const Identifier& inferredName() const { return m_inferredName; } + JSString* nameValue() const { return m_nameValue.get(); } + SharedSymbolTable* symbolTable(CodeSpecializationKind kind) + { + return (kind == CodeForCall) ? m_symbolTableForCall.get() : m_symbolTableForConstruct.get(); + } + size_t parameterCount() const { return m_parameters->size(); } + bool isInStrictContext() const { return m_isInStrictContext; } + FunctionNameIsInScopeToggle functionNameIsInScopeToggle() const { return m_functionNameIsInScopeToggle; } + + unsigned firstLineOffset() const { return m_firstLineOffset; } + unsigned lineCount() const { return m_lineCount; } + unsigned startOffset() const { return m_startOffset; } + unsigned sourceLength() { return m_sourceLength; } + + String paramString() const; + + UnlinkedFunctionCodeBlock* codeBlockFor(JSGlobalData&, const SourceCode&, CodeSpecializationKind, DebuggerMode, ProfilerMode, ParserError&); + + static UnlinkedFunctionExecutable* fromGlobalCode(const Identifier&, ExecState*, Debugger*, const SourceCode&, JSObject** exception); + + FunctionExecutable* link(JSGlobalData&, const SourceCode&, size_t lineOffset, size_t sourceOffset); + + void clearCode() + { + m_symbolTableForCall.clear(); + m_symbolTableForConstruct.clear(); + m_codeBlockForCall.clear(); + m_codeBlockForConstruct.clear(); + } + + FunctionParameters* parameters() { return m_parameters.get(); } + + void recordParse(CodeFeatures features, bool hasCapturedVariables, int firstLine, int lastLine) + { + m_features = features; + m_hasCapturedVariables = hasCapturedVariables; + m_lineCount = lastLine - firstLine; + } + + bool forceUsesArguments() const { return m_forceUsesArguments; } + + CodeFeatures features() const { return m_features; } + bool hasCapturedVariables() const { return m_hasCapturedVariables; } + + static const bool needsDestruction = true; + static const bool hasImmortalStructure = true; + static void destroy(JSCell*); + +private: + UnlinkedFunctionExecutable(JSGlobalData*, Structure*, const SourceCode&, FunctionBodyNode*); + WriteBarrier m_codeBlockForCall; + WriteBarrier m_codeBlockForConstruct; + + unsigned m_numCapturedVariables : 29; + bool m_forceUsesArguments : 1; + bool m_isInStrictContext : 1; + bool m_hasCapturedVariables : 1; + + Identifier m_name; + Identifier m_inferredName; + WriteBarrier m_nameValue; + WriteBarrier m_symbolTableForCall; + WriteBarrier m_symbolTableForConstruct; + RefPtr m_parameters; + unsigned m_firstLineOffset; + unsigned m_lineCount; + unsigned m_startOffset; + unsigned m_sourceLength; + + CodeFeatures m_features; + + FunctionNameIsInScopeToggle m_functionNameIsInScopeToggle; + +protected: + void finishCreation(JSGlobalData& globalData) + { + Base::finishCreation(globalData); + m_nameValue.set(globalData, this, jsString(&globalData, name().string())); + } + + static void visitChildren(JSCell*, SlotVisitor&); + +public: + static Structure* createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue proto) + { + return Structure::create(globalData, globalObject, proto, TypeInfo(UnlinkedFunctionExecutableType, StructureFlags), &s_info); + } + + static const unsigned StructureFlags = OverridesVisitChildren | JSCell::StructureFlags; + + static const ClassInfo s_info; +}; + +struct UnlinkedStringJumpTable { + typedef HashMap, int32_t> StringOffsetTable; + StringOffsetTable offsetTable; + + inline int32_t offsetForValue(StringImpl* value, int32_t defaultOffset) + { + StringOffsetTable::const_iterator end = offsetTable.end(); + StringOffsetTable::const_iterator loc = offsetTable.find(value); + if (loc == end) + return defaultOffset; + return loc->value; + } + +}; + +struct UnlinkedSimpleJumpTable { + Vector branchOffsets; + int32_t min; + + int32_t offsetForValue(int32_t value, int32_t defaultOffset); + void add(int32_t key, int32_t offset) + { + if (!branchOffsets[key]) + branchOffsets[key] = offset; + } +}; + +struct UnlinkedHandlerInfo { + uint32_t start; + uint32_t end; + uint32_t target; + uint32_t scopeDepth; +}; + +struct UnlinkedInstruction { + UnlinkedInstruction() { u.operand = 0; } + UnlinkedInstruction(OpcodeID opcode) { u.opcode = opcode; } + UnlinkedInstruction(int operand) { u.operand = operand; } + union { + OpcodeID opcode; + int32_t operand; + } u; +}; + +class UnlinkedCodeBlock : public JSCell { +public: + typedef JSCell Base; + static const bool needsDestruction = true; + static const bool hasImmortalStructure = true; + + enum { CallFunction, ApplyFunction }; + + bool isConstructor() const { return m_isConstructor; } + bool isStrictMode() const { return m_isStrictMode; } + bool usesEval() const { return m_usesEval; } + + bool needsFullScopeChain() const { return m_needsFullScopeChain; } + void setNeedsFullScopeChain(bool needsFullScopeChain) { m_needsFullScopeChain = needsFullScopeChain; } + + void addExpressionInfo(const ExpressionRangeInfo& expressionInfo) + { + m_expressionInfo.append(expressionInfo); + } + + void addLineInfo(unsigned bytecodeOffset, int lineNo) + { + Vector& lineInfo = m_lineInfo; + if (!lineInfo.size() || lineInfo.last().lineNumber != lineNo) { + LineInfo info = { bytecodeOffset, lineNo }; + lineInfo.append(info); + } + } + + bool hasExpressionInfo() { return m_expressionInfo.size(); } + + // Special registers + void setThisRegister(int thisRegister) { m_thisRegister = thisRegister; } + void setActivationRegister(int activationRegister) { m_activationRegister = activationRegister; } + + void setArgumentsRegister(int argumentsRegister) { m_argumentsRegister = argumentsRegister; } + bool usesArguments() const { return m_argumentsRegister != -1; } + int argumentsRegister() const { return m_argumentsRegister; } + + // Parameter information + void setNumParameters(int newValue) { m_numParameters = newValue; } + void addParameter() { m_numParameters++; } + unsigned numParameters() const { return m_numParameters; } + + unsigned addRegExp(RegExp* r) + { + createRareDataIfNecessary(); + unsigned size = m_rareData->m_regexps.size(); + m_rareData->m_regexps.append(WriteBarrier(*m_globalData, this, r)); + return size; + } + unsigned numberOfRegExps() const + { + if (!m_rareData) + return 0; + return m_rareData->m_regexps.size(); + } + RegExp* regexp(int index) const { ASSERT(m_rareData); return m_rareData->m_regexps[index].get(); } + + // Constant Pools + + size_t numberOfIdentifiers() const { return m_identifiers.size(); } + void addIdentifier(const Identifier& i) { return m_identifiers.append(i); } + const Identifier& identifier(int index) const { return m_identifiers[index]; } + const Vector& identifiers() const { return m_identifiers; } + + size_t numberOfConstantRegisters() const { return m_constantRegisters.size(); } + unsigned addConstant(JSValue v) + { + unsigned result = m_constantRegisters.size(); + m_constantRegisters.append(WriteBarrier()); + m_constantRegisters.last().set(*m_globalData, this, v); + return result; + } + unsigned addOrFindConstant(JSValue); + const Vector >& constantRegisters() { return m_constantRegisters; } + const WriteBarrier& constantRegister(int index) const { return m_constantRegisters[index - FirstConstantRegisterIndex]; } + ALWAYS_INLINE bool isConstantRegisterIndex(int index) const { return index >= FirstConstantRegisterIndex; } + ALWAYS_INLINE JSValue getConstant(int index) const { return m_constantRegisters[index - FirstConstantRegisterIndex].get(); } + + // Jumps + size_t numberOfJumpTargets() const { return m_jumpTargets.size(); } + void addJumpTarget(unsigned jumpTarget) { m_jumpTargets.append(jumpTarget); } + unsigned jumpTarget(int index) const { return m_jumpTargets[index]; } + unsigned lastJumpTarget() const { return m_jumpTargets.last(); } + + void setIsNumericCompareFunction(bool isNumericCompareFunction) { m_isNumericCompareFunction = isNumericCompareFunction; } + bool isNumericCompareFunction() const { return m_isNumericCompareFunction; } + + void shrinkToFit() + { + m_jumpTargets.shrinkToFit(); + m_identifiers.shrinkToFit(); + m_constantRegisters.shrinkToFit(); + m_functionDecls.shrinkToFit(); + m_functionExprs.shrinkToFit(); + m_lineInfo.shrinkToFit(); + m_propertyAccessInstructions.shrinkToFit(); + m_expressionInfo.shrinkToFit(); + +#if ENABLE(BYTECODE_COMMENTS) + m_bytecodeComments.shrinkToFit(); +#endif + if (m_rareData) { + m_rareData->m_exceptionHandlers.shrinkToFit(); + m_rareData->m_regexps.shrinkToFit(); + m_rareData->m_constantBuffers.shrinkToFit(); + m_rareData->m_immediateSwitchJumpTables.shrinkToFit(); + m_rareData->m_characterSwitchJumpTables.shrinkToFit(); + m_rareData->m_stringSwitchJumpTables.shrinkToFit(); + } + } + + unsigned numberOfInstructions() const { return m_unlinkedInstructions.size(); } + RefCountedArray& instructions() { return m_unlinkedInstructions; } + const RefCountedArray& instructions() const { return m_unlinkedInstructions; } + + int m_numVars; + int m_numCapturedVars; + int m_numCalleeRegisters; + + // Jump Tables + + size_t numberOfImmediateSwitchJumpTables() const { return m_rareData ? m_rareData->m_immediateSwitchJumpTables.size() : 0; } + UnlinkedSimpleJumpTable& addImmediateSwitchJumpTable() { createRareDataIfNecessary(); m_rareData->m_immediateSwitchJumpTables.append(UnlinkedSimpleJumpTable()); return m_rareData->m_immediateSwitchJumpTables.last(); } + UnlinkedSimpleJumpTable& immediateSwitchJumpTable(int tableIndex) { ASSERT(m_rareData); return m_rareData->m_immediateSwitchJumpTables[tableIndex]; } + + size_t numberOfCharacterSwitchJumpTables() const { return m_rareData ? m_rareData->m_characterSwitchJumpTables.size() : 0; } + UnlinkedSimpleJumpTable& addCharacterSwitchJumpTable() { createRareDataIfNecessary(); m_rareData->m_characterSwitchJumpTables.append(UnlinkedSimpleJumpTable()); return m_rareData->m_characterSwitchJumpTables.last(); } + UnlinkedSimpleJumpTable& characterSwitchJumpTable(int tableIndex) { ASSERT(m_rareData); return m_rareData->m_characterSwitchJumpTables[tableIndex]; } + + size_t numberOfStringSwitchJumpTables() const { return m_rareData ? m_rareData->m_stringSwitchJumpTables.size() : 0; } + UnlinkedStringJumpTable& addStringSwitchJumpTable() { createRareDataIfNecessary(); m_rareData->m_stringSwitchJumpTables.append(UnlinkedStringJumpTable()); return m_rareData->m_stringSwitchJumpTables.last(); } + UnlinkedStringJumpTable& stringSwitchJumpTable(int tableIndex) { ASSERT(m_rareData); return m_rareData->m_stringSwitchJumpTables[tableIndex]; } + + unsigned addFunctionDecl(UnlinkedFunctionExecutable* n) + { + unsigned size = m_functionDecls.size(); + m_functionDecls.append(WriteBarrier()); + m_functionDecls.last().set(*m_globalData, this, n); + return size; + } + UnlinkedFunctionExecutable* functionDecl(int index) { return m_functionDecls[index].get(); } + size_t numberOfFunctionDecls() { return m_functionDecls.size(); } + unsigned addFunctionExpr(UnlinkedFunctionExecutable* n) + { + unsigned size = m_functionExprs.size(); + m_functionExprs.append(WriteBarrier()); + m_functionExprs.last().set(*m_globalData, this, n); + return size; + } + UnlinkedFunctionExecutable* functionExpr(int index) { return m_functionExprs[index].get(); } + size_t numberOfFunctionExprs() { return m_functionExprs.size(); } + + // Exception handling support + size_t numberOfExceptionHandlers() const { return m_rareData ? m_rareData->m_exceptionHandlers.size() : 0; } + void addExceptionHandler(const UnlinkedHandlerInfo& hanler) { createRareDataIfNecessary(); return m_rareData->m_exceptionHandlers.append(hanler); } + UnlinkedHandlerInfo& exceptionHandler(int index) { ASSERT(m_rareData); return m_rareData->m_exceptionHandlers[index]; } + + SharedSymbolTable* symbolTable() const { return m_symbolTable.get(); } + + JSGlobalData* globalData() const { return m_globalData; } + + unsigned addResolve() { return m_resolveOperationCount++; } + unsigned numberOfResolveOperations() const { return m_resolveOperationCount; } + unsigned addPutToBase() { return m_putToBaseOperationCount++; } + unsigned numberOfPutToBaseOperations() const { return m_putToBaseOperationCount; } + + UnlinkedArrayProfile addArrayProfile() { return m_arrayProfileCount++; } + unsigned numberOfArrayProfiles() { return m_arrayProfileCount; } + UnlinkedValueProfile addValueProfile() { return m_valueProfileCount++; } + unsigned numberOfValueProfiles() { return m_valueProfileCount; } + + UnlinkedLLIntCallLinkInfo addLLIntCallLinkInfo() { return m_llintCallLinkInfoCount++; } + unsigned numberOfLLintCallLinkInfos() { return m_llintCallLinkInfoCount; } + + CodeType codeType() const { return m_codeType; } + + int thisRegister() const { return m_thisRegister; } + int activationRegister() const { return m_activationRegister; } + + + void addPropertyAccessInstruction(unsigned propertyAccessInstruction) + { + m_propertyAccessInstructions.append(propertyAccessInstruction); + } + + size_t numberOfPropertyAccessInstructions() const { return m_propertyAccessInstructions.size(); } + const Vector& propertyAccessInstructions() const { return m_propertyAccessInstructions; } + + typedef Vector ConstantBuffer; + + size_t constantBufferCount() { ASSERT(m_rareData); return m_rareData->m_constantBuffers.size(); } + unsigned addConstantBuffer(unsigned length) + { + createRareDataIfNecessary(); + unsigned size = m_rareData->m_constantBuffers.size(); + m_rareData->m_constantBuffers.append(Vector(length)); + return size; + } + + const ConstantBuffer& constantBuffer(unsigned index) const + { + ASSERT(m_rareData); + return m_rareData->m_constantBuffers[index]; + } + + ConstantBuffer& constantBuffer(unsigned index) + { + ASSERT(m_rareData); + return m_rareData->m_constantBuffers[index]; + } + + bool hasRareData() const { return m_rareData; } + + int lineNumberForBytecodeOffset(unsigned bytecodeOffset); + + void expressionRangeForBytecodeOffset(unsigned bytecodeOffset, int& divot, int& startOffset, int& endOffset); + + void recordParse(CodeFeatures features, bool hasCapturedVariables, unsigned firstLine, unsigned lineCount) + { + m_features = features; + m_hasCapturedVariables = hasCapturedVariables; + m_firstLine = firstLine; + m_lineCount = lineCount; + } + + CodeFeatures codeFeatures() const { return m_features; } + bool hasCapturedVariables() const { return m_hasCapturedVariables; } + unsigned firstLine() const { return m_firstLine; } + unsigned lineCount() const { return m_lineCount; } + +protected: + UnlinkedCodeBlock(JSGlobalData*, Structure*, CodeType, const ExecutableInfo&); + ~UnlinkedCodeBlock(); + + void finishCreation(JSGlobalData& globalData) + { + Base::finishCreation(globalData); + if (codeType() == GlobalCode) + return; + m_symbolTable.set(globalData, this, SharedSymbolTable::create(globalData)); + } + +private: + + void createRareDataIfNecessary() + { + if (!m_rareData) + m_rareData = adoptPtr(new RareData); + } + + RefCountedArray m_unlinkedInstructions; + + int m_numParameters; + JSGlobalData* m_globalData; + + int m_thisRegister; + int m_argumentsRegister; + int m_activationRegister; + + bool m_needsFullScopeChain : 1; + bool m_usesEval : 1; + bool m_isNumericCompareFunction : 1; + bool m_isStrictMode : 1; + bool m_isConstructor : 1; + bool m_hasCapturedVariables : 1; + unsigned m_firstLine; + unsigned m_lineCount; + + CodeFeatures m_features; + CodeType m_codeType; + + Vector m_jumpTargets; + + // Constant Pools + Vector m_identifiers; + Vector > m_constantRegisters; + typedef Vector > FunctionExpressionVector; + FunctionExpressionVector m_functionDecls; + FunctionExpressionVector m_functionExprs; + + WriteBarrier m_symbolTable; + + Vector m_lineInfo; + + Vector m_propertyAccessInstructions; + +#if ENABLE(BYTECODE_COMMENTS) + Vector m_bytecodeComments; + size_t m_bytecodeCommentIterator; +#endif + + unsigned m_resolveOperationCount; + unsigned m_putToBaseOperationCount; + unsigned m_arrayProfileCount; + unsigned m_valueProfileCount; + unsigned m_llintCallLinkInfoCount; + +public: + struct RareData { + WTF_MAKE_FAST_ALLOCATED; + public: + Vector m_exceptionHandlers; + + // Rare Constants + Vector > m_regexps; + + // Buffers used for large array literals + Vector m_constantBuffers; + + // Jump Tables + Vector m_immediateSwitchJumpTables; + Vector m_characterSwitchJumpTables; + Vector m_stringSwitchJumpTables; + + // Expression info - present if debugging. + }; + +private: + OwnPtr m_rareData; + Vector m_expressionInfo; + +protected: + + static const unsigned StructureFlags = OverridesVisitChildren | Base::StructureFlags; + static void visitChildren(JSCell*, SlotVisitor&); + +public: + static const ClassInfo s_info; +}; + +class UnlinkedGlobalCodeBlock : public UnlinkedCodeBlock { +public: + typedef UnlinkedCodeBlock Base; + +protected: + UnlinkedGlobalCodeBlock(JSGlobalData* globalData, Structure* structure, CodeType codeType, const ExecutableInfo& info) + : Base(globalData, structure, codeType, info) + { + } + + static const unsigned StructureFlags = OverridesVisitChildren | Base::StructureFlags; + + static const ClassInfo s_info; +}; + +class UnlinkedProgramCodeBlock : public UnlinkedGlobalCodeBlock { +private: + friend class CodeCache; + static UnlinkedProgramCodeBlock* create(JSGlobalData* globalData, const ExecutableInfo& info) + { + UnlinkedProgramCodeBlock* instance = new (NotNull, allocateCell(globalData->heap)) UnlinkedProgramCodeBlock(globalData, globalData->unlinkedProgramCodeBlockStructure.get(), info); + instance->finishCreation(*globalData); + return instance; + } + +public: + typedef UnlinkedGlobalCodeBlock Base; + static void destroy(JSCell*); + + void addFunctionDeclaration(JSGlobalData& globalData, const Identifier& name, UnlinkedFunctionExecutable* functionExecutable) + { + m_functionDeclarations.append(std::make_pair(name, WriteBarrier(globalData, this, functionExecutable))); + } + + void addVariableDeclaration(const Identifier& name, bool isConstant) + { + m_varDeclarations.append(std::make_pair(name, isConstant)); + } + + typedef Vector > VariableDeclations; + typedef Vector > > FunctionDeclations; + + const VariableDeclations& variableDeclarations() const { return m_varDeclarations; } + const FunctionDeclations& functionDeclarations() const { return m_functionDeclarations; } + + static void visitChildren(JSCell*, SlotVisitor&); + +private: + UnlinkedProgramCodeBlock(JSGlobalData* globalData, Structure* structure, const ExecutableInfo& info) + : Base(globalData, structure, GlobalCode, info) + { + } + + VariableDeclations m_varDeclarations; + FunctionDeclations m_functionDeclarations; + +public: + static Structure* createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue proto) + { + return Structure::create(globalData, globalObject, proto, TypeInfo(UnlinkedProgramCodeBlockType, StructureFlags), &s_info); + } + + static const unsigned StructureFlags = OverridesVisitChildren | Base::StructureFlags; + + static const ClassInfo s_info; +}; + +class UnlinkedEvalCodeBlock : public UnlinkedGlobalCodeBlock { +private: + friend class CodeCache; + + static UnlinkedEvalCodeBlock* create(JSGlobalData* globalData, const ExecutableInfo& info) + { + UnlinkedEvalCodeBlock* instance = new (NotNull, allocateCell(globalData->heap)) UnlinkedEvalCodeBlock(globalData, globalData->unlinkedEvalCodeBlockStructure.get(), info); + instance->finishCreation(*globalData); + return instance; + } + +public: + typedef UnlinkedGlobalCodeBlock Base; + static void destroy(JSCell*); + + const Identifier& variable(unsigned index) { return m_variables[index]; } + unsigned numVariables() { return m_variables.size(); } + void adoptVariables(Vector& variables) + { + ASSERT(m_variables.isEmpty()); + m_variables.swap(variables); + } + +private: + UnlinkedEvalCodeBlock(JSGlobalData* globalData, Structure* structure, const ExecutableInfo& info) + : Base(globalData, structure, EvalCode, info) + { + } + + Vector m_variables; + +public: + static Structure* createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue proto) + { + return Structure::create(globalData, globalObject, proto, TypeInfo(UnlinkedEvalCodeBlockType, StructureFlags), &s_info); + } + + static const unsigned StructureFlags = OverridesVisitChildren | Base::StructureFlags; + + static const ClassInfo s_info; +}; + +class UnlinkedFunctionCodeBlock : public UnlinkedCodeBlock { +private: + friend class CodeCache; + + static UnlinkedFunctionCodeBlock* create(JSGlobalData* globalData, CodeType codeType, const ExecutableInfo& info) + { + UnlinkedFunctionCodeBlock* instance = new (NotNull, allocateCell(globalData->heap)) UnlinkedFunctionCodeBlock(globalData, globalData->unlinkedFunctionCodeBlockStructure.get(), codeType, info); + instance->finishCreation(*globalData); + return instance; + } + +public: + typedef UnlinkedCodeBlock Base; + static void destroy(JSCell*); + +private: + UnlinkedFunctionCodeBlock(JSGlobalData* globalData, Structure* structure, CodeType codeType, const ExecutableInfo& info) + : Base(globalData, structure, codeType, info) + { + } + +public: + static Structure* createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue proto) + { + return Structure::create(globalData, globalObject, proto, TypeInfo(UnlinkedFunctionCodeBlockType, StructureFlags), &s_info); + } + + static const unsigned StructureFlags = OverridesVisitChildren | Base::StructureFlags; + + static const ClassInfo s_info; +}; + +} + +#endif // UnlinkedCodeBlock_h diff --git a/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp b/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp index 228277328..b11872551 100644 --- a/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp +++ b/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp @@ -158,7 +158,7 @@ bool BytecodeGenerator::dumpsGeneratedCode() return s_dumpsGeneratedCode; } -JSObject* BytecodeGenerator::generate() +ParserError BytecodeGenerator::generate() { SamplingRegion samplingRegion("Bytecode Generation"); @@ -169,36 +169,21 @@ JSObject* BytecodeGenerator::generate() for (unsigned i = 0; i < m_tryRanges.size(); ++i) { TryRange& range = m_tryRanges[i]; ASSERT(range.tryData->targetScopeDepth != UINT_MAX); - HandlerInfo info = { - range.start->bind(0, 0), range.end->bind(0, 0), - range.tryData->target->bind(0, 0), range.tryData->targetScopeDepth -#if ENABLE(JIT) - , -#if ENABLE(LLINT) - CodeLocationLabel(MacroAssemblerCodePtr::createFromExecutableAddress(LLInt::getCodePtr(llint_op_catch))) -#else - CodeLocationLabel() -#endif -#endif + UnlinkedHandlerInfo info = { + static_cast(range.start->bind(0, 0)), static_cast(range.end->bind(0, 0)), + static_cast(range.tryData->target->bind(0, 0)), + range.tryData->targetScopeDepth }; m_codeBlock->addExceptionHandler(info); } - m_codeBlock->instructions() = RefCountedArray(m_instructions); - - if (s_dumpsGeneratedCode) - m_codeBlock->dump(m_scope->globalObject()->globalExec()); - -#ifdef NDEBUG - if ((m_codeType == FunctionCode && !m_codeBlock->needsFullScopeChain() && !m_codeBlock->usesArguments()) || m_codeType == EvalCode) - symbolTable().clear(); -#endif + m_codeBlock->instructions() = RefCountedArray(m_instructions); - m_codeBlock->shrinkToFit(CodeBlock::EarlyShrink); + m_codeBlock->shrinkToFit(); if (m_expressionTooDeep) - return createOutOfMemoryError(m_scope->globalObject()); - return 0; + return ParserError::OutOfMemory; + return ParserError::ErrorNone; } bool BytecodeGenerator::addVar(const Identifier& ident, bool isConstant, RegisterID*& r0) @@ -216,51 +201,32 @@ bool BytecodeGenerator::addVar(const Identifier& ident, bool isConstant, Registe return true; } -int BytecodeGenerator::addGlobalVar( - const Identifier& ident, ConstantMode constantMode, FunctionMode functionMode) -{ - UNUSED_PARAM(functionMode); - int index = symbolTable().size(); - SymbolTableEntry newEntry(index, (constantMode == IsConstant) ? ReadOnly : 0); - if (functionMode == IsFunctionToSpecialize) - newEntry.attemptToWatch(); - SymbolTable::AddResult result = symbolTable().add(ident.impl(), newEntry); - if (!result.isNewEntry) { - result.iterator->value.notifyWrite(); - index = result.iterator->value.getIndex(); - } - return index; -} - void BytecodeGenerator::preserveLastVar() { if ((m_firstConstantIndex = m_calleeRegisters.size()) != 0) m_lastVar = &m_calleeRegisters.last(); } -BytecodeGenerator::BytecodeGenerator(ProgramNode* programNode, JSScope* scope, SharedSymbolTable* symbolTable, ProgramCodeBlock* codeBlock, CompilationKind compilationKind) - : m_shouldEmitDebugHooks(scope->globalObject()->debugger()) - , m_shouldEmitProfileHooks(scope->globalObject()->globalObjectMethodTable()->supportsProfiling(scope->globalObject())) - , m_shouldEmitRichSourceInfo(scope->globalObject()->globalObjectMethodTable()->supportsRichSourceInfo(scope->globalObject())) - , m_scope(*scope->globalData(), scope) - , m_symbolTable(symbolTable) +BytecodeGenerator::BytecodeGenerator(JSGlobalData& globalData, ProgramNode* programNode, UnlinkedProgramCodeBlock* codeBlock, DebuggerMode debuggerMode, ProfilerMode profilerMode) + : m_shouldEmitDebugHooks(debuggerMode == DebuggerOn) + , m_shouldEmitProfileHooks(profilerMode == ProfilerOn) #if ENABLE(BYTECODE_COMMENTS) , m_currentCommentString(0) #endif + , m_symbolTable(0) , m_scopeNode(programNode) - , m_codeBlock(codeBlock) + , m_codeBlock(globalData, codeBlock) , m_thisRegister(CallFrame::thisArgumentOffset()) , m_emptyValueRegister(0) , m_finallyDepth(0) , m_dynamicScopeDepth(0) - , m_baseScopeDepth(0) , m_codeType(GlobalCode) , m_nextConstantOffset(0) , m_globalConstantIndex(0) , m_hasCreatedActivation(true) , m_firstLazyFunction(0) , m_lastLazyFunction(0) - , m_globalData(scope->globalData()) + , m_globalData(&globalData) , m_lastOpcodeID(op_end) #ifndef NDEBUG , m_lastOpcodePosition(0) @@ -269,82 +235,48 @@ BytecodeGenerator::BytecodeGenerator(ProgramNode* programNode, JSScope* scope, S , m_usesExceptions(false) , m_expressionTooDeep(false) { - m_globalData->startedCompiling(m_codeBlock); - m_codeBlock->setGlobalObjectConstant(emitLoad(0, JSValue(m_codeBlock->globalObject()))->index()); - if (m_shouldEmitDebugHooks) m_codeBlock->setNeedsFullScopeChain(true); - codeBlock->setGlobalData(m_globalData); - symbolTable->setUsesNonStrictEval(codeBlock->usesEval() && !codeBlock->isStrictMode()); m_codeBlock->setNumParameters(1); // Allocate space for "this" prependComment("entering Program block"); emitOpcode(op_enter); - // FIXME: Move code that modifies the global object to Interpreter::execute. - - if (compilationKind == OptimizingCompilation) - return; - - JSGlobalObject* globalObject = scope->globalObject(); - ExecState* exec = globalObject->globalExec(); - - BatchedTransitionOptimizer optimizer(*m_globalData, globalObject); - const VarStack& varStack = programNode->varStack(); const FunctionStack& functionStack = programNode->functionStack(); - size_t newGlobals = varStack.size() + functionStack.size(); - if (!newGlobals) - return; - globalObject->addRegisters(newGlobals); - for (size_t i = 0; i < functionStack.size(); ++i) { FunctionBodyNode* function = functionStack[i]; - bool propertyDidExist = - globalObject->removeDirect(*m_globalData, function->ident()); // Newly declared functions overwrite existing properties. - - JSValue value = JSFunction::create(exec, FunctionExecutable::create(*m_globalData, function), scope); - int index = addGlobalVar( - function->ident(), IsVariable, - !propertyDidExist ? IsFunctionToSpecialize : NotFunctionOrNotSpecializable); - globalObject->registerAt(index).set(*m_globalData, globalObject, value); + UnlinkedFunctionExecutable* unlinkedFunction = makeFunction(function); + codeBlock->addFunctionDeclaration(*m_globalData, function->ident(), unlinkedFunction); } - for (size_t i = 0; i < varStack.size(); ++i) { - if (globalObject->hasProperty(exec, *varStack[i].first)) - continue; - addGlobalVar( - *varStack[i].first, - (varStack[i].second & DeclarationStacks::IsConstant) ? IsConstant : IsVariable, - NotFunctionOrNotSpecializable); - } + for (size_t i = 0; i < varStack.size(); ++i) + codeBlock->addVariableDeclaration(*varStack[i].first, !!(varStack[i].second & DeclarationStacks::IsConstant)); + } -BytecodeGenerator::BytecodeGenerator(FunctionBodyNode* functionBody, JSScope* scope, SharedSymbolTable* symbolTable, CodeBlock* codeBlock, CompilationKind) - : m_shouldEmitDebugHooks(scope->globalObject()->debugger()) - , m_shouldEmitProfileHooks(scope->globalObject()->globalObjectMethodTable()->supportsProfiling(scope->globalObject())) - , m_shouldEmitRichSourceInfo(scope->globalObject()->globalObjectMethodTable()->supportsRichSourceInfo(scope->globalObject())) - , m_scope(*scope->globalData(), scope) - , m_symbolTable(symbolTable) +BytecodeGenerator::BytecodeGenerator(JSGlobalData& globalData, FunctionBodyNode* functionBody, UnlinkedFunctionCodeBlock* codeBlock, DebuggerMode debuggerMode, ProfilerMode profilerMode) + : m_shouldEmitDebugHooks(debuggerMode == DebuggerOn) + , m_shouldEmitProfileHooks(profilerMode == ProfilerOn) + , m_symbolTable(codeBlock->symbolTable()) #if ENABLE(BYTECODE_COMMENTS) , m_currentCommentString(0) #endif , m_scopeNode(functionBody) - , m_codeBlock(codeBlock) + , m_codeBlock(globalData, codeBlock) , m_activationRegister(0) , m_emptyValueRegister(0) , m_finallyDepth(0) , m_dynamicScopeDepth(0) - , m_baseScopeDepth(0) , m_codeType(FunctionCode) , m_nextConstantOffset(0) , m_globalConstantIndex(0) , m_hasCreatedActivation(false) , m_firstLazyFunction(0) , m_lastLazyFunction(0) - , m_globalData(scope->globalData()) + , m_globalData(&globalData) , m_lastOpcodeID(op_end) #ifndef NDEBUG , m_lastOpcodePosition(0) @@ -353,15 +285,11 @@ BytecodeGenerator::BytecodeGenerator(FunctionBodyNode* functionBody, JSScope* sc , m_usesExceptions(false) , m_expressionTooDeep(false) { - m_globalData->startedCompiling(m_codeBlock); - m_codeBlock->setGlobalObjectConstant(emitLoad(0, JSValue(m_codeBlock->globalObject()))->index()); - if (m_shouldEmitDebugHooks) m_codeBlock->setNeedsFullScopeChain(true); - codeBlock->setGlobalData(m_globalData); - symbolTable->setUsesNonStrictEval(codeBlock->usesEval() && !codeBlock->isStrictMode()); - symbolTable->setParameterCountIncludingThis(functionBody->parameters()->size() + 1); + m_symbolTable->setUsesNonStrictEval(codeBlock->usesEval() && !codeBlock->isStrictMode()); + m_symbolTable->setParameterCountIncludingThis(functionBody->parameters()->size() + 1); prependComment("entering Function block"); emitOpcode(op_enter); @@ -372,7 +300,7 @@ BytecodeGenerator::BytecodeGenerator(FunctionBodyNode* functionBody, JSScope* sc m_codeBlock->setActivationRegister(m_activationRegister->index()); } - symbolTable->setCaptureStart(m_codeBlock->m_numVars); + m_symbolTable->setCaptureStart(m_codeBlock->m_numVars); if (functionBody->usesArguments() || codeBlock->usesEval() || m_shouldEmitDebugHooks) { // May reify arguments object. RegisterID* unmodifiedArgumentsRegister = addVar(); // Anonymous, so it can't be modified by user code. @@ -422,7 +350,7 @@ BytecodeGenerator::BytecodeGenerator(FunctionBodyNode* functionBody, JSScope* sc } if (capturesAnyArgumentByName && !codeBlock->isStrictMode()) { - size_t parameterCount = symbolTable->parameterCount(); + size_t parameterCount = m_symbolTable->parameterCount(); OwnArrayPtr slowArguments = adoptArrayPtr(new SlowArgument[parameterCount]); for (size_t i = 0; i < parameterCount; ++i) { if (!capturedArguments[i]) { @@ -433,7 +361,7 @@ BytecodeGenerator::BytecodeGenerator(FunctionBodyNode* functionBody, JSScope* sc slowArguments[i].status = SlowArgument::Captured; slowArguments[i].index = capturedArguments[i]->index(); } - symbolTable->setSlowArguments(slowArguments.release()); + m_symbolTable->setSlowArguments(slowArguments.release()); } RegisterID* calleeRegister = resolveCallee(functionBody); // May push to the scope chain and/or add a captured var. @@ -474,7 +402,7 @@ BytecodeGenerator::BytecodeGenerator(FunctionBodyNode* functionBody, JSScope* sc instructions().append(m_activationRegister->index()); } - symbolTable->setCaptureEnd(codeBlock->m_numVars); + m_symbolTable->setCaptureEnd(codeBlock->m_numVars); m_firstLazyFunction = codeBlock->m_numVars; for (size_t i = 0; i < functionStack.size(); ++i) { @@ -502,7 +430,7 @@ BytecodeGenerator::BytecodeGenerator(FunctionBodyNode* functionBody, JSScope* sc } if (shouldCaptureAllTheThings) - symbolTable->setCaptureEnd(codeBlock->m_numVars); + m_symbolTable->setCaptureEnd(codeBlock->m_numVars); FunctionParameters& parameters = *functionBody->parameters(); m_parameters.grow(parameters.size() + 1); // reserve space for "this" @@ -532,35 +460,32 @@ BytecodeGenerator::BytecodeGenerator(FunctionBodyNode* functionBody, JSScope* sc emitOpcode(op_create_this); instructions().append(m_thisRegister.index()); } else if (!codeBlock->isStrictMode() && (functionBody->usesThis() || codeBlock->usesEval() || m_shouldEmitDebugHooks)) { - ValueProfile* profile = emitProfiledOpcode(op_convert_this); + UnlinkedValueProfile profile = emitProfiledOpcode(op_convert_this); instructions().append(m_thisRegister.index()); instructions().append(profile); } } -BytecodeGenerator::BytecodeGenerator(EvalNode* evalNode, JSScope* scope, SharedSymbolTable* symbolTable, EvalCodeBlock* codeBlock, CompilationKind) - : m_shouldEmitDebugHooks(scope->globalObject()->debugger()) - , m_shouldEmitProfileHooks(scope->globalObject()->globalObjectMethodTable()->supportsProfiling(scope->globalObject())) - , m_shouldEmitRichSourceInfo(scope->globalObject()->globalObjectMethodTable()->supportsRichSourceInfo(scope->globalObject())) - , m_scope(*scope->globalData(), scope) - , m_symbolTable(symbolTable) +BytecodeGenerator::BytecodeGenerator(JSGlobalData& globalData, EvalNode* evalNode, UnlinkedEvalCodeBlock* codeBlock, DebuggerMode debuggerMode, ProfilerMode profilerMode) + : m_shouldEmitDebugHooks(debuggerMode == DebuggerOn) + , m_shouldEmitProfileHooks(profilerMode == ProfilerOn) + , m_symbolTable(codeBlock->symbolTable()) #if ENABLE(BYTECODE_COMMENTS) , m_currentCommentString(0) #endif , m_scopeNode(evalNode) - , m_codeBlock(codeBlock) + , m_codeBlock(globalData, codeBlock) , m_thisRegister(CallFrame::thisArgumentOffset()) , m_emptyValueRegister(0) , m_finallyDepth(0) , m_dynamicScopeDepth(0) - , m_baseScopeDepth(codeBlock->baseScopeDepth()) , m_codeType(EvalCode) , m_nextConstantOffset(0) , m_globalConstantIndex(0) , m_hasCreatedActivation(true) , m_firstLazyFunction(0) , m_lastLazyFunction(0) - , m_globalData(scope->globalData()) + , m_globalData(&globalData) , m_lastOpcodeID(op_end) #ifndef NDEBUG , m_lastOpcodePosition(0) @@ -569,14 +494,9 @@ BytecodeGenerator::BytecodeGenerator(EvalNode* evalNode, JSScope* scope, SharedS , m_usesExceptions(false) , m_expressionTooDeep(false) { - m_globalData->startedCompiling(m_codeBlock); - m_codeBlock->setGlobalObjectConstant(emitLoad(0, JSValue(m_codeBlock->globalObject()))->index()); - - if (m_shouldEmitDebugHooks || m_baseScopeDepth) - m_codeBlock->setNeedsFullScopeChain(true); + m_codeBlock->setNeedsFullScopeChain(true); - codeBlock->setGlobalData(m_globalData); - symbolTable->setUsesNonStrictEval(codeBlock->usesEval() && !codeBlock->isStrictMode()); + m_symbolTable->setUsesNonStrictEval(codeBlock->usesEval() && !codeBlock->isStrictMode()); m_codeBlock->setNumParameters(1); prependComment("entering Eval block"); @@ -584,7 +504,7 @@ BytecodeGenerator::BytecodeGenerator(EvalNode* evalNode, JSScope* scope, SharedS const DeclarationStacks::FunctionStack& functionStack = evalNode->functionStack(); for (size_t i = 0; i < functionStack.size(); ++i) - m_codeBlock->addFunctionDecl(FunctionExecutable::create(*m_globalData, functionStack[i])); + m_codeBlock->addFunctionDecl(makeFunction(functionStack[i])); const DeclarationStacks::VarStack& varStack = evalNode->varStack(); unsigned numVariables = varStack.size(); @@ -598,7 +518,6 @@ BytecodeGenerator::BytecodeGenerator(EvalNode* evalNode, JSScope* scope, SharedS BytecodeGenerator::~BytecodeGenerator() { - m_globalData->finishedCompiling(m_codeBlock); } RegisterID* BytecodeGenerator::emitInitLazyRegister(RegisterID* reg) @@ -621,17 +540,6 @@ RegisterID* BytecodeGenerator::resolveCallee(FunctionBodyNode* functionBodyNode) instructions().append(addConstant(functionBodyNode->ident())); instructions().append(m_calleeRegister.index()); instructions().append(ReadOnly | DontDelete); - - // Put a mirror object in compilation scope, so compile-time variable resolution sees the property name we'll see at runtime. - m_scope.set(*globalData(), - JSNameScope::create( - m_scope->globalObject()->globalExec(), - functionBodyNode->ident(), - jsUndefined(), - ReadOnly | DontDelete, - m_scope.get() - ) - ); return 0; } @@ -775,7 +683,7 @@ void BytecodeGenerator::emitOpcode(OpcodeID opcodeID) m_lastOpcodePosition = opcodePosition; #endif emitComment(); - instructions().append(globalData()->interpreter->getOpcode(opcodeID)); + instructions().append(opcodeID); m_lastOpcodeID = opcodeID; } @@ -799,21 +707,21 @@ void BytecodeGenerator::prependComment(const char* string) } #endif -ArrayProfile* BytecodeGenerator::newArrayProfile() +UnlinkedArrayProfile BytecodeGenerator::newArrayProfile() { #if ENABLE(VALUE_PROFILER) - return m_codeBlock->addArrayProfile(instructions().size()); + return m_codeBlock->addArrayProfile(); #else return 0; #endif } -ValueProfile* BytecodeGenerator::emitProfiledOpcode(OpcodeID opcodeID) +UnlinkedValueProfile BytecodeGenerator::emitProfiledOpcode(OpcodeID opcodeID) { #if ENABLE(VALUE_PROFILER) - ValueProfile* result = m_codeBlock->addValueProfile(instructions().size()); + UnlinkedValueProfile result = m_codeBlock->addValueProfile(); #else - ValueProfile* result = 0; + UnlinkedValueProfile result = 0; #endif emitOpcode(opcodeID); return result; @@ -843,14 +751,6 @@ void BytecodeGenerator::retrieveLastUnaryOp(int& dstIndex, int& srcIndex) srcIndex = instructions().at(size - 1).u.operand; } -void BytecodeGenerator::retrieveLastUnaryOp(WriteBarrier*& dstPointer, int& srcIndex) -{ - ASSERT(instructions().size() >= 3); - size_t size = instructions().size(); - dstPointer = instructions().at(size - 2).u.registerPointer; - srcIndex = instructions().at(size - 1).u.operand; -} - void ALWAYS_INLINE BytecodeGenerator::rewindBinaryOp() { ASSERT(instructions().size() >= 4); @@ -1339,7 +1239,7 @@ ResolveResult BytecodeGenerator::resolve(const Identifier& property) return ResolveResult::registerResolve(thisRegister(), ResolveResult::ReadOnlyFlag); // Check if the property should be allocated in a register. - if (m_codeType != GlobalCode && shouldOptimizeLocals()) { + if (m_codeType != GlobalCode && shouldOptimizeLocals() && m_symbolTable) { SymbolTableEntry entry = symbolTable().get(property.impl()); if (!entry.isNull()) { if (property == propertyNames().arguments) @@ -1355,7 +1255,7 @@ ResolveResult BytecodeGenerator::resolve(const Identifier& property) ResolveResult BytecodeGenerator::resolveConstDecl(const Identifier& property) { // Register-allocated const declarations. - if (m_codeType != EvalCode && m_codeType != GlobalCode) { + if (m_codeType != EvalCode && m_codeType != GlobalCode && m_symbolTable) { SymbolTableEntry entry = symbolTable().get(property.impl()); if (!entry.isNull()) { unsigned flags = entry.isReadOnly() ? ResolveResult::ReadOnlyFlag : 0; @@ -1397,7 +1297,7 @@ RegisterID* BytecodeGenerator::emitResolve(RegisterID* dst, const ResolveResult& if (resolveResult.isRegister()) return emitGetLocalVar(dst, resolveResult, property); - ValueProfile* profile = emitProfiledOpcode(op_resolve); + UnlinkedValueProfile profile = emitProfiledOpcode(op_resolve); instructions().append(dst->index()); instructions().append(addConstant(property)); instructions().append(getResolveOperations(property)); @@ -1409,7 +1309,7 @@ RegisterID* BytecodeGenerator::emitResolveBase(RegisterID* dst, const ResolveRes { ASSERT_UNUSED(resolveResult, !resolveResult.isRegister()); // We can't optimise at all :-( - ValueProfile* profile = emitProfiledOpcode(op_resolve_base); + UnlinkedValueProfile profile = emitProfiledOpcode(op_resolve_base); instructions().append(dst->index()); instructions().append(addConstant(property)); instructions().append(false); @@ -1423,7 +1323,7 @@ RegisterID* BytecodeGenerator::emitResolveBaseForPut(RegisterID* dst, const Reso { ASSERT_UNUSED(resolveResult, !resolveResult.isRegister()); // We can't optimise at all :-( - ValueProfile* profile = emitProfiledOpcode(op_resolve_base); + UnlinkedValueProfile profile = emitProfiledOpcode(op_resolve_base); instructions().append(dst->index()); instructions().append(addConstant(property)); instructions().append(m_codeBlock->isStrictMode()); @@ -1438,7 +1338,7 @@ RegisterID* BytecodeGenerator::emitResolveBaseForPut(RegisterID* dst, const Reso RegisterID* BytecodeGenerator::emitResolveWithBaseForPut(RegisterID* baseDst, RegisterID* propDst, const ResolveResult& resolveResult, const Identifier& property, NonlocalResolveInfo& verifier) { ASSERT_UNUSED(resolveResult, !resolveResult.isRegister()); - ValueProfile* profile = emitProfiledOpcode(op_resolve_with_base); + UnlinkedValueProfile profile = emitProfiledOpcode(op_resolve_with_base); instructions().append(baseDst->index()); instructions().append(propDst->index()); instructions().append(addConstant(property)); @@ -1458,7 +1358,7 @@ RegisterID* BytecodeGenerator::emitResolveWithThis(RegisterID* baseDst, Register return baseDst; } - ValueProfile* profile = emitProfiledOpcode(op_resolve_with_this); + UnlinkedValueProfile profile = emitProfiledOpcode(op_resolve_with_this); instructions().append(baseDst->index()); instructions().append(propDst->index()); instructions().append(addConstant(property)); @@ -1485,36 +1385,19 @@ RegisterID* BytecodeGenerator::emitGetLocalVar(RegisterID* dst, const ResolveRes RegisterID* BytecodeGenerator::emitInitGlobalConst(const Identifier& identifier, RegisterID* value) { ASSERT(m_codeType == GlobalCode); - JSGlobalObject* globalObject = m_codeBlock->globalObject(); - SymbolTableEntry entry = globalObject->symbolTable()->get(identifier.impl()); - if (entry.isNull()) - return 0; - - if (entry.couldBeWatched()) { - emitOpcode(op_init_global_const_check); - instructions().append(&globalObject->registerAt(entry.getIndex())); - instructions().append(value->index()); - instructions().append(entry.addressOfIsWatched()); - instructions().append(addConstant(identifier)); - return value; - } - - emitOpcode(op_init_global_const); - instructions().append(&globalObject->registerAt(entry.getIndex())); + emitOpcode(op_init_global_const_nop); + instructions().append(0); instructions().append(value->index()); + instructions().append(0); + instructions().append(addConstant(identifier)); return value; } -void BytecodeGenerator::emitMethodCheck() -{ - emitOpcode(op_method_check); -} - RegisterID* BytecodeGenerator::emitGetById(RegisterID* dst, RegisterID* base, const Identifier& property) { m_codeBlock->addPropertyAccessInstruction(instructions().size()); - ValueProfile* profile = emitProfiledOpcode(op_get_by_id); + UnlinkedValueProfile profile = emitProfiledOpcode(op_get_by_id); instructions().append(dst->index()); instructions().append(base->index()); instructions().append(addConstant(property)); @@ -1600,8 +1483,8 @@ RegisterID* BytecodeGenerator::emitDeleteById(RegisterID* dst, RegisterID* base, RegisterID* BytecodeGenerator::emitGetArgumentByVal(RegisterID* dst, RegisterID* base, RegisterID* property) { - ArrayProfile* arrayProfile = newArrayProfile(); - ValueProfile* profile = emitProfiledOpcode(op_get_argument_by_val); + UnlinkedArrayProfile arrayProfile = newArrayProfile(); + UnlinkedValueProfile profile = emitProfiledOpcode(op_get_argument_by_val); instructions().append(dst->index()); ASSERT(base->index() == m_codeBlock->argumentsRegister()); instructions().append(base->index()); @@ -1626,8 +1509,8 @@ RegisterID* BytecodeGenerator::emitGetByVal(RegisterID* dst, RegisterID* base, R return dst; } } - ArrayProfile* arrayProfile = newArrayProfile(); - ValueProfile* profile = emitProfiledOpcode(op_get_by_val); + UnlinkedArrayProfile arrayProfile = newArrayProfile(); + UnlinkedValueProfile profile = emitProfiledOpcode(op_get_by_val); instructions().append(dst->index()); instructions().append(base->index()); instructions().append(property->index()); @@ -1638,7 +1521,7 @@ RegisterID* BytecodeGenerator::emitGetByVal(RegisterID* dst, RegisterID* base, R RegisterID* BytecodeGenerator::emitPutByVal(RegisterID* base, RegisterID* property, RegisterID* value) { - ArrayProfile* arrayProfile = newArrayProfile(); + UnlinkedArrayProfile arrayProfile = newArrayProfile(); emitOpcode(op_put_by_val); instructions().append(base->index()); instructions().append(property->index()); @@ -1708,7 +1591,7 @@ RegisterID* BytecodeGenerator::emitNewArray(RegisterID* dst, ElementNode* elemen if (!hadVariableExpression) { ASSERT(length == checkLength); unsigned constantBufferIndex = addConstantBuffer(length); - JSValue* constantBuffer = m_codeBlock->constantBuffer(constantBufferIndex); + JSValue* constantBuffer = m_codeBlock->constantBuffer(constantBufferIndex).data(); unsigned index = 0; for (ElementNode* n = elements; index < length; n = n->next()) { if (n->value()->isNumber()) @@ -1744,14 +1627,14 @@ RegisterID* BytecodeGenerator::emitNewArray(RegisterID* dst, ElementNode* elemen RegisterID* BytecodeGenerator::emitNewFunction(RegisterID* dst, FunctionBodyNode* function) { - return emitNewFunctionInternal(dst, m_codeBlock->addFunctionDecl(FunctionExecutable::create(*m_globalData, function)), false); + return emitNewFunctionInternal(dst, m_codeBlock->addFunctionDecl(makeFunction(function)), false); } RegisterID* BytecodeGenerator::emitLazyNewFunction(RegisterID* dst, FunctionBodyNode* function) { FunctionOffsetMap::AddResult ptr = m_functionOffsets.add(function, 0); if (ptr.isNewEntry) - ptr.iterator->value = m_codeBlock->addFunctionDecl(FunctionExecutable::create(*m_globalData, function)); + ptr.iterator->value = m_codeBlock->addFunctionDecl(makeFunction(function)); return emitNewFunctionInternal(dst, ptr.iterator->value, true); } @@ -1776,7 +1659,7 @@ RegisterID* BytecodeGenerator::emitNewRegExp(RegisterID* dst, RegExp* regExp) RegisterID* BytecodeGenerator::emitNewFunctionExpression(RegisterID* r0, FuncExprNode* n) { FunctionBodyNode* function = n->body(); - unsigned index = m_codeBlock->addFunctionExpr(FunctionExecutable::create(*m_globalData, function)); + unsigned index = m_codeBlock->addFunctionExpr(makeFunction(function)); createActivationIfNecessary(); emitOpcode(op_new_func_exp); @@ -1927,7 +1810,7 @@ RegisterID* BytecodeGenerator::emitCall(OpcodeID opcodeID, RegisterID* dst, Regi expectedFunction = emitExpectedFunctionSnippet(dst, func, expectedFunction, callArguments, done.get()); // Emit call. - ArrayProfile* arrayProfile = newArrayProfile(); + UnlinkedArrayProfile arrayProfile = newArrayProfile(); emitOpcode(opcodeID); instructions().append(func->index()); // func instructions().append(callArguments.argumentCountIncludingThis()); // argCount @@ -1939,7 +1822,7 @@ RegisterID* BytecodeGenerator::emitCall(OpcodeID opcodeID, RegisterID* dst, Regi #endif instructions().append(arrayProfile); if (dst != ignoredResult()) { - ValueProfile* profile = emitProfiledOpcode(op_call_put_result); + UnlinkedValueProfile profile = emitProfiledOpcode(op_call_put_result); instructions().append(dst->index()); // dst instructions().append(profile); } @@ -1972,7 +1855,7 @@ RegisterID* BytecodeGenerator::emitCallVarargs(RegisterID* dst, RegisterID* func instructions().append(arguments->index()); instructions().append(firstFreeRegister->index()); if (dst != ignoredResult()) { - ValueProfile* profile = emitProfiledOpcode(op_call_put_result); + UnlinkedValueProfile profile = emitProfiledOpcode(op_call_put_result); instructions().append(dst->index()); instructions().append(profile); } @@ -2055,7 +1938,7 @@ RegisterID* BytecodeGenerator::emitConstruct(RegisterID* dst, RegisterID* func, #endif instructions().append(0); if (dst != ignoredResult()) { - ValueProfile* profile = emitProfiledOpcode(op_call_put_result); + UnlinkedValueProfile profile = emitProfiledOpcode(op_call_put_result); instructions().append(dst->index()); // dst instructions().append(profile); } @@ -2131,11 +2014,11 @@ void BytecodeGenerator::pushFinallyContext(StatementNode* finallyBlock) scope.isFinallyBlock = true; FinallyContext context = { finallyBlock, - m_scopeContextStack.size(), - m_switchContextStack.size(), - m_forInContextStack.size(), - m_tryContextStack.size(), - m_labelScopes.size(), + static_cast(m_scopeContextStack.size()), + static_cast(m_switchContextStack.size()), + static_cast(m_forInContextStack.size()), + static_cast(m_tryContextStack.size()), + static_cast(m_labelScopes.size()), m_finallyDepth, m_dynamicScopeDepth }; @@ -2434,7 +2317,7 @@ RegisterID* BytecodeGenerator::popTryAndEmitCatch(TryData* tryData, RegisterID* m_tryContextStack.removeLast(); emitLabel(tryRange.tryData->target.get()); - tryRange.tryData->targetScopeDepth = m_dynamicScopeDepth + m_baseScopeDepth; + tryRange.tryData->targetScopeDepth = m_dynamicScopeDepth; emitOpcode(op_catch); instructions().append(targetRegister->index()); @@ -2443,8 +2326,9 @@ RegisterID* BytecodeGenerator::popTryAndEmitCatch(TryData* tryData, RegisterID* void BytecodeGenerator::emitThrowReferenceError(const String& message) { - emitOpcode(op_throw_reference_error); + emitOpcode(op_throw_static_error); instructions().append(addConstantValue(jsString(globalData(), message))->index()); + instructions().append(true); } void BytecodeGenerator::emitPushNameScope(const Identifier& property, RegisterID* value, unsigned attributes) @@ -2462,7 +2346,7 @@ void BytecodeGenerator::emitPushNameScope(const Identifier& property, RegisterID void BytecodeGenerator::beginSwitch(RegisterID* scrutineeRegister, SwitchInfo::SwitchType type) { - SwitchInfo info = { instructions().size(), type }; + SwitchInfo info = { static_cast(instructions().size()), type }; switch (type) { case SwitchInfo::SwitchImmediate: emitOpcode(op_switch_imm); @@ -2495,7 +2379,7 @@ static int32_t keyForImmediateSwitch(ExpressionNode* node, int32_t min, int32_t return key - min; } -static void prepareJumpTableForImmediateSwitch(SimpleJumpTable& jumpTable, int32_t switchAddress, uint32_t clauseCount, RefPtr