Ignore:
Timestamp:
Aug 29, 2013, 12:28:55 PM (12 years ago)
Author:
[email protected]
Message:

CodeBlock::prepareForExecution() is silly
https://bugs.webkit.org/show_bug.cgi?id=120453

Reviewed by Oliver Hunt.

Instead of saying:

codeBlock->prepareForExecution(stuff, BaselineJIT, more stuff)


we should just say:

JIT::compile(stuff, codeBlock, more stuff);


And similarly for the LLInt and DFG.

This kills a bunch of code, since CodeBlock::prepareForExecution() is just a
wrapper that uses the JITType argument to call into the appropriate execution
engine, which is what the user wanted to do in the first place.

  • CMakeLists.txt:
  • GNUmakefile.list.am:
  • JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
  • JavaScriptCore.xcodeproj/project.pbxproj:
  • Target.pri:
  • bytecode/CodeBlock.cpp:
  • bytecode/CodeBlock.h:
  • dfg/DFGDriver.cpp:

(JSC::DFG::compileImpl):
(JSC::DFG::compile):

  • dfg/DFGDriver.h:

(JSC::DFG::tryCompile):

  • dfg/DFGOSRExitPreparation.cpp:

(JSC::DFG::prepareCodeOriginForOSRExit):

  • dfg/DFGWorklist.cpp:

(JSC::DFG::globalWorklist):

  • dfg/DFGWorklist.h:
  • jit/JIT.cpp:

(JSC::JIT::privateCompile):

  • jit/JIT.h:

(JSC::JIT::compile):

  • jit/JITStubs.cpp:

(JSC::DEFINE_STUB_FUNCTION):

  • llint/LLIntEntrypoint.cpp: Copied from Source/JavaScriptCore/llint/LLIntEntrypoints.cpp.

(JSC::LLInt::setFunctionEntrypoint):
(JSC::LLInt::setEvalEntrypoint):
(JSC::LLInt::setProgramEntrypoint):
(JSC::LLInt::setEntrypoint):

  • llint/LLIntEntrypoint.h: Copied from Source/JavaScriptCore/llint/LLIntEntrypoints.h.
  • llint/LLIntEntrypoints.cpp: Removed.
  • llint/LLIntEntrypoints.h: Removed.
  • llint/LLIntSlowPaths.cpp:

(JSC::LLInt::jitCompileAndSetHeuristics):

  • runtime/Executable.cpp:

(JSC::ScriptExecutable::prepareForExecutionImpl):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp

    r154824 r154833  
    4747#include "JSFunction.h"
    4848#include "JSNameScope.h"
    49 #include "LLIntEntrypoints.h"
    5049#include "LowLevelInterpreter.h"
    5150#include "Operations.h"
     
    26942693}
    26952694
    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 #if ENABLE(LLINT)
    2704         switch (codeType()) {
    2705         case GlobalCode:
    2706             LLInt::setProgramEntrypoint(vm, static_cast<ProgramCodeBlock*>(this));
    2707             break;
    2708         case EvalCode:
    2709             LLInt::setEvalEntrypoint(vm, static_cast<EvalCodeBlock*>(this));
    2710             break;
    2711         case FunctionCode:
    2712             LLInt::setFunctionEntrypoint(vm, static_cast<FunctionCodeBlock*>(this));
    2713             break;
    2714         }
    2715         return CompilationSuccessful;
    2716 #else // ENABLE(LLINT)
    2717         return CompilationFailed;
    2718 #endif // ENABLE(LLINT)
    2719     }
    2720    
    2721 #if ENABLE(JIT)
    2722     if (JITCode::isOptimizingJIT(jitType)) {
    2723         ASSERT(effort == JITCompilationCanFail);
    2724         bool hadCallback = !!callback;
    2725         CompilationResult result = DFG::tryCompile(exec, this, bytecodeIndex, callback);
    2726         ASSERT_UNUSED(hadCallback, result != CompilationDeferred || hadCallback);
    2727         return result;
    2728     }
    2729    
    2730     MacroAssemblerCodePtr jitCodeWithArityCheck;
    2731     RefPtr<JITCode> jitCode = JIT::compile(&vm, this, effort, &jitCodeWithArityCheck);
    2732     if (!jitCode)
    2733         return CompilationFailed;
    2734     setJITCode(jitCode, jitCodeWithArityCheck);
    2735     return CompilationSuccessful;
    2736 #else
    2737     UNUSED_PARAM(effort);
    2738     UNUSED_PARAM(bytecodeIndex);
    2739     UNUSED_PARAM(callback);
    2740     return CompilationFailed;
    2741 #endif // ENABLE(JIT)
    2742 }
    2743 
    2744 CompilationResult CodeBlock::prepareForExecution(
    2745     ExecState* exec, JITCode::JITType jitType,
    2746     JITCompilationEffort effort, unsigned bytecodeIndex)
    2747 {
    2748     CompilationResult result =
    2749         prepareForExecutionImpl(exec, jitType, effort, bytecodeIndex, 0);
    2750     ASSERT(result != CompilationDeferred);
    2751     return result;
    2752 }
    2753 
    2754 CompilationResult CodeBlock::prepareForExecutionAsynchronously(
    2755     ExecState* exec, JITCode::JITType jitType,
    2756     PassRefPtr<DeferredCompilationCallback> passedCallback,
    2757     JITCompilationEffort effort, unsigned bytecodeIndex)
    2758 {
    2759     RefPtr<DeferredCompilationCallback> callback = passedCallback;
    2760     CompilationResult result =
    2761         prepareForExecutionImpl(exec, jitType, effort, bytecodeIndex, callback);
    2762     if (result != CompilationDeferred)
    2763         callback->compilationDidComplete(this, result);
    2764     return result;
    2765 }
    2766 
    27672695void CodeBlock::install()
    27682696{
Note: See TracChangeset for help on using the changeset viewer.