Changeset 154814 in webkit for trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp
- Timestamp:
- Aug 29, 2013, 9:41:07 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note:
See TracChangeset
for help on using the changeset viewer.