Changeset 154814 in webkit
- Timestamp:
- Aug 29, 2013 9:41:07 AM (11 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 2 added
- 4 deleted
- 35 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/CMakeLists.txt
r154804 r154814 54 54 bytecode/CodeType.cpp 55 55 bytecode/DFGExitProfile.cpp 56 bytecode/DeferredCompilationCallback.cpp57 56 bytecode/ExecutionCounter.cpp 58 57 bytecode/ExitKind.cpp … … 245 244 jit/JITStubs.cpp 246 245 jit/JITThunks.cpp 247 jit/JITToDFGDeferredCompilationCallback.cpp248 246 jit/JumpReplacementWatchpoint.cpp 249 247 jit/ThunkGenerators.cpp -
trunk/Source/JavaScriptCore/ChangeLog
r154804 r154814 1 2013-08-29 Commit Queue <commit-queue@webkit.org> 2 3 Unreviewed, rolling out r154804. 4 http://trac.webkit.org/changeset/154804 5 https://bugs.webkit.org/show_bug.cgi?id=120477 6 7 Broke Windows build (assumes LLInt features not enabled on 8 this build) (Requested by bfulgham on #webkit). 9 10 * CMakeLists.txt: 11 * GNUmakefile.list.am: 12 * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj: 13 * JavaScriptCore.xcodeproj/project.pbxproj: 14 * Target.pri: 15 * bytecode/CodeBlock.cpp: 16 (JSC::CodeBlock::linkIncomingCall): 17 (JSC::CodeBlock::unlinkIncomingCalls): 18 (JSC::CodeBlock::reoptimize): 19 (JSC::ProgramCodeBlock::replacement): 20 (JSC::EvalCodeBlock::replacement): 21 (JSC::FunctionCodeBlock::replacement): 22 (JSC::ProgramCodeBlock::compileOptimized): 23 (JSC::ProgramCodeBlock::replaceWithDeferredOptimizedCode): 24 (JSC::EvalCodeBlock::compileOptimized): 25 (JSC::EvalCodeBlock::replaceWithDeferredOptimizedCode): 26 (JSC::FunctionCodeBlock::compileOptimized): 27 (JSC::FunctionCodeBlock::replaceWithDeferredOptimizedCode): 28 (JSC::ProgramCodeBlock::jitCompileImpl): 29 (JSC::EvalCodeBlock::jitCompileImpl): 30 (JSC::FunctionCodeBlock::jitCompileImpl): 31 * bytecode/CodeBlock.h: 32 (JSC::CodeBlock::jitType): 33 (JSC::CodeBlock::jitCompile): 34 * bytecode/DeferredCompilationCallback.cpp: Removed. 35 * bytecode/DeferredCompilationCallback.h: Removed. 36 * dfg/DFGDriver.cpp: 37 (JSC::DFG::compile): 38 (JSC::DFG::tryCompile): 39 (JSC::DFG::tryCompileFunction): 40 (JSC::DFG::tryFinalizePlan): 41 * dfg/DFGDriver.h: 42 (JSC::DFG::tryCompile): 43 (JSC::DFG::tryCompileFunction): 44 (JSC::DFG::tryFinalizePlan): 45 * dfg/DFGFailedFinalizer.cpp: 46 (JSC::DFG::FailedFinalizer::finalize): 47 (JSC::DFG::FailedFinalizer::finalizeFunction): 48 * dfg/DFGFailedFinalizer.h: 49 * dfg/DFGFinalizer.h: 50 * dfg/DFGJITFinalizer.cpp: 51 (JSC::DFG::JITFinalizer::finalize): 52 (JSC::DFG::JITFinalizer::finalizeFunction): 53 * dfg/DFGJITFinalizer.h: 54 * dfg/DFGOSRExitPreparation.cpp: 55 (JSC::DFG::prepareCodeOriginForOSRExit): 56 * dfg/DFGOperations.cpp: 57 * dfg/DFGPlan.cpp: 58 (JSC::DFG::Plan::Plan): 59 (JSC::DFG::Plan::compileInThreadImpl): 60 (JSC::DFG::Plan::finalize): 61 * dfg/DFGPlan.h: 62 * dfg/DFGSpeculativeJIT32_64.cpp: 63 (JSC::DFG::SpeculativeJIT::compile): 64 * dfg/DFGWorklist.cpp: 65 (JSC::DFG::Worklist::completeAllReadyPlansForVM): 66 (JSC::DFG::Worklist::runThread): 67 * ftl/FTLJITFinalizer.cpp: 68 (JSC::FTL::JITFinalizer::finalize): 69 (JSC::FTL::JITFinalizer::finalizeFunction): 70 * ftl/FTLJITFinalizer.h: 71 * heap/Heap.h: 72 * interpreter/Interpreter.cpp: 73 (JSC::Interpreter::execute): 74 (JSC::Interpreter::executeCall): 75 (JSC::Interpreter::executeConstruct): 76 (JSC::Interpreter::prepareForRepeatCall): 77 * jit/JITDriver.h: Added. 78 (JSC::jitCompileIfAppropriateImpl): 79 (JSC::jitCompileFunctionIfAppropriateImpl): 80 (JSC::jitCompileIfAppropriate): 81 (JSC::jitCompileFunctionIfAppropriate): 82 * jit/JITStubs.cpp: 83 (JSC::DEFINE_STUB_FUNCTION): 84 (JSC::jitCompileFor): 85 (JSC::lazyLinkFor): 86 * jit/JITToDFGDeferredCompilationCallback.cpp: Removed. 87 * jit/JITToDFGDeferredCompilationCallback.h: Removed. 88 * llint/LLIntEntrypoints.cpp: 89 (JSC::LLInt::getFunctionEntrypoint): 90 (JSC::LLInt::getEvalEntrypoint): 91 (JSC::LLInt::getProgramEntrypoint): 92 * llint/LLIntEntrypoints.h: 93 (JSC::LLInt::getEntrypoint): 94 * llint/LLIntSlowPaths.cpp: 95 (JSC::LLInt::jitCompileAndSetHeuristics): 96 (JSC::LLInt::setUpCall): 97 * runtime/ArrayPrototype.cpp: 98 (JSC::isNumericCompareFunction): 99 * runtime/CommonSlowPaths.cpp: 100 * runtime/CompilationResult.cpp: 101 (WTF::printInternal): 102 * runtime/CompilationResult.h: 103 * runtime/Executable.cpp: 104 (JSC::EvalExecutable::compileOptimized): 105 (JSC::EvalExecutable::jitCompile): 106 (JSC::EvalExecutable::compileInternal): 107 (JSC::EvalExecutable::replaceWithDeferredOptimizedCode): 108 (JSC::ProgramExecutable::compileOptimized): 109 (JSC::ProgramExecutable::jitCompile): 110 (JSC::ProgramExecutable::compileInternal): 111 (JSC::ProgramExecutable::replaceWithDeferredOptimizedCode): 112 (JSC::FunctionExecutable::compileOptimizedForCall): 113 (JSC::FunctionExecutable::compileOptimizedForConstruct): 114 (JSC::FunctionExecutable::jitCompileForCall): 115 (JSC::FunctionExecutable::jitCompileForConstruct): 116 (JSC::FunctionExecutable::produceCodeBlockFor): 117 (JSC::FunctionExecutable::compileForCallInternal): 118 (JSC::FunctionExecutable::replaceWithDeferredOptimizedCodeForCall): 119 (JSC::FunctionExecutable::compileForConstructInternal): 120 (JSC::FunctionExecutable::replaceWithDeferredOptimizedCodeForConstruct): 121 * runtime/Executable.h: 122 (JSC::ExecutableBase::offsetOfJITCodeWithArityCheckFor): 123 (JSC::ExecutableBase::offsetOfNumParametersFor): 124 (JSC::ExecutableBase::catchRoutineFor): 125 (JSC::EvalExecutable::compile): 126 (JSC::ProgramExecutable::compile): 127 (JSC::FunctionExecutable::compileForCall): 128 (JSC::FunctionExecutable::compileForConstruct): 129 (JSC::FunctionExecutable::compileFor): 130 (JSC::FunctionExecutable::compileOptimizedFor): 131 (JSC::FunctionExecutable::replaceWithDeferredOptimizedCodeFor): 132 (JSC::FunctionExecutable::jitCompileFor): 133 * runtime/ExecutionHarness.h: Added. 134 (JSC::prepareForExecutionImpl): 135 (JSC::prepareFunctionForExecutionImpl): 136 (JSC::installOptimizedCode): 137 (JSC::prepareForExecution): 138 (JSC::prepareFunctionForExecution): 139 (JSC::replaceWithDeferredOptimizedCode): 140 1 141 2013-08-28 Filip Pizlo <fpizlo@apple.com> 2 142 -
trunk/Source/JavaScriptCore/GNUmakefile.list.am
r154804 r154814 114 114 Source/JavaScriptCore/bytecode/CodeOrigin.cpp \ 115 115 Source/JavaScriptCore/bytecode/CodeOrigin.h \ 116 Source/JavaScriptCore/bytecode/DataFormat.h \ 116 117 Source/JavaScriptCore/bytecode/DFGExitProfile.cpp \ 117 118 Source/JavaScriptCore/bytecode/DFGExitProfile.h \ 118 Source/JavaScriptCore/bytecode/DataFormat.h \119 Source/JavaScriptCore/bytecode/DeferredCompilationCallback.cpp \120 Source/JavaScriptCore/bytecode/DeferredCompilationCallback.h \121 119 Source/JavaScriptCore/bytecode/EvalCodeCache.h \ 122 120 Source/JavaScriptCore/bytecode/ExecutionCounter.cpp \ … … 607 605 Source/JavaScriptCore/jit/JITDisassembler.cpp \ 608 606 Source/JavaScriptCore/jit/JITDisassembler.h \ 607 Source/JavaScriptCore/jit/JITDriver.h \ 609 608 Source/JavaScriptCore/jit/JIT.cpp \ 610 609 Source/JavaScriptCore/jit/JIT.h \ … … 630 629 Source/JavaScriptCore/jit/JITThunks.cpp \ 631 630 Source/JavaScriptCore/jit/JITThunks.h \ 632 Source/JavaScriptCore/jit/JITToDFGDeferredCompilationCallback.cpp \633 Source/JavaScriptCore/jit/JITToDFGDeferredCompilationCallback.h \634 631 Source/JavaScriptCore/jit/JITWriteBarrier.h \ 635 632 Source/JavaScriptCore/jit/JSInterfaceJIT.h \ … … 787 784 Source/JavaScriptCore/runtime/Executable.cpp \ 788 785 Source/JavaScriptCore/runtime/Executable.h \ 786 Source/JavaScriptCore/runtime/ExecutionHarness.h \ 789 787 Source/JavaScriptCore/runtime/Float32Array.h \ 790 788 Source/JavaScriptCore/runtime/Float64Array.h \ -
trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj
r154804 r154814 303 303 <ClCompile Include="..\bytecode\CodeOrigin.cpp" /> 304 304 <ClCompile Include="..\bytecode\CodeType.cpp" /> 305 <ClCompile Include="..\bytecode\DeferredCompilationCallback.cpp" />306 305 <ClCompile Include="..\bytecode\ExecutionCounter.cpp" /> 307 306 <ClCompile Include="..\bytecode\ExitKind.cpp" /> … … 379 378 <ClCompile Include="..\jit\JITStubs.cpp" /> 380 379 <ClCompile Include="..\jit\JITThunks.cpp" /> 381 <ClCompile Include="..\jit\JITToDFGDeferredCompilationCallback.cpp" />382 380 <ClCompile Include="..\jit\JumpReplacementWatchpoint.cpp" /> 383 381 <ClCompile Include="..\jit\ThunkGenerators.cpp" /> … … 626 624 <ClInclude Include="..\bytecode\Comment.h" /> 627 625 <ClInclude Include="..\bytecode\DataFormat.h" /> 628 <ClInclude Include="..\bytecode\DeferredCompilationCallback.h" />629 626 <ClInclude Include="..\bytecode\EvalCodeCache.h" /> 630 627 <ClInclude Include="..\bytecode\ExecutionCounter.h" /> … … 744 741 <ClInclude Include="..\jit\JITCompilationEffort.h" /> 745 742 <ClInclude Include="..\jit\JITDisassembler.h" /> 743 <ClInclude Include="..\jit\JITDriver.h" /> 746 744 <ClInclude Include="..\jit\JITExceptions.h" /> 747 745 <ClInclude Include="..\jit\JITInlines.h" /> … … 753 751 <ClInclude Include="..\jit\JITStubsX86_64.h" /> 754 752 <ClInclude Include="..\jit\JITThunks.h" /> 755 <ClInclude Include="..\jit\JITToDFGDeferredCompilationCallback.h" />756 753 <ClInclude Include="..\jit\JITWriteBarrier.h" /> 757 754 <ClInclude Include="..\jit\JSInterfaceJIT.h" /> … … 841 838 <ClInclude Include="..\runtime\ExceptionHelpers.h" /> 842 839 <ClInclude Include="..\runtime\Executable.h" /> 840 <ClInclude Include="..\runtime\ExecutionHarness.h" /> 843 841 <ClInclude Include="..\runtime\Float32Array.h" /> 844 842 <ClInclude Include="..\runtime\Float64Array.h" /> -
trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
r154804 r154814 87 87 0F1E3A471534CBB9000F9456 /* DFGDoubleFormatState.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F1E3A441534CBAD000F9456 /* DFGDoubleFormatState.h */; settings = {ATTRIBUTES = (Private, ); }; }; 88 88 0F1E3A67153A21E2000F9456 /* DFGSilentRegisterSavePlan.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F1E3A65153A21DF000F9456 /* DFGSilentRegisterSavePlan.h */; settings = {ATTRIBUTES = (Private, ); }; }; 89 0F21C26814BE5F6800ADC64B /* JITDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F21C26614BE5F5E00ADC64B /* JITDriver.h */; settings = {ATTRIBUTES = (Private, ); }; }; 90 0F21C27C14BE727600ADC64B /* ExecutionHarness.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F21C27A14BE727300ADC64B /* ExecutionHarness.h */; settings = {ATTRIBUTES = (Private, ); }; }; 89 91 0F21C27D14BE727A00ADC64B /* CodeSpecializationKind.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F21C27914BE727300ADC64B /* CodeSpecializationKind.h */; settings = {ATTRIBUTES = (Private, ); }; }; 90 92 0F21C27F14BEAA8200ADC64B /* BytecodeConventions.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F21C27E14BEAA8000ADC64B /* BytecodeConventions.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 346 348 0FC097A1146B28CA00CF2442 /* DFGThunks.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FC0979F146B28C700CF2442 /* DFGThunks.cpp */; }; 347 349 0FC097A2146B28CC00CF2442 /* DFGThunks.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FC097A0146B28C700CF2442 /* DFGThunks.h */; settings = {ATTRIBUTES = (Private, ); }; }; 348 0FC712DE17CD8779008CC93C /* DeferredCompilationCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FC712DC17CD8778008CC93C /* DeferredCompilationCallback.cpp */; };349 0FC712DF17CD877C008CC93C /* DeferredCompilationCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FC712DD17CD8778008CC93C /* DeferredCompilationCallback.h */; settings = {ATTRIBUTES = (Private, ); }; };350 0FC712E217CD8791008CC93C /* JITToDFGDeferredCompilationCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FC712E017CD878F008CC93C /* JITToDFGDeferredCompilationCallback.cpp */; };351 0FC712E317CD8793008CC93C /* JITToDFGDeferredCompilationCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FC712E117CD878F008CC93C /* JITToDFGDeferredCompilationCallback.h */; settings = {ATTRIBUTES = (Private, ); }; };352 350 0FC8150A14043BF500CFA603 /* WriteBarrierSupport.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FC8150914043BD200CFA603 /* WriteBarrierSupport.h */; settings = {ATTRIBUTES = (Private, ); }; }; 353 351 0FC8150B14043C0E00CFA603 /* WriteBarrierSupport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FC8150814043BCA00CFA603 /* WriteBarrierSupport.cpp */; }; … … 1246 1244 0F1E3A501537C2CB000F9456 /* DFGSlowPathGenerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGSlowPathGenerator.h; path = dfg/DFGSlowPathGenerator.h; sourceTree = "<group>"; }; 1247 1245 0F1E3A65153A21DF000F9456 /* DFGSilentRegisterSavePlan.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGSilentRegisterSavePlan.h; path = dfg/DFGSilentRegisterSavePlan.h; sourceTree = "<group>"; }; 1246 0F21C26614BE5F5E00ADC64B /* JITDriver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITDriver.h; sourceTree = "<group>"; }; 1248 1247 0F21C27914BE727300ADC64B /* CodeSpecializationKind.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CodeSpecializationKind.h; sourceTree = "<group>"; }; 1248 0F21C27A14BE727300ADC64B /* ExecutionHarness.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExecutionHarness.h; sourceTree = "<group>"; }; 1249 1249 0F21C27E14BEAA8000ADC64B /* BytecodeConventions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BytecodeConventions.h; sourceTree = "<group>"; }; 1250 1250 0F235BBB17178E1C00690C7F /* FTLCArgumentGetter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FTLCArgumentGetter.cpp; path = ftl/FTLCArgumentGetter.cpp; sourceTree = "<group>"; }; … … 1515 1515 0FC0979F146B28C700CF2442 /* DFGThunks.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGThunks.cpp; path = dfg/DFGThunks.cpp; sourceTree = "<group>"; }; 1516 1516 0FC097A0146B28C700CF2442 /* DFGThunks.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGThunks.h; path = dfg/DFGThunks.h; sourceTree = "<group>"; }; 1517 0FC712DC17CD8778008CC93C /* DeferredCompilationCallback.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = DeferredCompilationCallback.cpp; sourceTree = "<group>"; };1518 0FC712DD17CD8778008CC93C /* DeferredCompilationCallback.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DeferredCompilationCallback.h; sourceTree = "<group>"; };1519 0FC712E017CD878F008CC93C /* JITToDFGDeferredCompilationCallback.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JITToDFGDeferredCompilationCallback.cpp; sourceTree = "<group>"; };1520 0FC712E117CD878F008CC93C /* JITToDFGDeferredCompilationCallback.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JITToDFGDeferredCompilationCallback.h; sourceTree = "<group>"; };1521 1517 0FC8150814043BCA00CFA603 /* WriteBarrierSupport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WriteBarrierSupport.cpp; sourceTree = "<group>"; }; 1522 1518 0FC8150914043BD200CFA603 /* WriteBarrierSupport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WriteBarrierSupport.h; sourceTree = "<group>"; }; … … 2641 2637 0FAF7EFA165BA919000C8455 /* JITDisassembler.cpp */, 2642 2638 0FAF7EFB165BA919000C8455 /* JITDisassembler.h */, 2639 0F21C26614BE5F5E00ADC64B /* JITDriver.h */, 2643 2640 0F46807F14BA572700BFE272 /* JITExceptions.cpp */, 2644 2641 0F46808014BA572700BFE272 /* JITExceptions.h */, … … 2662 2659 0F5EF91B16878F78003E5C25 /* JITThunks.cpp */, 2663 2660 0F5EF91C16878F78003E5C25 /* JITThunks.h */, 2664 0FC712E017CD878F008CC93C /* JITToDFGDeferredCompilationCallback.cpp */,2665 0FC712E117CD878F008CC93C /* JITToDFGDeferredCompilationCallback.h */,2666 2661 A76F54A213B28AAB00EF2BCE /* JITWriteBarrier.h */, 2667 2662 A76C51741182748D00715B05 /* JSInterfaceJIT.h */, … … 3046 3041 86CA032D1038E8440028A609 /* Executable.cpp */, 3047 3042 86CAFEE21035DDE60028A609 /* Executable.h */, 3043 0F21C27A14BE727300ADC64B /* ExecutionHarness.h */, 3048 3044 A7A8AF2917ADB5F3005AB174 /* Float32Array.h */, 3049 3045 A7A8AF2A17ADB5F3005AB174 /* Float64Array.h */, … … 3653 3649 0F0B83A514BCF50400885B4F /* CodeType.h */, 3654 3650 0F426A4A1460CD6B00131F8F /* DataFormat.h */, 3655 0FC712DC17CD8778008CC93C /* DeferredCompilationCallback.cpp */,3656 0FC712DD17CD8778008CC93C /* DeferredCompilationCallback.h */,3657 3651 0FBC0AE41496C7C100D4FBDD /* DFGExitProfile.cpp */, 3658 3652 0FBC0AE51496C7C100D4FBDD /* DFGExitProfile.h */, … … 3803 3797 0F426A4B1460CD6E00131F8F /* DataFormat.h in Headers */, 3804 3798 0F2B66DF17B6B5AB00A7AE3F /* DataView.h in Headers */, 3805 0FC712DF17CD877C008CC93C /* DeferredCompilationCallback.h in Headers */,3806 3799 BCD2034A0E17135E002C7E82 /* DateConstructor.h in Headers */, 3807 3800 41359CF30FDD89AD00206180 /* DateConversion.h in Headers */, … … 3945 3938 A766B44F0EE8DCD1009518CA /* ExecutableAllocator.h in Headers */, 3946 3939 0F56A1D315000F35002992B1 /* ExecutionCounter.h in Headers */, 3940 0F21C27C14BE727600ADC64B /* ExecutionHarness.h in Headers */, 3947 3941 0FB105861675481200F8AB6E /* ExitKind.h in Headers */, 3948 3942 0F0B83AB14BCF5BB00885B4F /* ExpressionRangeInfo.h in Headers */, … … 4033 4027 0F0776BF14FF002B00102332 /* JITCompilationEffort.h in Headers */, 4034 4028 0FAF7EFE165BA91F000C8455 /* JITDisassembler.h in Headers */, 4029 0F21C26814BE5F6800ADC64B /* JITDriver.h in Headers */, 4035 4030 0F46808214BA572D00BFE272 /* JITExceptions.h in Headers */, 4036 4031 86CC85A10EE79A4700288682 /* JITInlines.h in Headers */, … … 4102 4097 BC18C4250E16F5CD00B34460 /* JSObjectRef.h in Headers */, 4103 4098 A7280A2811557E3000D56957 /* JSObjectRefPrivate.h in Headers */, 4104 0FC712E317CD8793008CC93C /* JITToDFGDeferredCompilationCallback.h in Headers */,4105 4099 A7F9935F0FD7325100A0B2D0 /* JSONObject.h in Headers */, 4106 4100 BC87CDB910712AD4000614CF /* JSONObject.lut.h in Headers */, … … 5016 5010 148F21BC107EC54D0042EC2C /* Parser.cpp in Sources */, 5017 5011 93052C340FB792190048FDC3 /* ParserArena.cpp in Sources */, 5018 0FC712E217CD8791008CC93C /* JITToDFGDeferredCompilationCallback.cpp in Sources */,5019 5012 0F9FC8C314E1B5FE00D52AE0 /* PolymorphicPutByIdList.cpp in Sources */, 5020 5013 0F98206016BFE38100240D02 /* PreciseJumpTargets.cpp in Sources */, … … 5095 5088 14F7256514EE265E00B1652B /* WeakHandleOwner.cpp in Sources */, 5096 5089 14E84FA014EE1ACC00D6D5D4 /* WeakSet.cpp in Sources */, 5097 0FC712DE17CD8779008CC93C /* DeferredCompilationCallback.cpp in Sources */,5098 5090 0F6E5C191724AF3D005C574F /* WebKitLLVMLibraryAnchor.cpp in Sources */, 5099 5091 0FC8150B14043C0E00CFA603 /* WriteBarrierSupport.cpp in Sources */, -
trunk/Source/JavaScriptCore/Target.pri
r154804 r154814 62 62 bytecode/CodeType.cpp \ 63 63 bytecode/DFGExitProfile.cpp \ 64 bytecode/DeferredCompilationCallback.cpp \65 64 bytecode/ExecutionCounter.cpp \ 66 65 bytecode/ExitKind.cpp \ … … 223 222 jit/JITStubs.cpp \ 224 223 jit/JITThunks.cpp \ 225 jit/JITToDFGDeferredCompilationCallback.cpp \226 224 jit/JumpReplacementWatchpoint.cpp \ 227 225 jit/ThunkGenerators.cpp \ -
trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp
r154804 r154814 35 35 #include "DFGCapabilities.h" 36 36 #include "DFGCommon.h" 37 #include "DFGDriver.h"38 37 #include "DFGNode.h" 39 38 #include "DFGRepatch.h" … … 47 46 #include "JSFunction.h" 48 47 #include "JSNameScope.h" 49 #include "LLIntEntrypoints.h"50 48 #include "LowLevelInterpreter.h" 51 49 #include "Operations.h" … … 2539 2537 m_incomingCalls.push(incoming); 2540 2538 } 2541 #endif // ENABLE(JIT)2542 2539 2543 2540 void CodeBlock::unlinkIncomingCalls() … … 2546 2543 while (m_incomingLLIntCalls.begin() != m_incomingLLIntCalls.end()) 2547 2544 m_incomingLLIntCalls.begin()->unlink(); 2548 #endif // ENABLE(LLINT) 2549 #if ENABLE(JIT) 2545 #endif 2550 2546 if (m_incomingCalls.isEmpty()) 2551 2547 return; … … 2553 2549 while (m_incomingCalls.begin() != m_incomingCalls.end()) 2554 2550 m_incomingCalls.begin()->unlink(*m_vm, repatchBuffer); 2551 } 2555 2552 #endif // ENABLE(JIT) 2556 }2557 2553 2558 2554 #if ENABLE(LLINT) … … 2694 2690 } 2695 2691 2696 CompilationResult CodeBlock::prepareForExecutionImpl(2697 ExecState* exec, JITCode::JITType jitType, JITCompilationEffort effort,2698 unsigned bytecodeIndex, PassRefPtr<DeferredCompilationCallback> callback)2699 {2700 VM& vm = exec->vm();2701 2702 if (jitType == JITCode::InterpreterThunk) {2703 switch (codeType()) {2704 case GlobalCode:2705 LLInt::setProgramEntrypoint(vm, static_cast<ProgramCodeBlock*>(this));2706 break;2707 case EvalCode:2708 LLInt::setEvalEntrypoint(vm, static_cast<EvalCodeBlock*>(this));2709 break;2710 case FunctionCode:2711 LLInt::setFunctionEntrypoint(vm, static_cast<FunctionCodeBlock*>(this));2712 break;2713 }2714 return CompilationSuccessful;2715 }2716 2717 #if ENABLE(JIT)2718 if (JITCode::isOptimizingJIT(jitType)) {2719 ASSERT(effort == JITCompilationCanFail);2720 bool hadCallback = !!callback;2721 CompilationResult result = DFG::tryCompile(exec, this, bytecodeIndex, callback);2722 ASSERT_UNUSED(hadCallback, result != CompilationDeferred || hadCallback);2723 return result;2724 }2725 2726 MacroAssemblerCodePtr jitCodeWithArityCheck;2727 RefPtr<JITCode> jitCode = JIT::compile(&vm, this, effort, &jitCodeWithArityCheck);2728 if (!jitCode)2729 return CompilationFailed;2730 setJITCode(jitCode, jitCodeWithArityCheck);2731 return CompilationSuccessful;2732 #else2733 UNUSED_PARAM(effort);2734 UNUSED_PARAM(bytecodeIndex);2735 UNUSED_PARAM(callback);2736 return CompilationFailed;2737 #endif // ENABLE(JIT)2738 }2739 2740 CompilationResult CodeBlock::prepareForExecution(2741 ExecState* exec, JITCode::JITType jitType,2742 JITCompilationEffort effort, unsigned bytecodeIndex)2743 {2744 CompilationResult result =2745 prepareForExecutionImpl(exec, jitType, effort, bytecodeIndex, 0);2746 ASSERT(result != CompilationDeferred);2747 return result;2748 }2749 2750 CompilationResult CodeBlock::prepareForExecutionAsynchronously(2751 ExecState* exec, JITCode::JITType jitType,2752 PassRefPtr<DeferredCompilationCallback> passedCallback,2753 JITCompilationEffort effort, unsigned bytecodeIndex)2754 {2755 RefPtr<DeferredCompilationCallback> callback = passedCallback;2756 CompilationResult result =2757 prepareForExecutionImpl(exec, jitType, effort, bytecodeIndex, callback);2758 if (result != CompilationDeferred)2759 callback->compilationDidComplete(this, result);2760 return result;2761 }2762 2763 void CodeBlock::install()2764 {2765 ownerExecutable()->installCode(this);2766 }2767 2768 PassRefPtr<CodeBlock> CodeBlock::newReplacement()2769 {2770 return ownerExecutable()->newReplacementCodeBlockFor(specializationKind());2771 }2772 2773 2692 #if ENABLE(JIT) 2774 2693 void CodeBlock::reoptimize() … … 2796 2715 return &static_cast<FunctionExecutable*>(ownerExecutable())->generatedBytecodeFor(m_isConstructor ? CodeForConstruct : CodeForCall); 2797 2716 } 2717 2718 #if ENABLE(DFG_JIT) 2719 JSObject* ProgramCodeBlock::compileOptimized(ExecState* exec, JSScope* scope, CompilationResult& result, unsigned bytecodeIndex) 2720 { 2721 if (JITCode::isHigherTier(replacement()->jitType(), jitType())) { 2722 result = CompilationNotNeeded; 2723 return 0; 2724 } 2725 JSObject* error = static_cast<ProgramExecutable*>(ownerExecutable())->compileOptimized(exec, scope, result, bytecodeIndex); 2726 return error; 2727 } 2728 2729 CompilationResult ProgramCodeBlock::replaceWithDeferredOptimizedCode(PassRefPtr<DFG::Plan> plan) 2730 { 2731 return static_cast<ProgramExecutable*>(ownerExecutable())->replaceWithDeferredOptimizedCode(plan); 2732 } 2733 2734 JSObject* EvalCodeBlock::compileOptimized(ExecState* exec, JSScope* scope, CompilationResult& result, unsigned bytecodeIndex) 2735 { 2736 if (JITCode::isHigherTier(replacement()->jitType(), jitType())) { 2737 result = CompilationNotNeeded; 2738 return 0; 2739 } 2740 JSObject* error = static_cast<EvalExecutable*>(ownerExecutable())->compileOptimized(exec, scope, result, bytecodeIndex); 2741 return error; 2742 } 2743 2744 CompilationResult EvalCodeBlock::replaceWithDeferredOptimizedCode(PassRefPtr<DFG::Plan> plan) 2745 { 2746 return static_cast<EvalExecutable*>(ownerExecutable())->replaceWithDeferredOptimizedCode(plan); 2747 } 2748 2749 JSObject* FunctionCodeBlock::compileOptimized(ExecState* exec, JSScope* scope, CompilationResult& result, unsigned bytecodeIndex) 2750 { 2751 if (JITCode::isHigherTier(replacement()->jitType(), jitType())) { 2752 result = CompilationNotNeeded; 2753 return 0; 2754 } 2755 JSObject* error = static_cast<FunctionExecutable*>(ownerExecutable())->compileOptimizedFor(exec, scope, result, bytecodeIndex, m_isConstructor ? CodeForConstruct : CodeForCall); 2756 return error; 2757 } 2758 2759 CompilationResult FunctionCodeBlock::replaceWithDeferredOptimizedCode(PassRefPtr<DFG::Plan> plan) 2760 { 2761 return static_cast<FunctionExecutable*>(ownerExecutable())->replaceWithDeferredOptimizedCodeFor(plan, m_isConstructor ? CodeForConstruct : CodeForCall); 2762 } 2763 #endif // ENABLE(DFG_JIT) 2798 2764 2799 2765 DFG::CapabilityLevel ProgramCodeBlock::capabilityLevelInternal() … … 2838 2804 { 2839 2805 static_cast<FunctionExecutable*>(ownerExecutable())->jettisonOptimizedCodeFor(*vm(), m_isConstructor ? CodeForConstruct : CodeForCall); 2806 } 2807 2808 CompilationResult ProgramCodeBlock::jitCompileImpl(ExecState* exec) 2809 { 2810 ASSERT(jitType() == JITCode::InterpreterThunk); 2811 ASSERT(this == replacement()); 2812 return static_cast<ProgramExecutable*>(ownerExecutable())->jitCompile(exec); 2813 } 2814 2815 CompilationResult EvalCodeBlock::jitCompileImpl(ExecState* exec) 2816 { 2817 ASSERT(jitType() == JITCode::InterpreterThunk); 2818 ASSERT(this == replacement()); 2819 return static_cast<EvalExecutable*>(ownerExecutable())->jitCompile(exec); 2820 } 2821 2822 CompilationResult FunctionCodeBlock::jitCompileImpl(ExecState* exec) 2823 { 2824 ASSERT(jitType() == JITCode::InterpreterThunk); 2825 ASSERT(this == replacement()); 2826 return static_cast<FunctionExecutable*>(ownerExecutable())->jitCompileFor(exec, m_isConstructor ? CodeForConstruct : CodeForCall); 2840 2827 } 2841 2828 #endif -
trunk/Source/JavaScriptCore/bytecode/CodeBlock.h
r154804 r154814 49 49 #include "DFGOSRExit.h" 50 50 #include "DFGVariableEventStream.h" 51 #include "DeferredCompilationCallback.h"52 51 #include "EvalCodeCache.h" 53 52 #include "ExecutionCounter.h" … … 204 203 unsigned bytecodeOffset(ExecState*, ReturnAddressPtr); 205 204 206 void unlinkIncomingCalls();207 208 205 #if ENABLE(JIT) 209 206 unsigned bytecodeOffsetForCallAtIndex(unsigned index) … … 235 232 #endif // ENABLE(LLINT) 236 233 234 void unlinkIncomingCalls(); 235 237 236 #if ENABLE(DFG_JIT) || ENABLE(LLINT) 238 237 void setJITCodeMap(PassOwnPtr<CompactJITCodeMap> jitCodeMap) … … 266 265 int argumentIndexAfterCapture(size_t argument); 267 266 268 // Prepares this code block for execution. This is synchronous. This compile 269 // may fail, if you passed JITCompilationCanFail. 270 CompilationResult prepareForExecution( 271 ExecState*, JITCode::JITType, 272 JITCompilationEffort = JITCompilationMustSucceed, 273 unsigned bytecodeIndex = UINT_MAX); 274 275 // Use this method for asynchronous compiles. This will do a compile at some 276 // point in time between when you called into this method and some point in the 277 // future. If you're lucky then it might complete before this method returns. 278 // Once it completes, the callback is called with the result. If the compile 279 // did happen to complete before the method returns, the result of the compile 280 // may be returned. If the compile didn't happen to complete yet, or if we 281 // didn't happen to notice that the compile already completed, we return 282 // CompilationDeferred. 283 // 284 // Note that asynchronous compiles don't actually complete unless you call into 285 // DFG::Worklist::completeAllReadyPlansForVM(). You usually force a call to 286 // this on the main thread by listening to the callback's 287 // compilationDidBecomeReadyAsynchronously() notification. Note that this call 288 // happens on another thread. 289 CompilationResult prepareForExecutionAsynchronously( 290 ExecState*, JITCode::JITType, PassRefPtr<DeferredCompilationCallback>, 291 JITCompilationEffort = JITCompilationMustSucceed, 292 unsigned bytecodeIndex = UINT_MAX); 293 294 // Exactly equivalent to codeBlock->ownerExecutable()->installCode(codeBlock); 295 void install(); 296 297 // Exactly equivalent to codeBlock->ownerExecutable()->newReplacementCodeBlockFor(codeBlock->specializationKind()) 298 PassRefPtr<CodeBlock> newReplacement(); 299 267 #if ENABLE(JIT) 300 268 void setJITCode(PassRefPtr<JITCode> code, MacroAssemblerCodePtr codeWithArityCheck) 301 269 { … … 319 287 return result; 320 288 } 321 322 #if ENABLE(JIT)323 289 bool hasBaselineJITProfiling() const 324 290 { 325 291 return jitType() == JITCode::BaselineJIT; 326 292 } 293 #if ENABLE(DFG_JIT) 294 virtual JSObject* compileOptimized(ExecState*, JSScope*, CompilationResult&, unsigned bytecodeIndex) = 0; 295 virtual CompilationResult replaceWithDeferredOptimizedCode(PassRefPtr<DFG::Plan>) = 0; 296 #endif // ENABLE(DFG_JIT) 327 297 void jettison(); 328 298 CompilationResult jitCompile(ExecState* exec) 299 { 300 if (jitType() != JITCode::InterpreterThunk) { 301 ASSERT(jitType() == JITCode::BaselineJIT); 302 return CompilationNotNeeded; 303 } 304 return jitCompileImpl(exec); 305 } 329 306 virtual CodeBlock* replacement() = 0; 330 307 … … 339 316 340 317 bool hasOptimizedReplacement(); 318 #else 319 JITCode::JITType jitType() const { return JITCode::InterpreterThunk; } 341 320 #endif 342 321 … … 991 970 protected: 992 971 #if ENABLE(JIT) 972 virtual CompilationResult jitCompileImpl(ExecState*) = 0; 993 973 virtual void jettisonImpl() = 0; 994 974 #endif … … 1004 984 private: 1005 985 friend class DFGCodeBlocks; 1006 1007 CompilationResult prepareForExecutionImpl(1008 ExecState*, JITCode::JITType, JITCompilationEffort, unsigned bytecodeIndex,1009 PassRefPtr<DeferredCompilationCallback>);1010 986 1011 987 void noticeIncomingCall(ExecState* callerFrame); … … 1110 1086 SentinelLinkedList<LLIntCallLinkInfo, BasicRawSentinelNode<LLIntCallLinkInfo> > m_incomingLLIntCalls; 1111 1087 #endif 1112 RefPtr<JITCode> m_jitCode;1113 MacroAssemblerCodePtr m_jitCodeWithArityCheck;1114 1088 #if ENABLE(JIT) 1115 1089 Vector<StructureStubInfo> m_structureStubInfos; 1116 1090 Vector<ByValInfo> m_byValInfos; 1117 1091 Vector<CallLinkInfo> m_callLinkInfos; 1092 RefPtr<JITCode> m_jitCode; 1093 MacroAssemblerCodePtr m_jitCodeWithArityCheck; 1118 1094 SentinelLinkedList<CallLinkInfo, BasicRawSentinelNode<CallLinkInfo> > m_incomingCalls; 1119 1095 #endif … … 1219 1195 #if ENABLE(JIT) 1220 1196 protected: 1197 #if ENABLE(DFG_JIT) 1198 virtual JSObject* compileOptimized(ExecState*, JSScope*, CompilationResult&, unsigned bytecodeIndex); 1199 virtual CompilationResult replaceWithDeferredOptimizedCode(PassRefPtr<DFG::Plan>); 1200 #endif // ENABLE(DFG_JIT) 1201 1221 1202 virtual void jettisonImpl(); 1203 virtual CompilationResult jitCompileImpl(ExecState*); 1222 1204 virtual CodeBlock* replacement(); 1223 1205 virtual DFG::CapabilityLevel capabilityLevelInternal(); … … 1242 1224 #if ENABLE(JIT) 1243 1225 protected: 1226 #if ENABLE(DFG_JIT) 1227 virtual JSObject* compileOptimized(ExecState*, JSScope*, CompilationResult&, unsigned bytecodeIndex); 1228 virtual CompilationResult replaceWithDeferredOptimizedCode(PassRefPtr<DFG::Plan>); 1229 #endif // ENABLE(DFG_JIT) 1230 1244 1231 virtual void jettisonImpl(); 1232 virtual CompilationResult jitCompileImpl(ExecState*); 1245 1233 virtual CodeBlock* replacement(); 1246 1234 virtual DFG::CapabilityLevel capabilityLevelInternal(); … … 1265 1253 #if ENABLE(JIT) 1266 1254 protected: 1255 #if ENABLE(DFG_JIT) 1256 virtual JSObject* compileOptimized(ExecState*, JSScope*, CompilationResult&, unsigned bytecodeIndex); 1257 virtual CompilationResult replaceWithDeferredOptimizedCode(PassRefPtr<DFG::Plan>); 1258 #endif // ENABLE(DFG_JIT) 1259 1267 1260 virtual void jettisonImpl(); 1261 virtual CompilationResult jitCompileImpl(ExecState*); 1268 1262 virtual CodeBlock* replacement(); 1269 1263 virtual DFG::CapabilityLevel capabilityLevelInternal(); -
trunk/Source/JavaScriptCore/dfg/DFGDriver.cpp
r154804 r154814 56 56 } 57 57 58 CompilationResult tryCompile(ExecState* exec, CodeBlock* codeBlock, unsigned osrEntryBytecodeIndex, PassRefPtr<DeferredCompilationCallback> callback)58 static CompilationResult compile(CompileMode compileMode, ExecState* exec, CodeBlock* codeBlock, RefPtr<JSC::JITCode>& jitCode, MacroAssemblerCodePtr* jitCodeWithArityCheck, unsigned osrEntryBytecodeIndex) 59 59 { 60 60 SamplingRegion samplingRegion("DFG Compilation (Driver)"); … … 100 100 numVarsWithValues = 0; 101 101 RefPtr<Plan> plan = adoptRef( 102 new Plan(co deBlock, osrEntryBytecodeIndex, numVarsWithValues));102 new Plan(compileMode, codeBlock, osrEntryBytecodeIndex, numVarsWithValues)); 103 103 for (size_t i = 0; i < plan->mustHandleValues.size(); ++i) { 104 104 int operand = plan->mustHandleValues.operandForIndex(i); 105 105 if (operandIsArgument(operand) 106 106 && !operandToArgument(operand) 107 && co deBlock->codeType() == FunctionCode107 && compileMode == CompileFunction 108 108 && codeBlock->specializationKind() == CodeForConstruct) { 109 109 // Ugh. If we're in a constructor, the 'this' argument may hold garbage. It will … … 116 116 } 117 117 118 if (enableConcurrentJIT() && callback) { 119 plan->callback = callback; 118 if (enableConcurrentJIT()) { 120 119 if (!vm.worklist) 121 120 vm.worklist = globalWorklist(); … … 127 126 128 127 plan->compileInThread(*vm.dfgState); 129 return plan->finalizeWithoutNotifyingCallback(); 128 return plan->finalize(jitCode, jitCodeWithArityCheck); 129 } 130 131 CompilationResult tryCompile(ExecState* exec, CodeBlock* codeBlock, RefPtr<JSC::JITCode>& jitCode, unsigned bytecodeIndex) 132 { 133 return compile(CompileOther, exec, codeBlock, jitCode, 0, bytecodeIndex); 134 } 135 136 CompilationResult tryCompileFunction(ExecState* exec, CodeBlock* codeBlock, RefPtr<JSC::JITCode>& jitCode, MacroAssemblerCodePtr& jitCodeWithArityCheck, unsigned bytecodeIndex) 137 { 138 return compile(CompileFunction, exec, codeBlock, jitCode, &jitCodeWithArityCheck, bytecodeIndex); 139 } 140 141 CompilationResult tryFinalizePlan(PassRefPtr<Plan> plan, RefPtr<JSC::JITCode>& jitCode, MacroAssemblerCodePtr* jitCodeWithArityCheck) 142 { 143 return plan->finalize(jitCode, jitCodeWithArityCheck); 130 144 } 131 145 -
trunk/Source/JavaScriptCore/dfg/DFGDriver.h
r154804 r154814 43 43 44 44 #if ENABLE(DFG_JIT) 45 CompilationResult tryCompile(ExecState*, CodeBlock*, unsigned osrEntryBytecodeIndex, PassRefPtr<DeferredCompilationCallback>); 45 CompilationResult tryCompile(ExecState*, CodeBlock*, RefPtr<JSC::JITCode>&, unsigned bytecodeIndex); 46 CompilationResult tryCompileFunction(ExecState*, CodeBlock*, RefPtr<JSC::JITCode>&, MacroAssemblerCodePtr& jitCodeWithArityCheck, unsigned bytecodeIndex); 47 CompilationResult tryFinalizePlan(PassRefPtr<Plan>, RefPtr<JSC::JITCode>&, MacroAssemblerCodePtr* jitCodeWithArityCheck); 46 48 #else 47 inline CompilationResult tryCompile(ExecState*, CodeBlock*, unsigned, PassRefPtr<DeferredCompilationCallback>) { return CompilationFailed; } 49 inline CompilationResult tryCompile(ExecState*, CodeBlock*, RefPtr<JSC::JITCode>&, unsigned) { return CompilationFailed; } 50 inline CompilationResult tryCompileFunction(ExecState*, CodeBlock*, RefPtr<JSC::JITCode>&, MacroAssemblerCodePtr&, unsigned) { return CompilationFailed; } 51 inline CompilationResult tryFinalizePlan(PassRefPtr<Plan>, RefPtr<JSC::JITCode>&, MacroAssemblerCodePtr*) 52 { 53 UNREACHABLE_FOR_PLATFORM(); 54 return CompilationFailed; 55 } 48 56 #endif 49 57 -
trunk/Source/JavaScriptCore/dfg/DFGFailedFinalizer.cpp
r154804 r154814 40 40 } 41 41 42 bool FailedFinalizer::finalize( )42 bool FailedFinalizer::finalize(RefPtr<JSC::JITCode>&) 43 43 { 44 44 return false; 45 45 } 46 46 47 bool FailedFinalizer::finalizeFunction( )47 bool FailedFinalizer::finalizeFunction(RefPtr<JSC::JITCode>&, MacroAssemblerCodePtr&) 48 48 { 49 49 return false; -
trunk/Source/JavaScriptCore/dfg/DFGFailedFinalizer.h
r154804 r154814 40 40 virtual ~FailedFinalizer(); 41 41 42 bool finalize( );43 bool finalizeFunction( );42 bool finalize(RefPtr<JSC::JITCode>& entry); 43 bool finalizeFunction(RefPtr<JSC::JITCode>& entry, MacroAssemblerCodePtr& withArityCheck); 44 44 }; 45 45 -
trunk/Source/JavaScriptCore/dfg/DFGFinalizer.h
r154804 r154814 47 47 virtual ~Finalizer(); 48 48 49 virtual bool finalize( ) = 0;50 virtual bool finalizeFunction( ) = 0;49 virtual bool finalize(RefPtr<JSC::JITCode>& entry) = 0; 50 virtual bool finalizeFunction(RefPtr<JSC::JITCode>& entry, MacroAssemblerCodePtr& withArityCheck) = 0; 51 51 52 52 protected: -
trunk/Source/JavaScriptCore/dfg/DFGJITFinalizer.cpp
r154804 r154814 29 29 #if ENABLE(DFG_JIT) 30 30 31 #include "CodeBlock.h"32 31 #include "DFGCommon.h" 33 32 #include "DFGPlan.h" … … 47 46 } 48 47 49 bool JITFinalizer::finalize( )48 bool JITFinalizer::finalize(RefPtr<JSC::JITCode>& entry) 50 49 { 51 50 finalizeCommon(); 52 51 53 52 m_jitCode->initializeCodeRef(m_linkBuffer->finalizeCodeWithoutDisassembly()); 54 m_plan.codeBlock->setJITCode(m_jitCode, MacroAssemblerCodePtr());53 entry = m_jitCode; 55 54 56 55 return true; 57 56 } 58 57 59 bool JITFinalizer::finalizeFunction( )58 bool JITFinalizer::finalizeFunction(RefPtr<JSC::JITCode>& entry, MacroAssemblerCodePtr& withArityCheck) 60 59 { 61 60 finalizeCommon(); 62 61 63 MacroAssemblerCodePtrwithArityCheck = m_linkBuffer->locationOf(m_arityCheck);62 withArityCheck = m_linkBuffer->locationOf(m_arityCheck); 64 63 m_jitCode->initializeCodeRef(m_linkBuffer->finalizeCodeWithoutDisassembly()); 65 m_plan.codeBlock->setJITCode(m_jitCode, withArityCheck);64 entry = m_jitCode; 66 65 67 66 return true; -
trunk/Source/JavaScriptCore/dfg/DFGJITFinalizer.h
r154804 r154814 43 43 virtual ~JITFinalizer(); 44 44 45 bool finalize( );46 bool finalizeFunction( );45 bool finalize(RefPtr<JSC::JITCode>& entry); 46 bool finalizeFunction(RefPtr<JSC::JITCode>& entry, MacroAssemblerCodePtr& withArityCheck); 47 47 48 48 private: -
trunk/Source/JavaScriptCore/dfg/DFGOSRExitPreparation.cpp
r154804 r154814 31 31 #include "CodeBlock.h" 32 32 #include "Executable.h" 33 #include "JITCode.h"34 33 #include "Operations.h" 35 34 … … 38 37 void prepareCodeOriginForOSRExit(ExecState* exec, CodeOrigin codeOrigin) 39 38 { 40 DeferGC deferGC(exec->vm().heap);41 42 39 for (; codeOrigin.inlineCallFrame; codeOrigin = codeOrigin.inlineCallFrame->caller) { 43 40 FunctionExecutable* executable = … … 46 43 codeOrigin.inlineCallFrame->isCall ? CodeForCall : CodeForConstruct); 47 44 48 if (codeBlock->jitType() == JSC::JITCode::BaselineJIT) 49 continue; 50 ASSERT(codeBlock->jitType() == JSC::JITCode::InterpreterThunk); 51 CompilationResult result = codeBlock->prepareForExecution( 52 exec, JSC::JITCode::BaselineJIT, JITCompilationMustSucceed); 53 ASSERT_UNUSED(result, result == CompilationSuccessful); 54 codeBlock->install(); 45 codeBlock->jitCompile(exec); 55 46 } 56 47 } -
trunk/Source/JavaScriptCore/dfg/DFGOperations.cpp
r154804 r154814 1282 1282 else { 1283 1283 FunctionExecutable* functionExecutable = static_cast<FunctionExecutable*>(executable); 1284 JSObject* error = functionExecutable-> prepareForExecution(execCallee, callee->scope(), kind);1284 JSObject* error = functionExecutable->compileFor(execCallee, callee->scope(), kind); 1285 1285 if (error) { 1286 1286 vm->throwException(exec, createStackOverflowError(exec)); … … 1327 1327 if (UNLIKELY(!executable->hasJITCodeFor(kind))) { 1328 1328 FunctionExecutable* functionExecutable = static_cast<FunctionExecutable*>(executable); 1329 JSObject* error = functionExecutable-> prepareForExecution(execCallee, function->scope(), kind);1329 JSObject* error = functionExecutable->compileFor(execCallee, function->scope(), kind); 1330 1330 if (error) { 1331 1331 exec->vm().throwException(execCallee, error); -
trunk/Source/JavaScriptCore/dfg/DFGPlan.cpp
r154804 r154814 81 81 82 82 Plan::Plan( 83 PassRefPtr<CodeBlock> passedCodeBlock, unsigned osrEntryBytecodeIndex,83 CompileMode compileMode, PassRefPtr<CodeBlock> passedCodeBlock, unsigned osrEntryBytecodeIndex, 84 84 unsigned numVarsWithValues) 85 : vm(*passedCodeBlock->vm()) 85 : compileMode(compileMode) 86 , vm(*passedCodeBlock->vm()) 86 87 , codeBlock(passedCodeBlock) 87 88 , osrEntryBytecodeIndex(osrEntryBytecodeIndex) … … 208 209 #if ENABLE(FTL_JIT) 209 210 if (Options::useExperimentalFTL() 210 && co deBlock->codeType() == FunctionCode211 && compileMode == CompileFunction 211 212 && FTL::canCompile(dfg)) { 212 213 … … 255 256 256 257 JITCompiler dataFlowJIT(dfg); 257 if (co deBlock->codeType() == FunctionCode) {258 if (compileMode == CompileFunction) { 258 259 dataFlowJIT.compileFunction(); 259 260 dataFlowJIT.linkFunction(); 260 261 } else { 262 ASSERT(compileMode == CompileOther); 263 261 264 dataFlowJIT.compile(); 262 265 dataFlowJIT.link(); … … 281 284 } 282 285 283 void Plan::notifyReady() 284 { 285 callback->compilationDidBecomeReadyAsynchronously(codeBlock.get()); 286 isCompiled = true; 287 } 288 289 CompilationResult Plan::finalizeWithoutNotifyingCallback() 286 CompilationResult Plan::finalize(RefPtr<JSC::JITCode>& jitCode, MacroAssemblerCodePtr* jitCodeWithArityCheck) 290 287 { 291 288 if (!isStillValid()) … … 293 290 294 291 bool result; 295 if (co deBlock->codeType() == FunctionCode)296 result = finalizer->finalizeFunction( );292 if (compileMode == CompileFunction) 293 result = finalizer->finalizeFunction(jitCode, *jitCodeWithArityCheck); 297 294 else 298 result = finalizer->finalize( );295 result = finalizer->finalize(jitCode); 299 296 300 297 if (!result) 301 298 return CompilationFailed; 302 299 303 reallyAdd( codeBlock->jitCode()->dfgCommon());300 reallyAdd(jitCode->dfgCommon()); 304 301 305 302 return CompilationSuccessful; 306 303 } 307 304 308 void Plan::finalizeAndNotifyCallback()309 {310 callback->compilationDidComplete(codeBlock.get(), finalizeWithoutNotifyingCallback());311 }312 313 305 CodeBlock* Plan::key() 314 306 { -
trunk/Source/JavaScriptCore/dfg/DFGPlan.h
r154804 r154814 37 37 #include "DFGDesiredWriteBarriers.h" 38 38 #include "DFGFinalizer.h" 39 #include "DeferredCompilationCallback.h"40 39 #include "Operands.h" 41 40 #include "ProfilerCompilation.h" … … 50 49 class LongLivedState; 51 50 51 enum CompileMode { CompileFunction, CompileOther }; 52 52 53 #if ENABLE(DFG_JIT) 53 54 54 55 struct Plan : public ThreadSafeRefCounted<Plan> { 55 56 Plan( 56 PassRefPtr<CodeBlock>, unsigned osrEntryBytecodeIndex, unsigned numVarsWithValues); 57 CompileMode compileMode, PassRefPtr<CodeBlock> codeBlock, 58 unsigned osrEntryBytecodeIndex, unsigned numVarsWithValues); 57 59 ~Plan(); 58 60 59 61 void compileInThread(LongLivedState&); 60 62 61 CompilationResult finalizeWithoutNotifyingCallback(); 62 void finalizeAndNotifyCallback(); 63 64 void notifyReady(); 63 CompilationResult finalize(RefPtr<JSC::JITCode>& jitCode, MacroAssemblerCodePtr* jitCodeWithArityCheck); 65 64 66 65 CodeBlock* key(); 67 66 67 const CompileMode compileMode; 68 68 VM& vm; 69 69 RefPtr<CodeBlock> codeBlock; … … 87 87 bool isCompiled; 88 88 89 RefPtr<DeferredCompilationCallback> callback;90 91 89 private: 92 90 enum CompilationPath { FailPath, DFGPath, FTLPath }; -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp
r154804 r154814 3838 3838 } 3839 3839 3840 switch (node->child1().useKind()) { 3841 case CellUse: { 3840 if (isCellSpeculation(node->child1()->prediction())) { 3842 3841 SpeculateCellOperand base(this, node->child1()); 3843 3842 GPRTemporary resultTag(this, base); … … 3856 3855 } 3857 3856 3858 case UntypedUse: { 3859 JSValueOperand base(this, node->child1()); 3860 GPRTemporary resultTag(this, base); 3861 GPRTemporary resultPayload(this); 3862 3863 GPRReg baseTagGPR = base.tagGPR(); 3864 GPRReg basePayloadGPR = base.payloadGPR(); 3865 GPRReg resultTagGPR = resultTag.gpr(); 3866 GPRReg resultPayloadGPR = resultPayload.gpr(); 3867 3868 base.use(); 3869 3870 JITCompiler::Jump notCell = m_jit.branch32(JITCompiler::NotEqual, baseTagGPR, TrustedImm32(JSValue::CellTag)); 3871 3872 cachedGetById(node->codeOrigin, baseTagGPR, basePayloadGPR, resultTagGPR, resultPayloadGPR, node->identifierNumber(), notCell); 3873 3874 jsValueResult(resultTagGPR, resultPayloadGPR, node, UseChildrenCalledExplicitly); 3875 break; 3876 } 3877 3878 default: 3879 RELEASE_ASSERT_NOT_REACHED(); 3880 break; 3881 } 3857 JSValueOperand base(this, node->child1()); 3858 GPRTemporary resultTag(this, base); 3859 GPRTemporary resultPayload(this); 3860 3861 GPRReg baseTagGPR = base.tagGPR(); 3862 GPRReg basePayloadGPR = base.payloadGPR(); 3863 GPRReg resultTagGPR = resultTag.gpr(); 3864 GPRReg resultPayloadGPR = resultPayload.gpr(); 3865 3866 base.use(); 3867 3868 JITCompiler::Jump notCell = m_jit.branch32(JITCompiler::NotEqual, baseTagGPR, TrustedImm32(JSValue::CellTag)); 3869 3870 cachedGetById(node->codeOrigin, baseTagGPR, basePayloadGPR, resultTagGPR, resultPayloadGPR, node->identifierNumber(), notCell); 3871 3872 jsValueResult(resultTagGPR, resultPayloadGPR, node, UseChildrenCalledExplicitly); 3882 3873 break; 3883 3874 } -
trunk/Source/JavaScriptCore/dfg/DFGWorklist.cpp
r154804 r154814 166 166 RELEASE_ASSERT(plan->isCompiled); 167 167 168 plan->finalizeAndNotifyCallback(); 168 CompilationResult compilationResult = 169 profiledBlock->replaceWithDeferredOptimizedCode(plan); 170 RELEASE_ASSERT(compilationResult != CompilationDeferred); 171 profiledBlock->setOptimizationThresholdBasedOnCompilationResult(compilationResult); 169 172 170 173 if (profiledBlock == requestedProfiledBlock) … … 241 244 { 242 245 MutexLocker locker(m_lock); 243 plan->notifyReady(); 246 plan->key()->forceOptimizationSlowPathConcurrently(); 247 plan->isCompiled = true; 244 248 245 249 if (Options::verboseCompilationQueue()) { -
trunk/Source/JavaScriptCore/ftl/FTLJITFinalizer.cpp
r154804 r154814 45 45 } 46 46 47 bool JITFinalizer::finalize( )47 bool JITFinalizer::finalize(RefPtr<JSC::JITCode>&) 48 48 { 49 49 RELEASE_ASSERT_NOT_REACHED(); … … 51 51 } 52 52 53 bool JITFinalizer::finalizeFunction( )53 bool JITFinalizer::finalizeFunction(RefPtr<JSC::JITCode>& entry, MacroAssemblerCodePtr& withArityCheck) 54 54 { 55 55 for (unsigned i = m_jitCode->handles().size(); i--;) { … … 65 65 } // else this function had no OSR exits, so no exit thunks. 66 66 67 MacroAssemblerCodePtrwithArityCheck = m_entrypointLinkBuffer->locationOf(m_arityCheck);67 withArityCheck = m_entrypointLinkBuffer->locationOf(m_arityCheck); 68 68 m_jitCode->initializeCode( 69 69 FINALIZE_DFG_CODE( 70 70 *m_entrypointLinkBuffer, 71 71 ("FTL entrypoint thunk for %s with LLVM generated code at %p", toCString(CodeBlockWithJITType(m_plan.codeBlock.get(), JITCode::FTLJIT)).data(), m_function))); 72 73 m_plan.codeBlock->setJITCode(m_jitCode, withArityCheck); 72 entry = m_jitCode; 74 73 75 74 return true; -
trunk/Source/JavaScriptCore/ftl/FTLJITFinalizer.h
r154804 r154814 66 66 } 67 67 68 bool finalize( );69 bool finalizeFunction( );68 bool finalize(RefPtr<JSC::JITCode>& entry); 69 bool finalizeFunction(RefPtr<JSC::JITCode>& entry, MacroAssemblerCodePtr& withArityCheck); 70 70 71 71 private: -
trunk/Source/JavaScriptCore/heap/Heap.h
r154804 r154814 185 185 186 186 void addReference(JSCell*, ArrayBuffer*); 187 188 bool isDeferred() const { return !!m_deferralDepth; }189 187 190 188 private: -
trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp
r154804 r154814 735 735 return checkedReturn(callFrame->vm().throwException(callFrame, error)); 736 736 737 if (JSObject* error = program-> prepareForExecution(callFrame, scope, CodeForCall))737 if (JSObject* error = program->compile(callFrame, scope)) 738 738 return checkedReturn(callFrame->vm().throwException(callFrame, error)); 739 739 … … 804 804 if (isJSCall) { 805 805 // Compile the callee: 806 JSObject* compileError = callData.js.functionExecutable-> prepareForExecution(callFrame, scope, CodeForCall);806 JSObject* compileError = callData.js.functionExecutable->compileForCall(callFrame, scope); 807 807 if (UNLIKELY(!!compileError)) { 808 808 return checkedReturn(callFrame->vm().throwException(callFrame, compileError)); … … 883 883 if (isJSConstruct) { 884 884 // Compile the callee: 885 JSObject* compileError = constructData.js.functionExecutable-> prepareForExecution(callFrame, scope, CodeForConstruct);885 JSObject* compileError = constructData.js.functionExecutable->compileForConstruct(callFrame, scope); 886 886 if (UNLIKELY(!!compileError)) { 887 887 return checkedReturn(callFrame->vm().throwException(callFrame, compileError)); … … 957 957 958 958 // Compile the callee: 959 JSObject* error = functionExecutable-> prepareForExecution(callFrame, scope, CodeForCall);959 JSObject* error = functionExecutable->compileForCall(callFrame, scope); 960 960 if (error) { 961 961 callFrame->vm().throwException(callFrame, error); … … 1073 1073 } 1074 1074 1075 JSObject* compileError = eval-> prepareForExecution(callFrame, scope, CodeForCall);1075 JSObject* compileError = eval->compile(callFrame, scope); 1076 1076 if (UNLIKELY(!!compileError)) 1077 1077 return checkedReturn(callFrame->vm().throwException(callFrame, compileError)); -
trunk/Source/JavaScriptCore/jit/JITStubs.cpp
r154804 r154814 52 52 #include "JIT.h" 53 53 #include "JITExceptions.h" 54 #include "JITToDFGDeferredCompilationCallback.h"55 54 #include "JSActivation.h" 56 55 #include "JSArray.h" … … 1000 999 dataLog("Considering OSR ", *codeBlock, " -> ", *codeBlock->replacement(), ".\n"); 1001 1000 // If we have an optimized replacement, then it must be the case that we entered 1002 // cti_optimize from a loop. That's because i fthere's an optimized replacement,1001 // cti_optimize from a loop. That's because is there's an optimized replacement, 1003 1002 // then all calls to this function will be relinked to the replacement and so 1004 1003 // the prologue OSR will never fire. … … 1034 1033 dataLog("Triggering optimized compilation of ", *codeBlock, "\n"); 1035 1034 1036 RefPtr<DeferredCompilationCallback> callback = 1037 JITToDFGDeferredCompilationCallback::create(); 1038 RefPtr<CodeBlock> newCodeBlock = codeBlock->newReplacement(); 1039 CompilationResult result = newCodeBlock->prepareForExecutionAsynchronously( 1040 callFrame, JITCode::DFGJIT, callback, JITCompilationCanFail, bytecodeIndex); 1035 JSScope* scope = callFrame->scope(); 1036 CompilationResult result; 1037 JSObject* error = codeBlock->compileOptimized(callFrame, scope, result, bytecodeIndex); 1038 if (Options::verboseOSR()) { 1039 dataLog("Optimizing compilation of ", *codeBlock, " result: ", result, "\n"); 1040 if (error) 1041 dataLog("WARNING: optimized compilation failed with a JS error.\n"); 1042 } 1041 1043 1044 codeBlock->setOptimizationThresholdBasedOnCompilationResult(result); 1042 1045 if (result != CompilationSuccessful) 1043 1046 return; … … 1166 1169 FunctionExecutable* executable = function->jsExecutable(); 1167 1170 JSScope* callDataScopeChain = function->scope(); 1168 JSObject* error = executable-> prepareForExecution(callFrame, callDataScopeChain, kind);1171 JSObject* error = executable->compileFor(callFrame, callDataScopeChain, kind); 1169 1172 if (!error) 1170 1173 return function; … … 1265 1268 else { 1266 1269 FunctionExecutable* functionExecutable = static_cast<FunctionExecutable*>(executable); 1267 if (JSObject* error = functionExecutable-> prepareForExecution(callFrame, callee->scope(), kind)) {1270 if (JSObject* error = functionExecutable->compileFor(callFrame, callee->scope(), kind)) { 1268 1271 callFrame->vm().throwException(callFrame, error); 1269 1272 return 0; … … 1342 1345 FunctionExecutable* functionExecutable = jsCast<FunctionExecutable*>(executable); 1343 1346 JSScope* scopeChain = callee->scope(); 1344 JSObject* error = functionExecutable-> prepareForExecution(callFrame, scopeChain, CodeForCall);1347 JSObject* error = functionExecutable->compileFor(callFrame, scopeChain, CodeForCall); 1345 1348 if (error) { 1346 1349 callFrame->vm().throwException(callFrame, error); -
trunk/Source/JavaScriptCore/llint/LLIntEntrypoints.cpp
r154804 r154814 1 1 /* 2 * Copyright (C) 2012 , 2013Apple Inc. All rights reserved.2 * Copyright (C) 2012 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 29 29 #if ENABLE(LLINT) 30 30 31 #include "CodeBlock.h"32 31 #include "JITCode.h" 32 #include "VM.h" 33 33 #include "JSObject.h" 34 34 #include "LLIntThunks.h" 35 35 #include "LowLevelInterpreter.h" 36 #include "VM.h"37 36 38 37 39 38 namespace JSC { namespace LLInt { 40 39 41 void setFunctionEntrypoint(VM& vm, FunctionCodeBlock* codeBlock)40 void getFunctionEntrypoint(VM& vm, CodeSpecializationKind kind, RefPtr<JITCode>& jitCode, MacroAssemblerCodePtr& arityCheck) 42 41 { 43 CodeSpecializationKind kind = codeBlock->specializationKind();44 45 42 if (!vm.canUseJIT()) { 46 43 if (kind == CodeForCall) { 47 codeBlock->setJITCode( 48 adoptRef(new DirectJITCode(MacroAssemblerCodeRef::createLLIntCodeRef(llint_function_for_call_prologue), JITCode::InterpreterThunk)), 49 MacroAssemblerCodePtr::createLLIntCodePtr(llint_function_for_call_arity_check)); 44 jitCode = adoptRef(new DirectJITCode(MacroAssemblerCodeRef::createLLIntCodeRef(llint_function_for_call_prologue), JITCode::InterpreterThunk)); 45 arityCheck = MacroAssemblerCodePtr::createLLIntCodePtr(llint_function_for_call_arity_check); 50 46 return; 51 47 } 52 48 53 49 ASSERT(kind == CodeForConstruct); 54 codeBlock->setJITCode( 55 adoptRef(new DirectJITCode(MacroAssemblerCodeRef::createLLIntCodeRef(llint_function_for_construct_prologue), JITCode::InterpreterThunk)), 56 MacroAssemblerCodePtr::createLLIntCodePtr(llint_function_for_construct_arity_check)); 50 jitCode = adoptRef(new DirectJITCode(MacroAssemblerCodeRef::createLLIntCodeRef(llint_function_for_construct_prologue), JITCode::InterpreterThunk)); 51 arityCheck = MacroAssemblerCodePtr::createLLIntCodePtr(llint_function_for_construct_arity_check); 57 52 return; 58 53 } … … 60 55 #if ENABLE(JIT) 61 56 if (kind == CodeForCall) { 62 codeBlock->setJITCode( 63 adoptRef(new DirectJITCode(vm.getCTIStub(functionForCallEntryThunkGenerator), JITCode::InterpreterThunk)), 64 vm.getCTIStub(functionForCallArityCheckThunkGenerator).code()); 57 jitCode = adoptRef(new DirectJITCode(vm.getCTIStub(functionForCallEntryThunkGenerator), JITCode::InterpreterThunk)); 58 arityCheck = vm.getCTIStub(functionForCallArityCheckThunkGenerator).code(); 65 59 return; 66 60 } 67 61 68 62 ASSERT(kind == CodeForConstruct); 69 codeBlock->setJITCode( 70 adoptRef(new DirectJITCode(vm.getCTIStub(functionForConstructEntryThunkGenerator), JITCode::InterpreterThunk)), 71 vm.getCTIStub(functionForConstructArityCheckThunkGenerator).code()); 63 jitCode = adoptRef(new DirectJITCode(vm.getCTIStub(functionForConstructEntryThunkGenerator), JITCode::InterpreterThunk)); 64 arityCheck = vm.getCTIStub(functionForConstructArityCheckThunkGenerator).code(); 72 65 #endif // ENABLE(JIT) 73 66 } 74 67 75 void setEvalEntrypoint(VM& vm, EvalCodeBlock* codeBlock)68 void getEvalEntrypoint(VM& vm, RefPtr<JITCode>& jitCode) 76 69 { 77 70 if (!vm.canUseJIT()) { 78 codeBlock->setJITCode( 79 adoptRef(new DirectJITCode(MacroAssemblerCodeRef::createLLIntCodeRef(llint_eval_prologue), JITCode::InterpreterThunk)), 80 MacroAssemblerCodePtr()); 71 jitCode = adoptRef(new DirectJITCode(MacroAssemblerCodeRef::createLLIntCodeRef(llint_eval_prologue), JITCode::InterpreterThunk)); 72 return; 73 } 74 #if ENABLE(JIT) 75 jitCode = adoptRef(new DirectJITCode(vm.getCTIStub(evalEntryThunkGenerator), JITCode::InterpreterThunk)); 76 #endif 77 } 78 79 void getProgramEntrypoint(VM& vm, RefPtr<JITCode>& jitCode) 80 { 81 if (!vm.canUseJIT()) { 82 jitCode = adoptRef(new DirectJITCode(MacroAssemblerCodeRef::createLLIntCodeRef(llint_program_prologue), JITCode::InterpreterThunk)); 81 83 return; 82 84 } 83 85 #if ENABLE(JIT) 84 codeBlock->setJITCode( 85 adoptRef(new DirectJITCode(vm.getCTIStub(evalEntryThunkGenerator), JITCode::InterpreterThunk)), 86 MacroAssemblerCodePtr()); 87 #endif 88 } 89 90 void setProgramEntrypoint(VM& vm, ProgramCodeBlock* codeBlock) 91 { 92 if (!vm.canUseJIT()) { 93 codeBlock->setJITCode( 94 adoptRef(new DirectJITCode(MacroAssemblerCodeRef::createLLIntCodeRef(llint_program_prologue), JITCode::InterpreterThunk)), 95 MacroAssemblerCodePtr()); 96 return; 97 } 98 #if ENABLE(JIT) 99 codeBlock->setJITCode( 100 adoptRef(new DirectJITCode(vm.getCTIStub(programEntryThunkGenerator), JITCode::InterpreterThunk)), 101 MacroAssemblerCodePtr()); 86 jitCode = adoptRef(new DirectJITCode(vm.getCTIStub(programEntryThunkGenerator), JITCode::InterpreterThunk)); 102 87 #endif 103 88 } -
trunk/Source/JavaScriptCore/llint/LLIntEntrypoints.h
r154804 r154814 1 1 /* 2 * Copyright (C) 2012 , 2013Apple Inc. All rights reserved.2 * Copyright (C) 2012 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 38 38 39 39 class EvalCodeBlock; 40 class FunctionCodeBlock;41 40 class VM; 42 41 class MacroAssemblerCodePtr; … … 46 45 namespace LLInt { 47 46 48 void setFunctionEntrypoint(VM&, FunctionCodeBlock*); 49 void setEvalEntrypoint(VM&, EvalCodeBlock*); 50 void setProgramEntrypoint(VM&, ProgramCodeBlock*); 47 void getFunctionEntrypoint(VM&, CodeSpecializationKind, RefPtr<JITCode>&, MacroAssemblerCodePtr& arityCheck); 48 void getEvalEntrypoint(VM&, RefPtr<JITCode>&); 49 void getProgramEntrypoint(VM&, RefPtr<JITCode>&); 50 51 inline void getEntrypoint(VM& vm, EvalCodeBlock*, RefPtr<JITCode>& jitCode) 52 { 53 getEvalEntrypoint(vm, jitCode); 54 } 55 56 inline void getEntrypoint(VM& vm, ProgramCodeBlock*, RefPtr<JITCode>& jitCode) 57 { 58 getProgramEntrypoint(vm, jitCode); 59 } 51 60 52 61 } } // namespace JSC::LLInt -
trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp
r154804 r154814 38 38 #include "Interpreter.h" 39 39 #include "JIT.h" 40 #include "JITDriver.h" 40 41 #include "JSActivation.h" 41 42 #include "JSCJSValue.h" … … 280 281 inline bool jitCompileAndSetHeuristics(CodeBlock* codeBlock, ExecState* exec) 281 282 { 282 DeferGC deferGC(exec->vm().heap);283 284 283 codeBlock->updateAllValueProfilePredictions(); 285 284 … … 290 289 } 291 290 292 switch (codeBlock->jitType()) { 293 case JITCode::BaselineJIT: { 291 CompilationResult result = codeBlock->jitCompile(exec); 292 switch (result) { 293 case CompilationNotNeeded: 294 294 if (Options::verboseOSR()) 295 295 dataLogF(" Code was already compiled.\n"); 296 296 codeBlock->jitSoon(); 297 297 return true; 298 } 299 case JITCode::InterpreterThunk: { 300 CompilationResult result = codeBlock->prepareForExecution( 301 exec, JITCode::BaselineJIT, JITCompilationCanFail); 302 switch (result) { 303 case CompilationFailed: 304 if (Options::verboseOSR()) 305 dataLogF(" JIT compilation failed.\n"); 306 codeBlock->dontJITAnytimeSoon(); 307 return false; 308 case CompilationSuccessful: 309 if (Options::verboseOSR()) 310 dataLogF(" JIT compilation successful.\n"); 311 codeBlock->install(); 312 codeBlock->jitSoon(); 313 return true; 314 default: 315 RELEASE_ASSERT_NOT_REACHED(); 316 return false; 317 } 318 } 298 case CompilationFailed: 299 if (Options::verboseOSR()) 300 dataLogF(" JIT compilation failed.\n"); 301 codeBlock->dontJITAnytimeSoon(); 302 return false; 303 case CompilationSuccessful: 304 if (Options::verboseOSR()) 305 dataLogF(" JIT compilation successful.\n"); 306 codeBlock->jitSoon(); 307 return true; 319 308 default: 320 309 RELEASE_ASSERT_NOT_REACHED(); … … 1016 1005 else { 1017 1006 FunctionExecutable* functionExecutable = static_cast<FunctionExecutable*>(executable); 1018 JSObject* error = functionExecutable-> prepareForExecution(execCallee, callee->scope(), kind);1007 JSObject* error = functionExecutable->compileFor(execCallee, callee->scope(), kind); 1019 1008 if (error) 1020 1009 LLINT_CALL_THROW(execCallee->callerFrame(), pc, error); -
trunk/Source/JavaScriptCore/runtime/ArrayPrototype.cpp
r154804 r154814 79 79 FunctionExecutable* executable = callData.js.functionExecutable; 80 80 81 JSObject* error = executable-> prepareForExecution(exec, callData.js.scope, CodeForCall);81 JSObject* error = executable->compileForCall(exec, callData.js.scope); 82 82 if (error) 83 83 return false; -
trunk/Source/JavaScriptCore/runtime/CommonSlowPaths.cpp
r154804 r154814 38 38 #include "Interpreter.h" 39 39 #include "JIT.h" 40 #include "JITDriver.h" 40 41 #include "JITStubs.h" 41 42 #include "JSActivation.h" -
trunk/Source/JavaScriptCore/runtime/CompilationResult.cpp
r154804 r154814 43 43 out.print("CompilationSuccessful"); 44 44 return; 45 case CompilationNotNeeded: 46 out.print("CompilationNotNeeded"); 47 return; 45 48 case CompilationDeferred: 46 49 out.print("CompilationDeferred"); -
trunk/Source/JavaScriptCore/runtime/CompilationResult.h
r154804 r154814 31 31 namespace JSC { 32 32 33 enum CompilationResult { 34 // We tried to compile the code, but we couldn't compile it. This could be 35 // because we ran out of memory, or because the compiler encountered an 36 // internal error and decided to bail out gracefully. Either way, this implies 37 // that we shouldn't try to compile this code block again. 38 CompilationFailed, 39 40 // The profiling assumptions that were fed into the compiler were invalidated 41 // even before we finished compiling. This means we should try again: in such 42 // cases the profiling will now be updated and the next compilation won't 43 // encounter the same problem. But it does mean that we should exercise 44 // exponential back-off, to get even more profiling so that new profiling 45 // pathologies aren't encountered. 46 CompilationInvalidated, 47 48 // The compilation succeeded and the code block now has JITCode for the newly 49 // compiled code. However, compilation success doesn't mean that the CodeBlock 50 // will execute yet; you typically have to install it first, unless you plan 51 // on invoking it manually (something that *could* be done for some kinds of 52 // OSR entry). 53 CompilationSuccessful, 54 55 // We decided to do the compilation asynchronously. This means that we haven't 56 // yet compiled the code. This only happens when you pass a 57 // DeferredCompilationCallback. That callback will get called with some 58 // interesting result, once compilation completes. 59 CompilationDeferred 60 }; 33 enum CompilationResult { CompilationFailed, CompilationInvalidated, CompilationSuccessful, CompilationNotNeeded, CompilationDeferred }; 61 34 62 35 } // namespace JSC -
trunk/Source/JavaScriptCore/runtime/Executable.cpp
r154804 r154814 1 1 /* 2 * Copyright (C) 2009, 2010 , 2013Apple Inc. All rights reserved.2 * Copyright (C) 2009, 2010 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 31 31 #include "CodeBlock.h" 32 32 #include "DFGDriver.h" 33 #include "ExecutionHarness.h" 33 34 #include "JIT.h" 35 #include "JITDriver.h" 34 36 #include "Operations.h" 35 37 #include "Parser.h" … … 113 115 #endif 114 116 115 void ScriptExecutable::installCode(CodeBlock* genericCodeBlock)116 {117 RELEASE_ASSERT(genericCodeBlock->ownerExecutable() == this);118 119 VM& vm = *genericCodeBlock->vm();120 121 if (vm.m_perBytecodeProfiler)122 vm.m_perBytecodeProfiler->ensureBytecodesFor(genericCodeBlock);123 124 ASSERT(vm.heap.isDeferred());125 126 if (JITCode::isJIT(genericCodeBlock->jitType())) {127 vm.heap.reportExtraMemoryCost(128 sizeof(CodeBlock) + genericCodeBlock->jitCode()->size());129 } else130 vm.heap.reportExtraMemoryCost(sizeof(CodeBlock));131 132 CodeSpecializationKind kind = genericCodeBlock->specializationKind();133 134 RefPtr<CodeBlock> oldCodeBlock;135 136 switch (kind) {137 case CodeForCall:138 m_jitCodeForCall = genericCodeBlock->jitCode();139 m_jitCodeForCallWithArityCheck = genericCodeBlock->jitCodeWithArityCheck();140 m_numParametersForCall = genericCodeBlock->numParameters();141 break;142 case CodeForConstruct:143 m_jitCodeForConstruct = genericCodeBlock->jitCode();144 m_jitCodeForConstructWithArityCheck = genericCodeBlock->jitCodeWithArityCheck();145 m_numParametersForConstruct = genericCodeBlock->numParameters();146 break;147 }148 149 switch (genericCodeBlock->codeType()) {150 case GlobalCode: {151 ProgramExecutable* executable = jsCast<ProgramExecutable*>(this);152 ProgramCodeBlock* codeBlock = static_cast<ProgramCodeBlock*>(genericCodeBlock);153 154 ASSERT(!codeBlock->jitCodeWithArityCheck());155 ASSERT(kind == CodeForCall);156 157 oldCodeBlock = executable->m_programCodeBlock;158 executable->m_programCodeBlock = codeBlock;159 break;160 }161 162 case EvalCode: {163 EvalExecutable* executable = jsCast<EvalExecutable*>(this);164 EvalCodeBlock* codeBlock = static_cast<EvalCodeBlock*>(genericCodeBlock);165 166 ASSERT(!codeBlock->jitCodeWithArityCheck());167 ASSERT(kind == CodeForCall);168 169 oldCodeBlock = executable->m_evalCodeBlock;170 executable->m_evalCodeBlock = codeBlock;171 break;172 }173 174 case FunctionCode: {175 FunctionExecutable* executable = jsCast<FunctionExecutable*>(this);176 FunctionCodeBlock* codeBlock = static_cast<FunctionCodeBlock*>(genericCodeBlock);177 178 switch (kind) {179 case CodeForCall:180 oldCodeBlock = executable->m_codeBlockForCall;181 executable->m_codeBlockForCall = codeBlock;182 break;183 case CodeForConstruct:184 oldCodeBlock = executable->m_codeBlockForConstruct;185 executable->m_codeBlockForConstruct = codeBlock;186 break;187 }188 break;189 } }190 191 if (oldCodeBlock)192 oldCodeBlock->unlinkIncomingCalls();193 }194 195 PassRefPtr<CodeBlock> ScriptExecutable::newCodeBlockFor(196 CodeSpecializationKind kind, JSScope* scope, JSObject*& exception)197 {198 VM* vm = scope->vm();199 200 ASSERT(vm->heap.isDeferred());201 202 if (classInfo() == EvalExecutable::info()) {203 EvalExecutable* executable = jsCast<EvalExecutable*>(this);204 RELEASE_ASSERT(kind == CodeForCall);205 RELEASE_ASSERT(!executable->m_evalCodeBlock);206 return adoptRef(new EvalCodeBlock(207 executable, executable->m_unlinkedEvalCodeBlock.get(), scope,208 executable->source().provider()));209 }210 211 if (classInfo() == ProgramExecutable::info()) {212 ProgramExecutable* executable = jsCast<ProgramExecutable*>(this);213 RELEASE_ASSERT(kind == CodeForCall);214 RELEASE_ASSERT(!executable->m_programCodeBlock);215 return adoptRef(new ProgramCodeBlock(216 executable, executable->m_unlinkedProgramCodeBlock.get(), scope,217 executable->source().provider(), executable->source().startColumn()));218 }219 220 RELEASE_ASSERT(classInfo() == FunctionExecutable::info());221 FunctionExecutable* executable = jsCast<FunctionExecutable*>(this);222 RELEASE_ASSERT(!executable->codeBlockFor(kind));223 JSGlobalObject* globalObject = scope->globalObject();224 ParserError error;225 DebuggerMode debuggerMode = globalObject->hasDebugger() ? DebuggerOn : DebuggerOff;226 ProfilerMode profilerMode = globalObject->hasProfiler() ? ProfilerOn : ProfilerOff;227 UnlinkedFunctionCodeBlock* unlinkedCodeBlock =228 executable->m_unlinkedExecutable->codeBlockFor(229 *vm, executable->m_source, kind, debuggerMode, profilerMode, error);230 if (!unlinkedCodeBlock) {231 exception = vm->throwException(232 globalObject->globalExec(),233 error.toErrorObject(globalObject, executable->m_source));234 return 0;235 }236 237 SourceProvider* provider = executable->source().provider();238 unsigned sourceOffset = executable->source().startOffset();239 unsigned startColumn = executable->source().startColumn();240 241 return adoptRef(new FunctionCodeBlock(242 executable, unlinkedCodeBlock, scope, provider, sourceOffset, startColumn));243 }244 245 PassRefPtr<CodeBlock> ScriptExecutable::newReplacementCodeBlockFor(246 CodeSpecializationKind kind)247 {248 if (classInfo() == EvalExecutable::info()) {249 RELEASE_ASSERT(kind == CodeForCall);250 EvalExecutable* executable = jsCast<EvalExecutable*>(this);251 RefPtr<EvalCodeBlock> result = adoptRef(new EvalCodeBlock(252 CodeBlock::CopyParsedBlock, *executable->m_evalCodeBlock));253 result->setAlternative(executable->m_evalCodeBlock);254 return result;255 }256 257 if (classInfo() == ProgramExecutable::info()) {258 RELEASE_ASSERT(kind == CodeForCall);259 ProgramExecutable* executable = jsCast<ProgramExecutable*>(this);260 RefPtr<ProgramCodeBlock> result = adoptRef(new ProgramCodeBlock(261 CodeBlock::CopyParsedBlock, *executable->m_programCodeBlock));262 result->setAlternative(executable->m_programCodeBlock);263 return result;264 }265 266 RELEASE_ASSERT(classInfo() == FunctionExecutable::info());267 FunctionExecutable* executable = jsCast<FunctionExecutable*>(this);268 RefPtr<FunctionCodeBlock> result = adoptRef(new FunctionCodeBlock(269 CodeBlock::CopyParsedBlock, *executable->codeBlockFor(kind)));270 result->setAlternative(executable->codeBlockFor(kind));271 return result;272 }273 274 JSObject* ScriptExecutable::prepareForExecutionImpl(275 ExecState* exec, JSScope* scope, CodeSpecializationKind kind)276 {277 VM& vm = exec->vm();278 DeferGC deferGC(vm.heap);279 280 JSObject* exception = 0;281 RefPtr<CodeBlock> codeBlock = newCodeBlockFor(kind, scope, exception);282 if (!codeBlock) {283 RELEASE_ASSERT(exception);284 return exception;285 }286 287 JITCode::JITType jitType;288 #if ENABLE(LLINT)289 jitType = JITCode::InterpreterThunk;290 #else291 jitType = JITCode::BaselineJIT;292 #endif293 codeBlock->prepareForExecution(exec, jitType);294 295 installCode(codeBlock.get());296 return 0;297 }298 299 117 const ClassInfo EvalExecutable::s_info = { "EvalExecutable", &ScriptExecutable::s_info, 0, 0, CREATE_METHOD_TABLE(EvalExecutable) }; 300 118 … … 358 176 static_cast<FunctionExecutable*>(cell)->FunctionExecutable::~FunctionExecutable(); 359 177 } 178 179 #if ENABLE(DFG_JIT) 180 JSObject* EvalExecutable::compileOptimized(ExecState* exec, JSScope* scope, CompilationResult& result, unsigned bytecodeIndex) 181 { 182 ASSERT(exec->vm().dynamicGlobalObject); 183 ASSERT(!!m_evalCodeBlock); 184 JSObject* error = 0; 185 if (!JITCode::isOptimizingJIT(m_evalCodeBlock->jitType())) 186 error = compileInternal(exec, scope, JITCode::nextTierJIT(m_evalCodeBlock->jitType()), &result, bytecodeIndex); 187 else 188 result = CompilationNotNeeded; 189 ASSERT(!!m_evalCodeBlock); 190 return error; 191 } 192 #endif // ENABLE(DFG_JIT) 193 194 #if ENABLE(JIT) 195 CompilationResult EvalExecutable::jitCompile(ExecState* exec) 196 { 197 return jitCompileIfAppropriate(exec, m_evalCodeBlock.get(), m_jitCodeForCall, JITCode::bottomTierJIT(), UINT_MAX, JITCompilationCanFail); 198 } 199 #endif 360 200 361 201 inline const char* samplingDescription(JITCode::JITType jitType) … … 376 216 } 377 217 218 JSObject* EvalExecutable::compileInternal(ExecState* exec, JSScope* scope, JITCode::JITType jitType, CompilationResult* result, unsigned bytecodeIndex) 219 { 220 SamplingRegion samplingRegion(samplingDescription(jitType)); 221 222 if (result) 223 *result = CompilationFailed; 224 225 RefPtr<EvalCodeBlock> newCodeBlock; 226 227 if (!!m_evalCodeBlock) { 228 newCodeBlock = adoptRef(new EvalCodeBlock(CodeBlock::CopyParsedBlock, *m_evalCodeBlock)); 229 newCodeBlock->setAlternative(static_pointer_cast<CodeBlock>(m_evalCodeBlock)); 230 } else { 231 newCodeBlock = adoptRef(new EvalCodeBlock(this, m_unlinkedEvalCodeBlock.get(), scope, source().provider())); 232 ASSERT((jitType == JITCode::bottomTierJIT()) == !m_evalCodeBlock); 233 } 234 235 CompilationResult theResult = prepareForExecution( 236 exec, m_evalCodeBlock, newCodeBlock.get(), m_jitCodeForCall, jitType, bytecodeIndex); 237 if (result) 238 *result = theResult; 239 240 return 0; 241 } 242 243 #if ENABLE(DFG_JIT) 244 CompilationResult EvalExecutable::replaceWithDeferredOptimizedCode(PassRefPtr<DFG::Plan> plan) 245 { 246 return JSC::replaceWithDeferredOptimizedCode( 247 plan, m_evalCodeBlock, m_jitCodeForCall, 0, 0); 248 } 249 #endif // ENABLE(DFG_JIT) 250 378 251 #if ENABLE(JIT) 379 252 void EvalExecutable::jettisonOptimizedCode(VM& vm) … … 426 299 } 427 300 301 #if ENABLE(DFG_JIT) 302 JSObject* ProgramExecutable::compileOptimized(ExecState* exec, JSScope* scope, CompilationResult& result, unsigned bytecodeIndex) 303 { 304 RELEASE_ASSERT(exec->vm().dynamicGlobalObject); 305 ASSERT(!!m_programCodeBlock); 306 JSObject* error = 0; 307 if (!JITCode::isOptimizingJIT(m_programCodeBlock->jitType())) 308 error = compileInternal(exec, scope, JITCode::nextTierJIT(m_programCodeBlock->jitType()), &result, bytecodeIndex); 309 else 310 result = CompilationNotNeeded; 311 ASSERT(!!m_programCodeBlock); 312 return error; 313 } 314 #endif // ENABLE(DFG_JIT) 315 316 #if ENABLE(JIT) 317 CompilationResult ProgramExecutable::jitCompile(ExecState* exec) 318 { 319 return jitCompileIfAppropriate(exec, m_programCodeBlock.get(), m_jitCodeForCall, JITCode::bottomTierJIT(), UINT_MAX, JITCompilationCanFail); 320 } 321 #endif 322 323 JSObject* ProgramExecutable::compileInternal(ExecState* exec, JSScope* scope, JITCode::JITType jitType, CompilationResult* result, unsigned bytecodeIndex) 324 { 325 SamplingRegion samplingRegion(samplingDescription(jitType)); 326 327 if (result) 328 *result = CompilationFailed; 329 330 RefPtr<ProgramCodeBlock> newCodeBlock; 331 332 if (!!m_programCodeBlock) { 333 newCodeBlock = adoptRef(new ProgramCodeBlock(CodeBlock::CopyParsedBlock, *m_programCodeBlock)); 334 newCodeBlock->setAlternative(static_pointer_cast<CodeBlock>(m_programCodeBlock)); 335 } else { 336 newCodeBlock = adoptRef(new ProgramCodeBlock(this, m_unlinkedProgramCodeBlock.get(), scope, source().provider(), source().startColumn())); 337 } 338 339 CompilationResult theResult = prepareForExecution( 340 exec, m_programCodeBlock, newCodeBlock.get(), m_jitCodeForCall, jitType, bytecodeIndex); 341 if (result) 342 *result = theResult; 343 344 return 0; 345 } 346 347 #if ENABLE(DFG_JIT) 348 CompilationResult ProgramExecutable::replaceWithDeferredOptimizedCode(PassRefPtr<DFG::Plan> plan) 349 { 350 return JSC::replaceWithDeferredOptimizedCode( 351 plan, m_programCodeBlock, m_jitCodeForCall, 0, 0); 352 } 353 #endif // ENABLE(DFG_JIT) 354 428 355 #if ENABLE(JIT) 429 356 void ProgramExecutable::jettisonOptimizedCode(VM& vm) … … 517 444 return result; 518 445 } 446 447 #if ENABLE(DFG_JIT) 448 JSObject* FunctionExecutable::compileOptimizedForCall(ExecState* exec, JSScope* scope, CompilationResult& result, unsigned bytecodeIndex) 449 { 450 RELEASE_ASSERT(exec->vm().dynamicGlobalObject); 451 ASSERT(!!m_codeBlockForCall); 452 JSObject* error = 0; 453 if (!JITCode::isOptimizingJIT(m_codeBlockForCall->jitType())) 454 error = compileForCallInternal(exec, scope, JITCode::nextTierJIT(m_codeBlockForCall->jitType()), &result, bytecodeIndex); 455 else 456 result = CompilationNotNeeded; 457 ASSERT(!!m_codeBlockForCall); 458 return error; 459 } 460 461 JSObject* FunctionExecutable::compileOptimizedForConstruct(ExecState* exec, JSScope* scope, CompilationResult& result, unsigned bytecodeIndex) 462 { 463 RELEASE_ASSERT(exec->vm().dynamicGlobalObject); 464 ASSERT(!!m_codeBlockForConstruct); 465 JSObject* error = 0; 466 if (!JITCode::isOptimizingJIT(m_codeBlockForConstruct->jitType())) 467 error = compileForConstructInternal(exec, scope, JITCode::nextTierJIT(m_codeBlockForConstruct->jitType()), &result, bytecodeIndex); 468 else 469 result = CompilationNotNeeded; 470 ASSERT(!!m_codeBlockForConstruct); 471 return error; 472 } 473 #endif // ENABLE(DFG_JIT) 474 475 #if ENABLE(JIT) 476 CompilationResult FunctionExecutable::jitCompileForCall(ExecState* exec) 477 { 478 return jitCompileFunctionIfAppropriate(exec, m_codeBlockForCall.get(), m_jitCodeForCall, m_jitCodeForCallWithArityCheck, JITCode::bottomTierJIT(), UINT_MAX, JITCompilationCanFail); 479 } 480 481 CompilationResult FunctionExecutable::jitCompileForConstruct(ExecState* exec) 482 { 483 return jitCompileFunctionIfAppropriate(exec, m_codeBlockForConstruct.get(), m_jitCodeForConstruct, m_jitCodeForConstructWithArityCheck, JITCode::bottomTierJIT(), UINT_MAX, JITCompilationCanFail); 484 } 485 #endif 486 487 PassRefPtr<FunctionCodeBlock> FunctionExecutable::produceCodeBlockFor(JSScope* scope, CodeSpecializationKind specializationKind, JSObject*& exception) 488 { 489 RefPtr<FunctionCodeBlock> alternative = codeBlockFor(specializationKind); 490 491 if (!!alternative) { 492 RefPtr<FunctionCodeBlock> result = adoptRef(new FunctionCodeBlock(CodeBlock::CopyParsedBlock, *codeBlockFor(specializationKind))); 493 result->setAlternative(alternative); 494 return result.release(); 495 } 496 497 VM* vm = scope->vm(); 498 JSGlobalObject* globalObject = scope->globalObject(); 499 ParserError error; 500 DebuggerMode debuggerMode = globalObject->hasDebugger() ? DebuggerOn : DebuggerOff; 501 ProfilerMode profilerMode = globalObject->hasProfiler() ? ProfilerOn : ProfilerOff; 502 UnlinkedFunctionCodeBlock* unlinkedCodeBlock = m_unlinkedExecutable->codeBlockFor(*vm, m_source, specializationKind, debuggerMode, profilerMode, error); 503 recordParse(m_unlinkedExecutable->features(), m_unlinkedExecutable->hasCapturedVariables(), lineNo(), lastLine(), startColumn()); 504 505 if (!unlinkedCodeBlock) { 506 exception = vm->throwException(globalObject->globalExec(), error.toErrorObject(globalObject, m_source)); 507 return 0; 508 } 509 510 SourceProvider* provider = source().provider(); 511 unsigned sourceOffset = source().startOffset(); 512 unsigned startColumn = source().startColumn(); 513 514 return adoptRef(new FunctionCodeBlock(this, unlinkedCodeBlock, scope, provider, sourceOffset, startColumn)); 515 } 516 517 518 JSObject* FunctionExecutable::compileForCallInternal(ExecState* exec, JSScope* scope, JITCode::JITType jitType, CompilationResult* result, unsigned bytecodeIndex) 519 { 520 SamplingRegion samplingRegion(samplingDescription(jitType)); 521 522 if (result) 523 *result = CompilationFailed; 524 525 ASSERT((jitType == JITCode::bottomTierJIT()) == !m_codeBlockForCall); 526 JSObject* exception = 0; 527 528 RefPtr<FunctionCodeBlock> newCodeBlock = produceCodeBlockFor(scope, CodeForCall, exception); 529 if (!newCodeBlock) 530 return exception; 531 532 CompilationResult theResult = prepareFunctionForExecution( 533 exec, m_codeBlockForCall, newCodeBlock.get(), m_jitCodeForCall, 534 m_jitCodeForCallWithArityCheck, m_numParametersForCall, jitType, 535 bytecodeIndex, CodeForCall); 536 if (result) 537 *result = theResult; 538 return 0; 539 } 540 541 #if ENABLE(DFG_JIT) 542 CompilationResult FunctionExecutable::replaceWithDeferredOptimizedCodeForCall(PassRefPtr<DFG::Plan> plan) 543 { 544 return JSC::replaceWithDeferredOptimizedCode( 545 plan, m_codeBlockForCall, m_jitCodeForCall, &m_jitCodeForCallWithArityCheck, 546 &m_numParametersForCall); 547 } 548 #endif // ENABLE(DFG_JIT) 549 550 JSObject* FunctionExecutable::compileForConstructInternal(ExecState* exec, JSScope* scope, JITCode::JITType jitType, CompilationResult* result, unsigned bytecodeIndex) 551 { 552 SamplingRegion samplingRegion(samplingDescription(jitType)); 553 554 if (result) 555 *result = CompilationFailed; 556 557 ASSERT((jitType == JITCode::bottomTierJIT()) == !m_codeBlockForConstruct); 558 JSObject* exception = 0; 559 RefPtr<FunctionCodeBlock> newCodeBlock = produceCodeBlockFor(scope, CodeForConstruct, exception); 560 if (!newCodeBlock) 561 return exception; 562 563 CompilationResult theResult = prepareFunctionForExecution( 564 exec, m_codeBlockForConstruct, newCodeBlock.get(), m_jitCodeForConstruct, 565 m_jitCodeForConstructWithArityCheck, m_numParametersForConstruct, jitType, 566 bytecodeIndex, CodeForConstruct); 567 if (result) 568 *result = theResult; 569 570 return 0; 571 } 572 573 #if ENABLE(DFG_JIT) 574 CompilationResult FunctionExecutable::replaceWithDeferredOptimizedCodeForConstruct(PassRefPtr<DFG::Plan> plan) 575 { 576 return JSC::replaceWithDeferredOptimizedCode( 577 plan, m_codeBlockForConstruct, m_jitCodeForConstruct, 578 &m_jitCodeForConstructWithArityCheck, &m_numParametersForConstruct); 579 } 580 #endif // ENABLE(DFG_JIT) 519 581 520 582 #if ENABLE(JIT) -
trunk/Source/JavaScriptCore/runtime/Executable.h
r154804 r154814 162 162 } 163 163 164 bool hasJITCodeForCall() const 165 { 166 return m_numParametersForCall >= 0; 167 } 168 169 bool hasJITCodeForConstruct() const 170 { 171 return m_numParametersForConstruct >= 0; 172 } 173 174 bool hasJITCodeFor(CodeSpecializationKind kind) const 175 { 176 if (kind == CodeForCall) 177 return hasJITCodeForCall(); 178 ASSERT(kind == CodeForConstruct); 179 return hasJITCodeForConstruct(); 180 } 181 164 182 static ptrdiff_t offsetOfJITCodeWithArityCheckFor(CodeSpecializationKind kind) 165 183 { … … 178 196 } 179 197 #endif // ENABLE(JIT) 180 181 bool hasJITCodeForCall() const182 {183 return m_numParametersForCall >= 0;184 }185 186 bool hasJITCodeForConstruct() const187 {188 return m_numParametersForConstruct >= 0;189 }190 191 bool hasJITCodeFor(CodeSpecializationKind kind) const192 {193 if (kind == CodeForCall)194 return hasJITCodeForCall();195 ASSERT(kind == CodeForConstruct);196 return hasJITCodeForConstruct();197 }198 198 199 199 // Intrinsics are only for calls, currently. … … 245 245 #endif 246 246 } 247 248 247 #endif // ENABLE(JIT || ENABLE(LLINT_C_LOOP) 249 248 … … 404 403 } 405 404 406 void installCode(CodeBlock*);407 PassRefPtr<CodeBlock> newCodeBlockFor(CodeSpecializationKind, JSScope*, JSObject*& exception);408 PassRefPtr<CodeBlock> newReplacementCodeBlockFor(CodeSpecializationKind);409 410 JSObject* prepareForExecution(ExecState* exec, JSScope* scope, CodeSpecializationKind kind)411 {412 if (hasJITCodeFor(kind))413 return 0;414 return prepareForExecutionImpl(exec, scope, kind);415 }416 417 private:418 JSObject* prepareForExecutionImpl(ExecState*, JSScope*, CodeSpecializationKind);419 420 405 protected: 421 406 void finishCreation(VM& vm) … … 446 431 static void destroy(JSCell*); 447 432 433 JSObject* compile(ExecState* exec, JSScope* scope) 434 { 435 RELEASE_ASSERT(exec->vm().dynamicGlobalObject); 436 JSObject* error = 0; 437 if (!m_evalCodeBlock) 438 error = compileInternal(exec, scope, JITCode::bottomTierJIT()); 439 ASSERT(!error == !!m_evalCodeBlock); 440 return error; 441 } 442 443 #if ENABLE(DFG_JIT) 444 JSObject* compileOptimized(ExecState*, JSScope*, CompilationResult&, unsigned bytecodeIndex); 445 CompilationResult replaceWithDeferredOptimizedCode(PassRefPtr<DFG::Plan>); 446 #endif // ENABLE(DFG_JIT) 447 448 448 #if ENABLE(JIT) 449 449 void jettisonOptimizedCode(VM&); 450 CompilationResult jitCompile(ExecState*); 450 451 #endif 451 452 … … 481 482 482 483 private: 483 friend class ScriptExecutable;484 484 static const unsigned StructureFlags = OverridesVisitChildren | ScriptExecutable::StructureFlags; 485 485 EvalExecutable(ExecState*, const SourceCode&, bool); 486 486 487 JSObject* compileInternal(ExecState*, JSScope*, JITCode::JITType, CompilationResult* = 0, unsigned bytecodeIndex = UINT_MAX); 487 488 static void visitChildren(JSCell*, SlotVisitor&); 488 489 … … 508 509 static void destroy(JSCell*); 509 510 511 JSObject* compile(ExecState* exec, JSScope* scope) 512 { 513 RELEASE_ASSERT(exec->vm().dynamicGlobalObject); 514 JSObject* error = 0; 515 if (!m_programCodeBlock) 516 error = compileInternal(exec, scope, JITCode::bottomTierJIT()); 517 ASSERT(!error == !!m_programCodeBlock); 518 return error; 519 } 520 521 #if ENABLE(DFG_JIT) 522 JSObject* compileOptimized(ExecState*, JSScope*, CompilationResult&, unsigned bytecodeIndex); 523 CompilationResult replaceWithDeferredOptimizedCode(PassRefPtr<DFG::Plan>); 524 #endif // ENABLE(DFG_JIT) 525 510 526 #if ENABLE(JIT) 511 527 void jettisonOptimizedCode(VM&); 528 CompilationResult jitCompile(ExecState*); 512 529 #endif 513 530 … … 541 558 542 559 private: 543 friend class ScriptExecutable;544 545 560 static const unsigned StructureFlags = OverridesVisitChildren | ScriptExecutable::StructureFlags; 546 561 547 562 ProgramExecutable(ExecState*, const SourceCode&); 548 563 564 JSObject* compileInternal(ExecState*, JSScope*, JITCode::JITType, CompilationResult* = 0, unsigned bytecodeIndex = UINT_MAX); 549 565 static void visitChildren(JSCell*, SlotVisitor&); 550 566 … … 585 601 } 586 602 603 PassRefPtr<FunctionCodeBlock> produceCodeBlockFor(JSScope*, CodeSpecializationKind, JSObject*& exception); 604 605 JSObject* compileForCall(ExecState* exec, JSScope* scope) 606 { 607 RELEASE_ASSERT(exec->vm().dynamicGlobalObject); 608 JSObject* error = 0; 609 if (!m_codeBlockForCall) 610 error = compileForCallInternal(exec, scope, JITCode::bottomTierJIT()); 611 ASSERT(!error == !!m_codeBlockForCall); 612 return error; 613 } 614 615 #if ENABLE(DFG_JIT) 616 JSObject* compileOptimizedForCall(ExecState*, JSScope*, CompilationResult&, unsigned bytecodeIndex); 617 CompilationResult replaceWithDeferredOptimizedCodeForCall(PassRefPtr<DFG::Plan>); 618 #endif // ENABLE(DFG_JIT) 619 587 620 #if ENABLE(JIT) 588 621 void jettisonOptimizedCodeForCall(VM&); 622 CompilationResult jitCompileForCall(ExecState*); 589 623 #endif 590 624 … … 600 634 } 601 635 636 JSObject* compileForConstruct(ExecState* exec, JSScope* scope) 637 { 638 RELEASE_ASSERT(exec->vm().dynamicGlobalObject); 639 JSObject* error = 0; 640 if (!m_codeBlockForConstruct) 641 error = compileForConstructInternal(exec, scope, JITCode::bottomTierJIT()); 642 ASSERT(!error == !!m_codeBlockForConstruct); 643 return error; 644 } 645 646 #if ENABLE(DFG_JIT) 647 JSObject* compileOptimizedForConstruct(ExecState*, JSScope*, CompilationResult&, unsigned bytecodeIndex); 648 CompilationResult replaceWithDeferredOptimizedCodeForConstruct(PassRefPtr<DFG::Plan>); 649 #endif // ENABLE(DFG_JIT) 650 602 651 #if ENABLE(JIT) 603 652 void jettisonOptimizedCodeForConstruct(VM&); 653 CompilationResult jitCompileForConstruct(ExecState*); 604 654 #endif 605 655 … … 615 665 } 616 666 667 JSObject* compileFor(ExecState* exec, JSScope* scope, CodeSpecializationKind kind) 668 { 669 ASSERT(exec->callee()); 670 ASSERT(exec->callee()->inherits(JSFunction::info())); 671 ASSERT(jsCast<JSFunction*>(exec->callee())->jsExecutable() == this); 672 673 if (kind == CodeForCall) 674 return compileForCall(exec, scope); 675 ASSERT(kind == CodeForConstruct); 676 return compileForConstruct(exec, scope); 677 } 678 679 #if ENABLE(DFG_JIT) 680 JSObject* compileOptimizedFor(ExecState* exec, JSScope* scope, CompilationResult& result, unsigned bytecodeIndex, CodeSpecializationKind kind) 681 { 682 ASSERT(exec->callee()); 683 ASSERT(exec->callee()->inherits(JSFunction::info())); 684 ASSERT(jsCast<JSFunction*>(exec->callee())->jsExecutable() == this); 685 686 if (kind == CodeForCall) 687 return compileOptimizedForCall(exec, scope, result, bytecodeIndex); 688 ASSERT(kind == CodeForConstruct); 689 return compileOptimizedForConstruct(exec, scope, result, bytecodeIndex); 690 } 691 692 CompilationResult replaceWithDeferredOptimizedCodeFor(PassRefPtr<DFG::Plan> plan, CodeSpecializationKind kind) 693 { 694 if (kind == CodeForCall) 695 return replaceWithDeferredOptimizedCodeForCall(plan); 696 return replaceWithDeferredOptimizedCodeForConstruct(plan); 697 } 698 #endif // ENABLE(DFG_JIT) 699 617 700 #if ENABLE(JIT) 618 701 void jettisonOptimizedCodeFor(VM& vm, CodeSpecializationKind kind) … … 625 708 } 626 709 } 710 711 CompilationResult jitCompileFor(ExecState* exec, CodeSpecializationKind kind) 712 { 713 if (kind == CodeForCall) 714 return jitCompileForCall(exec); 715 ASSERT(kind == CodeForConstruct); 716 return jitCompileForConstruct(exec); 717 } 627 718 #endif 628 719 … … 674 765 FunctionExecutable(VM&, const SourceCode&, UnlinkedFunctionExecutable*, unsigned firstLine, unsigned lastLine, unsigned startColumn); 675 766 767 JSObject* compileForCallInternal(ExecState*, JSScope*, JITCode::JITType, CompilationResult* = 0, unsigned bytecodeIndex = UINT_MAX); 768 JSObject* compileForConstructInternal(ExecState*, JSScope*, JITCode::JITType, CompilationResult* = 0, unsigned bytecodeIndex = UINT_MAX); 769 676 770 RefPtr<FunctionCodeBlock>& codeBlockFor(CodeSpecializationKind kind) 677 771 { … … 692 786 return false; 693 787 } 694 695 friend class ScriptExecutable;696 788 697 789 static const unsigned StructureFlags = OverridesVisitChildren | ScriptExecutable::StructureFlags;
Note: See TracChangeset
for help on using the changeset viewer.