Unreviewed, rolling out r154804.

http://trac.webkit.org/changeset/154804
https://bugs.webkit.org/show_bug.cgi?id=120477

Broke Windows build (assumes LLInt features not enabled on
this build) (Requested by bfulgham on #webkit).

* CMakeLists.txt:
* GNUmakefile.list.am:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* Target.pri:
* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::linkIncomingCall):
(JSC::CodeBlock::unlinkIncomingCalls):
(JSC::CodeBlock::reoptimize):
(JSC::ProgramCodeBlock::replacement):
(JSC::EvalCodeBlock::replacement):
(JSC::FunctionCodeBlock::replacement):
(JSC::ProgramCodeBlock::compileOptimized):
(JSC::ProgramCodeBlock::replaceWithDeferredOptimizedCode):
(JSC::EvalCodeBlock::compileOptimized):
(JSC::EvalCodeBlock::replaceWithDeferredOptimizedCode):
(JSC::FunctionCodeBlock::compileOptimized):
(JSC::FunctionCodeBlock::replaceWithDeferredOptimizedCode):
(JSC::ProgramCodeBlock::jitCompileImpl):
(JSC::EvalCodeBlock::jitCompileImpl):
(JSC::FunctionCodeBlock::jitCompileImpl):
* bytecode/CodeBlock.h:
(JSC::CodeBlock::jitType):
(JSC::CodeBlock::jitCompile):
* bytecode/DeferredCompilationCallback.cpp: Removed.
* bytecode/DeferredCompilationCallback.h: Removed.
* dfg/DFGDriver.cpp:
(JSC::DFG::compile):
(JSC::DFG::tryCompile):
(JSC::DFG::tryCompileFunction):
(JSC::DFG::tryFinalizePlan):
* dfg/DFGDriver.h:
(JSC::DFG::tryCompile):
(JSC::DFG::tryCompileFunction):
(JSC::DFG::tryFinalizePlan):
* dfg/DFGFailedFinalizer.cpp:
(JSC::DFG::FailedFinalizer::finalize):
(JSC::DFG::FailedFinalizer::finalizeFunction):
* dfg/DFGFailedFinalizer.h:
* dfg/DFGFinalizer.h:
* dfg/DFGJITFinalizer.cpp:
(JSC::DFG::JITFinalizer::finalize):
(JSC::DFG::JITFinalizer::finalizeFunction):
* dfg/DFGJITFinalizer.h:
* dfg/DFGOSRExitPreparation.cpp:
(JSC::DFG::prepareCodeOriginForOSRExit):
* dfg/DFGOperations.cpp:
* dfg/DFGPlan.cpp:
(JSC::DFG::Plan::Plan):
(JSC::DFG::Plan::compileInThreadImpl):
(JSC::DFG::Plan::finalize):
* dfg/DFGPlan.h:
* dfg/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* dfg/DFGWorklist.cpp:
(JSC::DFG::Worklist::completeAllReadyPlansForVM):
(JSC::DFG::Worklist::runThread):
* ftl/FTLJITFinalizer.cpp:
(JSC::FTL::JITFinalizer::finalize):
(JSC::FTL::JITFinalizer::finalizeFunction):
* ftl/FTLJITFinalizer.h:
* heap/Heap.h:
* interpreter/Interpreter.cpp:
(JSC::Interpreter::execute):
(JSC::Interpreter::executeCall):
(JSC::Interpreter::executeConstruct):
(JSC::Interpreter::prepareForRepeatCall):
* jit/JITDriver.h: Added.
(JSC::jitCompileIfAppropriateImpl):
(JSC::jitCompileFunctionIfAppropriateImpl):
(JSC::jitCompileIfAppropriate):
(JSC::jitCompileFunctionIfAppropriate):
* jit/JITStubs.cpp:
(JSC::DEFINE_STUB_FUNCTION):
(JSC::jitCompileFor):
(JSC::lazyLinkFor):
* jit/JITToDFGDeferredCompilationCallback.cpp: Removed.
* jit/JITToDFGDeferredCompilationCallback.h: Removed.
* llint/LLIntEntrypoints.cpp:
(JSC::LLInt::getFunctionEntrypoint):
(JSC::LLInt::getEvalEntrypoint):
(JSC::LLInt::getProgramEntrypoint):
* llint/LLIntEntrypoints.h:
(JSC::LLInt::getEntrypoint):
* llint/LLIntSlowPaths.cpp:
(JSC::LLInt::jitCompileAndSetHeuristics):
(JSC::LLInt::setUpCall):
* runtime/ArrayPrototype.cpp:
(JSC::isNumericCompareFunction):
* runtime/CommonSlowPaths.cpp:
* runtime/CompilationResult.cpp:
(WTF::printInternal):
* runtime/CompilationResult.h:
* runtime/Executable.cpp:
(JSC::EvalExecutable::compileOptimized):
(JSC::EvalExecutable::jitCompile):
(JSC::EvalExecutable::compileInternal):
(JSC::EvalExecutable::replaceWithDeferredOptimizedCode):
(JSC::ProgramExecutable::compileOptimized):
(JSC::ProgramExecutable::jitCompile):
(JSC::ProgramExecutable::compileInternal):
(JSC::ProgramExecutable::replaceWithDeferredOptimizedCode):
(JSC::FunctionExecutable::compileOptimizedForCall):
(JSC::FunctionExecutable::compileOptimizedForConstruct):
(JSC::FunctionExecutable::jitCompileForCall):
(JSC::FunctionExecutable::jitCompileForConstruct):
(JSC::FunctionExecutable::produceCodeBlockFor):
(JSC::FunctionExecutable::compileForCallInternal):
(JSC::FunctionExecutable::replaceWithDeferredOptimizedCodeForCall):
(JSC::FunctionExecutable::compileForConstructInternal):
(JSC::FunctionExecutable::replaceWithDeferredOptimizedCodeForConstruct):
* runtime/Executable.h:
(JSC::ExecutableBase::offsetOfJITCodeWithArityCheckFor):
(JSC::ExecutableBase::offsetOfNumParametersFor):
(JSC::ExecutableBase::catchRoutineFor):
(JSC::EvalExecutable::compile):
(JSC::ProgramExecutable::compile):
(JSC::FunctionExecutable::compileForCall):
(JSC::FunctionExecutable::compileForConstruct):
(JSC::FunctionExecutable::compileFor):
(JSC::FunctionExecutable::compileOptimizedFor):
(JSC::FunctionExecutable::replaceWithDeferredOptimizedCodeFor):
(JSC::FunctionExecutable::jitCompileFor):
* runtime/ExecutionHarness.h: Added.
(JSC::prepareForExecutionImpl):
(JSC::prepareFunctionForExecutionImpl):
(JSC::installOptimizedCode):
(JSC::prepareForExecution):
(JSC::prepareFunctionForExecution):
(JSC::replaceWithDeferredOptimizedCode):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154814 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 82dd0838
......@@ -53,7 +53,6 @@ set(JavaScriptCore_SOURCES
bytecode/CodeOrigin.cpp
bytecode/CodeType.cpp
bytecode/DFGExitProfile.cpp
bytecode/DeferredCompilationCallback.cpp
bytecode/ExecutionCounter.cpp
bytecode/ExitKind.cpp
bytecode/GetByIdStatus.cpp
......@@ -244,7 +243,6 @@ set(JavaScriptCore_SOURCES
jit/JITStubRoutine.cpp
jit/JITStubs.cpp
jit/JITThunks.cpp
jit/JITToDFGDeferredCompilationCallback.cpp
jit/JumpReplacementWatchpoint.cpp
jit/ThunkGenerators.cpp
......
2013-08-29 Commit Queue <commit-queue@webkit.org>
Unreviewed, rolling out r154804.
http://trac.webkit.org/changeset/154804
https://bugs.webkit.org/show_bug.cgi?id=120477
Broke Windows build (assumes LLInt features not enabled on
this build) (Requested by bfulgham on #webkit).
* CMakeLists.txt:
* GNUmakefile.list.am:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* Target.pri:
* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::linkIncomingCall):
(JSC::CodeBlock::unlinkIncomingCalls):
(JSC::CodeBlock::reoptimize):
(JSC::ProgramCodeBlock::replacement):
(JSC::EvalCodeBlock::replacement):
(JSC::FunctionCodeBlock::replacement):
(JSC::ProgramCodeBlock::compileOptimized):
(JSC::ProgramCodeBlock::replaceWithDeferredOptimizedCode):
(JSC::EvalCodeBlock::compileOptimized):
(JSC::EvalCodeBlock::replaceWithDeferredOptimizedCode):
(JSC::FunctionCodeBlock::compileOptimized):
(JSC::FunctionCodeBlock::replaceWithDeferredOptimizedCode):
(JSC::ProgramCodeBlock::jitCompileImpl):
(JSC::EvalCodeBlock::jitCompileImpl):
(JSC::FunctionCodeBlock::jitCompileImpl):
* bytecode/CodeBlock.h:
(JSC::CodeBlock::jitType):
(JSC::CodeBlock::jitCompile):
* bytecode/DeferredCompilationCallback.cpp: Removed.
* bytecode/DeferredCompilationCallback.h: Removed.
* dfg/DFGDriver.cpp:
(JSC::DFG::compile):
(JSC::DFG::tryCompile):
(JSC::DFG::tryCompileFunction):
(JSC::DFG::tryFinalizePlan):
* dfg/DFGDriver.h:
(JSC::DFG::tryCompile):
(JSC::DFG::tryCompileFunction):
(JSC::DFG::tryFinalizePlan):
* dfg/DFGFailedFinalizer.cpp:
(JSC::DFG::FailedFinalizer::finalize):
(JSC::DFG::FailedFinalizer::finalizeFunction):
* dfg/DFGFailedFinalizer.h:
* dfg/DFGFinalizer.h:
* dfg/DFGJITFinalizer.cpp:
(JSC::DFG::JITFinalizer::finalize):
(JSC::DFG::JITFinalizer::finalizeFunction):
* dfg/DFGJITFinalizer.h:
* dfg/DFGOSRExitPreparation.cpp:
(JSC::DFG::prepareCodeOriginForOSRExit):
* dfg/DFGOperations.cpp:
* dfg/DFGPlan.cpp:
(JSC::DFG::Plan::Plan):
(JSC::DFG::Plan::compileInThreadImpl):
(JSC::DFG::Plan::finalize):
* dfg/DFGPlan.h:
* dfg/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* dfg/DFGWorklist.cpp:
(JSC::DFG::Worklist::completeAllReadyPlansForVM):
(JSC::DFG::Worklist::runThread):
* ftl/FTLJITFinalizer.cpp:
(JSC::FTL::JITFinalizer::finalize):
(JSC::FTL::JITFinalizer::finalizeFunction):
* ftl/FTLJITFinalizer.h:
* heap/Heap.h:
* interpreter/Interpreter.cpp:
(JSC::Interpreter::execute):
(JSC::Interpreter::executeCall):
(JSC::Interpreter::executeConstruct):
(JSC::Interpreter::prepareForRepeatCall):
* jit/JITDriver.h: Added.
(JSC::jitCompileIfAppropriateImpl):
(JSC::jitCompileFunctionIfAppropriateImpl):
(JSC::jitCompileIfAppropriate):
(JSC::jitCompileFunctionIfAppropriate):
* jit/JITStubs.cpp:
(JSC::DEFINE_STUB_FUNCTION):
(JSC::jitCompileFor):
(JSC::lazyLinkFor):
* jit/JITToDFGDeferredCompilationCallback.cpp: Removed.
* jit/JITToDFGDeferredCompilationCallback.h: Removed.
* llint/LLIntEntrypoints.cpp:
(JSC::LLInt::getFunctionEntrypoint):
(JSC::LLInt::getEvalEntrypoint):
(JSC::LLInt::getProgramEntrypoint):
* llint/LLIntEntrypoints.h:
(JSC::LLInt::getEntrypoint):
* llint/LLIntSlowPaths.cpp:
(JSC::LLInt::jitCompileAndSetHeuristics):
(JSC::LLInt::setUpCall):
* runtime/ArrayPrototype.cpp:
(JSC::isNumericCompareFunction):
* runtime/CommonSlowPaths.cpp:
* runtime/CompilationResult.cpp:
(WTF::printInternal):
* runtime/CompilationResult.h:
* runtime/Executable.cpp:
(JSC::EvalExecutable::compileOptimized):
(JSC::EvalExecutable::jitCompile):
(JSC::EvalExecutable::compileInternal):
(JSC::EvalExecutable::replaceWithDeferredOptimizedCode):
(JSC::ProgramExecutable::compileOptimized):
(JSC::ProgramExecutable::jitCompile):
(JSC::ProgramExecutable::compileInternal):
(JSC::ProgramExecutable::replaceWithDeferredOptimizedCode):
(JSC::FunctionExecutable::compileOptimizedForCall):
(JSC::FunctionExecutable::compileOptimizedForConstruct):
(JSC::FunctionExecutable::jitCompileForCall):
(JSC::FunctionExecutable::jitCompileForConstruct):
(JSC::FunctionExecutable::produceCodeBlockFor):
(JSC::FunctionExecutable::compileForCallInternal):
(JSC::FunctionExecutable::replaceWithDeferredOptimizedCodeForCall):
(JSC::FunctionExecutable::compileForConstructInternal):
(JSC::FunctionExecutable::replaceWithDeferredOptimizedCodeForConstruct):
* runtime/Executable.h:
(JSC::ExecutableBase::offsetOfJITCodeWithArityCheckFor):
(JSC::ExecutableBase::offsetOfNumParametersFor):
(JSC::ExecutableBase::catchRoutineFor):
(JSC::EvalExecutable::compile):
(JSC::ProgramExecutable::compile):
(JSC::FunctionExecutable::compileForCall):
(JSC::FunctionExecutable::compileForConstruct):
(JSC::FunctionExecutable::compileFor):
(JSC::FunctionExecutable::compileOptimizedFor):
(JSC::FunctionExecutable::replaceWithDeferredOptimizedCodeFor):
(JSC::FunctionExecutable::jitCompileFor):
* runtime/ExecutionHarness.h: Added.
(JSC::prepareForExecutionImpl):
(JSC::prepareFunctionForExecutionImpl):
(JSC::installOptimizedCode):
(JSC::prepareForExecution):
(JSC::prepareFunctionForExecution):
(JSC::replaceWithDeferredOptimizedCode):
2013-08-28 Filip Pizlo <fpizlo@apple.com>
CodeBlock compilation and installation should be simplified and rationalized
......
......@@ -113,11 +113,9 @@ javascriptcore_sources += \
Source/JavaScriptCore/bytecode/CodeBlockWithJITType.h \
Source/JavaScriptCore/bytecode/CodeOrigin.cpp \
Source/JavaScriptCore/bytecode/CodeOrigin.h \
Source/JavaScriptCore/bytecode/DataFormat.h \
Source/JavaScriptCore/bytecode/DFGExitProfile.cpp \
Source/JavaScriptCore/bytecode/DFGExitProfile.h \
Source/JavaScriptCore/bytecode/DataFormat.h \
Source/JavaScriptCore/bytecode/DeferredCompilationCallback.cpp \
Source/JavaScriptCore/bytecode/DeferredCompilationCallback.h \
Source/JavaScriptCore/bytecode/EvalCodeCache.h \
Source/JavaScriptCore/bytecode/ExecutionCounter.cpp \
Source/JavaScriptCore/bytecode/ExecutionCounter.h \
......@@ -606,6 +604,7 @@ javascriptcore_sources += \
Source/JavaScriptCore/jit/JITCompilationEffort.h \
Source/JavaScriptCore/jit/JITDisassembler.cpp \
Source/JavaScriptCore/jit/JITDisassembler.h \
Source/JavaScriptCore/jit/JITDriver.h \
Source/JavaScriptCore/jit/JIT.cpp \
Source/JavaScriptCore/jit/JIT.h \
Source/JavaScriptCore/jit/JITExceptions.cpp \
......@@ -629,8 +628,6 @@ javascriptcore_sources += \
Source/JavaScriptCore/jit/JITStubsX86Common.h \
Source/JavaScriptCore/jit/JITThunks.cpp \
Source/JavaScriptCore/jit/JITThunks.h \
Source/JavaScriptCore/jit/JITToDFGDeferredCompilationCallback.cpp \
Source/JavaScriptCore/jit/JITToDFGDeferredCompilationCallback.h \
Source/JavaScriptCore/jit/JITWriteBarrier.h \
Source/JavaScriptCore/jit/JSInterfaceJIT.h \
Source/JavaScriptCore/jit/JumpReplacementWatchpoint.cpp \
......@@ -786,6 +783,7 @@ javascriptcore_sources += \
Source/JavaScriptCore/runtime/ExceptionHelpers.h \
Source/JavaScriptCore/runtime/Executable.cpp \
Source/JavaScriptCore/runtime/Executable.h \
Source/JavaScriptCore/runtime/ExecutionHarness.h \
Source/JavaScriptCore/runtime/Float32Array.h \
Source/JavaScriptCore/runtime/Float64Array.h \
Source/JavaScriptCore/runtime/FunctionConstructor.cpp \
......
......@@ -302,7 +302,6 @@
<ClCompile Include="..\bytecode\CodeBlockHash.cpp" />
<ClCompile Include="..\bytecode\CodeOrigin.cpp" />
<ClCompile Include="..\bytecode\CodeType.cpp" />
<ClCompile Include="..\bytecode\DeferredCompilationCallback.cpp" />
<ClCompile Include="..\bytecode\ExecutionCounter.cpp" />
<ClCompile Include="..\bytecode\ExitKind.cpp" />
<ClCompile Include="..\bytecode\GetByIdStatus.cpp" />
......@@ -378,7 +377,6 @@
<ClCompile Include="..\jit\JITStubRoutine.cpp" />
<ClCompile Include="..\jit\JITStubs.cpp" />
<ClCompile Include="..\jit\JITThunks.cpp" />
<ClCompile Include="..\jit\JITToDFGDeferredCompilationCallback.cpp" />
<ClCompile Include="..\jit\JumpReplacementWatchpoint.cpp" />
<ClCompile Include="..\jit\ThunkGenerators.cpp" />
<ClCompile Include="..\llint\LLIntCLoop.cpp" />
......@@ -625,7 +623,6 @@
<ClInclude Include="..\bytecode\CodeType.h" />
<ClInclude Include="..\bytecode\Comment.h" />
<ClInclude Include="..\bytecode\DataFormat.h" />
<ClInclude Include="..\bytecode\DeferredCompilationCallback.h" />
<ClInclude Include="..\bytecode\EvalCodeCache.h" />
<ClInclude Include="..\bytecode\ExecutionCounter.h" />
<ClInclude Include="..\bytecode\ExitKind.h" />
......@@ -743,6 +740,7 @@
<ClInclude Include="..\jit\JITCode.h" />
<ClInclude Include="..\jit\JITCompilationEffort.h" />
<ClInclude Include="..\jit\JITDisassembler.h" />
<ClInclude Include="..\jit\JITDriver.h" />
<ClInclude Include="..\jit\JITExceptions.h" />
<ClInclude Include="..\jit\JITInlines.h" />
<ClInclude Include="..\jit\JITStubCall.h" />
......@@ -752,7 +750,6 @@
<ClInclude Include="..\jit\JITStubsX86Common.h" />
<ClInclude Include="..\jit\JITStubsX86_64.h" />
<ClInclude Include="..\jit\JITThunks.h" />
<ClInclude Include="..\jit\JITToDFGDeferredCompilationCallback.h" />
<ClInclude Include="..\jit\JITWriteBarrier.h" />
<ClInclude Include="..\jit\JSInterfaceJIT.h" />
<ClInclude Include="..\jit\JumpReplacementWatchpoint.h" />
......@@ -840,6 +837,7 @@
<ClInclude Include="..\runtime\ErrorPrototype.h" />
<ClInclude Include="..\runtime\ExceptionHelpers.h" />
<ClInclude Include="..\runtime\Executable.h" />
<ClInclude Include="..\runtime\ExecutionHarness.h" />
<ClInclude Include="..\runtime\Float32Array.h" />
<ClInclude Include="..\runtime\Float64Array.h" />
<ClInclude Include="..\runtime\FunctionConstructor.h" />
......
......@@ -61,7 +61,6 @@ SOURCES += \
bytecode/CodeOrigin.cpp \
bytecode/CodeType.cpp \
bytecode/DFGExitProfile.cpp \
bytecode/DeferredCompilationCallback.cpp \
bytecode/ExecutionCounter.cpp \
bytecode/ExitKind.cpp \
bytecode/GetByIdStatus.cpp \
......@@ -222,7 +221,6 @@ SOURCES += \
jit/JITStubRoutine.cpp \
jit/JITStubs.cpp \
jit/JITThunks.cpp \
jit/JITToDFGDeferredCompilationCallback.cpp \
jit/JumpReplacementWatchpoint.cpp \
jit/ThunkGenerators.cpp \
llint/LLIntCLoop.cpp \
......
......@@ -34,7 +34,6 @@
#include "CallLinkStatus.h"
#include "DFGCapabilities.h"
#include "DFGCommon.h"
#include "DFGDriver.h"
#include "DFGNode.h"
#include "DFGRepatch.h"
#include "DFGWorklist.h"
......@@ -46,7 +45,6 @@
#include "JSCJSValue.h"
#include "JSFunction.h"
#include "JSNameScope.h"
#include "LLIntEntrypoints.h"
#include "LowLevelInterpreter.h"
#include "Operations.h"
#include "PolymorphicPutByIdList.h"
......@@ -2538,22 +2536,20 @@ void CodeBlock::linkIncomingCall(ExecState* callerFrame, CallLinkInfo* incoming)
noticeIncomingCall(callerFrame);
m_incomingCalls.push(incoming);
}
#endif // ENABLE(JIT)
void CodeBlock::unlinkIncomingCalls()
{
#if ENABLE(LLINT)
while (m_incomingLLIntCalls.begin() != m_incomingLLIntCalls.end())
m_incomingLLIntCalls.begin()->unlink();
#endif // ENABLE(LLINT)
#if ENABLE(JIT)
#endif
if (m_incomingCalls.isEmpty())
return;
RepatchBuffer repatchBuffer(this);
while (m_incomingCalls.begin() != m_incomingCalls.end())
m_incomingCalls.begin()->unlink(*m_vm, repatchBuffer);
#endif // ENABLE(JIT)
}
#endif // ENABLE(JIT)
#if ENABLE(LLINT)
void CodeBlock::linkIncomingCall(ExecState* callerFrame, LLIntCallLinkInfo* incoming)
......@@ -2693,108 +2689,78 @@ void CodeBlock::copyPostParseDataFromAlternative()
copyPostParseDataFrom(m_alternative.get());
}
CompilationResult CodeBlock::prepareForExecutionImpl(
ExecState* exec, JITCode::JITType jitType, JITCompilationEffort effort,
unsigned bytecodeIndex, PassRefPtr<DeferredCompilationCallback> callback)
{
VM& vm = exec->vm();
if (jitType == JITCode::InterpreterThunk) {
switch (codeType()) {
case GlobalCode:
LLInt::setProgramEntrypoint(vm, static_cast<ProgramCodeBlock*>(this));
break;
case EvalCode:
LLInt::setEvalEntrypoint(vm, static_cast<EvalCodeBlock*>(this));
break;
case FunctionCode:
LLInt::setFunctionEntrypoint(vm, static_cast<FunctionCodeBlock*>(this));
break;
}
return CompilationSuccessful;
}
#if ENABLE(JIT)
if (JITCode::isOptimizingJIT(jitType)) {
ASSERT(effort == JITCompilationCanFail);
bool hadCallback = !!callback;
CompilationResult result = DFG::tryCompile(exec, this, bytecodeIndex, callback);
ASSERT_UNUSED(hadCallback, result != CompilationDeferred || hadCallback);
return result;
}
MacroAssemblerCodePtr jitCodeWithArityCheck;
RefPtr<JITCode> jitCode = JIT::compile(&vm, this, effort, &jitCodeWithArityCheck);
if (!jitCode)
return CompilationFailed;
setJITCode(jitCode, jitCodeWithArityCheck);
return CompilationSuccessful;
#else
UNUSED_PARAM(effort);
UNUSED_PARAM(bytecodeIndex);
UNUSED_PARAM(callback);
return CompilationFailed;
#endif // ENABLE(JIT)
void CodeBlock::reoptimize()
{
ASSERT(replacement() != this);
ASSERT(replacement()->alternative() == this);
if (DFG::shouldShowDisassembly())
dataLog(*replacement(), " will be jettisoned due to reoptimization of ", *this, ".\n");
replacement()->jettison();
countReoptimization();
}
CompilationResult CodeBlock::prepareForExecution(
ExecState* exec, JITCode::JITType jitType,
JITCompilationEffort effort, unsigned bytecodeIndex)
CodeBlock* ProgramCodeBlock::replacement()
{
CompilationResult result =
prepareForExecutionImpl(exec, jitType, effort, bytecodeIndex, 0);
ASSERT(result != CompilationDeferred);
return result;
return &static_cast<ProgramExecutable*>(ownerExecutable())->generatedBytecode();
}
CompilationResult CodeBlock::prepareForExecutionAsynchronously(
ExecState* exec, JITCode::JITType jitType,
PassRefPtr<DeferredCompilationCallback> passedCallback,
JITCompilationEffort effort, unsigned bytecodeIndex)
CodeBlock* EvalCodeBlock::replacement()
{
RefPtr<DeferredCompilationCallback> callback = passedCallback;
CompilationResult result =
prepareForExecutionImpl(exec, jitType, effort, bytecodeIndex, callback);
if (result != CompilationDeferred)
callback->compilationDidComplete(this, result);
return result;
return &static_cast<EvalExecutable*>(ownerExecutable())->generatedBytecode();
}
CodeBlock* FunctionCodeBlock::replacement()
{
return &static_cast<FunctionExecutable*>(ownerExecutable())->generatedBytecodeFor(m_isConstructor ? CodeForConstruct : CodeForCall);
}
void CodeBlock::install()
#if ENABLE(DFG_JIT)
JSObject* ProgramCodeBlock::compileOptimized(ExecState* exec, JSScope* scope, CompilationResult& result, unsigned bytecodeIndex)
{
ownerExecutable()->installCode(this);
if (JITCode::isHigherTier(replacement()->jitType(), jitType())) {
result = CompilationNotNeeded;
return 0;
}
JSObject* error = static_cast<ProgramExecutable*>(ownerExecutable())->compileOptimized(exec, scope, result, bytecodeIndex);
return error;
}
PassRefPtr<CodeBlock> CodeBlock::newReplacement()
CompilationResult ProgramCodeBlock::replaceWithDeferredOptimizedCode(PassRefPtr<DFG::Plan> plan)
{
return ownerExecutable()->newReplacementCodeBlockFor(specializationKind());
return static_cast<ProgramExecutable*>(ownerExecutable())->replaceWithDeferredOptimizedCode(plan);
}
#if ENABLE(JIT)
void CodeBlock::reoptimize()
JSObject* EvalCodeBlock::compileOptimized(ExecState* exec, JSScope* scope, CompilationResult& result, unsigned bytecodeIndex)
{
ASSERT(replacement() != this);
ASSERT(replacement()->alternative() == this);
if (DFG::shouldShowDisassembly())
dataLog(*replacement(), " will be jettisoned due to reoptimization of ", *this, ".\n");
replacement()->jettison();
countReoptimization();
if (JITCode::isHigherTier(replacement()->jitType(), jitType())) {
result = CompilationNotNeeded;
return 0;
}
JSObject* error = static_cast<EvalExecutable*>(ownerExecutable())->compileOptimized(exec, scope, result, bytecodeIndex);
return error;
}
CodeBlock* ProgramCodeBlock::replacement()
CompilationResult EvalCodeBlock::replaceWithDeferredOptimizedCode(PassRefPtr<DFG::Plan> plan)
{
return &static_cast<ProgramExecutable*>(ownerExecutable())->generatedBytecode();
return static_cast<EvalExecutable*>(ownerExecutable())->replaceWithDeferredOptimizedCode(plan);
}
CodeBlock* EvalCodeBlock::replacement()
JSObject* FunctionCodeBlock::compileOptimized(ExecState* exec, JSScope* scope, CompilationResult& result, unsigned bytecodeIndex)
{
return &static_cast<EvalExecutable*>(ownerExecutable())->generatedBytecode();
if (JITCode::isHigherTier(replacement()->jitType(), jitType())) {
result = CompilationNotNeeded;
return 0;
}
JSObject* error = static_cast<FunctionExecutable*>(ownerExecutable())->compileOptimizedFor(exec, scope, result, bytecodeIndex, m_isConstructor ? CodeForConstruct : CodeForCall);
return error;
}
CodeBlock* FunctionCodeBlock::replacement()
CompilationResult FunctionCodeBlock::replaceWithDeferredOptimizedCode(PassRefPtr<DFG::Plan> plan)
{
return &static_cast<FunctionExecutable*>(ownerExecutable())->generatedBytecodeFor(m_isConstructor ? CodeForConstruct : CodeForCall);
return static_cast<FunctionExecutable*>(ownerExecutable())->replaceWithDeferredOptimizedCodeFor(plan, m_isConstructor ? CodeForConstruct : CodeForCall);
}
#endif // ENABLE(DFG_JIT)
DFG::CapabilityLevel ProgramCodeBlock::capabilityLevelInternal()
{
......@@ -2838,6 +2804,27 @@ void FunctionCodeBlock::jettisonImpl()
{
static_cast<FunctionExecutable*>(ownerExecutable())->jettisonOptimizedCodeFor(*vm(), m_isConstructor ? CodeForConstruct : CodeForCall);
}
CompilationResult ProgramCodeBlock::jitCompileImpl(ExecState* exec)
{
ASSERT(jitType() == JITCode::InterpreterThunk);
ASSERT(this == replacement());
return static_cast<ProgramExecutable*>(ownerExecutable())->jitCompile(exec);
}
CompilationResult EvalCodeBlock::jitCompileImpl(ExecState* exec)
{
ASSERT(jitType() == JITCode::InterpreterThunk);
ASSERT(this == replacement());
return static_cast<EvalExecutable*>(ownerExecutable())->jitCompile(exec);
}
CompilationResult FunctionCodeBlock::jitCompileImpl(ExecState* exec)
{
ASSERT(jitType() == JITCode::InterpreterThunk);
ASSERT(this == replacement());
return static_cast<FunctionExecutable*>(ownerExecutable())->jitCompileFor(exec, m_isConstructor ? CodeForConstruct : CodeForCall);
}
#endif
JSGlobalObject* CodeBlock::globalObjectFor(CodeOrigin codeOrigin)
......
......@@ -48,7 +48,6 @@
#include "DFGOSREntry.h"
#include "DFGOSRExit.h"
#include "DFGVariableEventStream.h"
#include "DeferredCompilationCallback.h"
#include "EvalCodeCache.h"
#include "ExecutionCounter.h"
#include "ExpressionRangeInfo.h"
......@@ -203,8 +202,6 @@ public:
unsigned bytecodeOffset(ExecState*, ReturnAddressPtr);
void unlinkIncomingCalls();
#if ENABLE(JIT)
unsigned bytecodeOffsetForCallAtIndex(unsigned index)
{
......@@ -234,6 +231,8 @@ public:
void linkIncomingCall(ExecState* callerFrame, LLIntCallLinkInfo*);
#endif // ENABLE(LLINT)
void unlinkIncomingCalls();
#if ENABLE(DFG_JIT) || ENABLE(LLINT)
void setJITCodeMap(PassOwnPtr<CompactJITCodeMap> jitCodeMap)
{
......@@ -265,38 +264,7 @@ public:
int argumentIndexAfterCapture(size_t argument);
// Prepares this code block for execution. This is synchronous. This compile
// may fail, if you passed JITCompilationCanFail.
CompilationResult prepareForExecution(
ExecState*, JITCode::JITType,
JITCompilationEffort = JITCompilationMustSucceed,
unsigned bytecodeIndex = UINT_MAX);
// Use this method for asynchronous compiles. This will do a compile at some
// point in time between when you called into this method and some point in the
// future. If you're lucky then it might complete before this method returns.
// Once it completes, the callback is called with the result. If the compile
// did happen to complete before the method returns, the result of the compile
// may be returned. If the compile didn't happen to complete yet, or if we
// didn't happen to notice that the compile already completed, we return
// CompilationDeferred.
//
// Note that asynchronous compiles don't actually complete unless you call into
// DFG::Worklist::completeAllReadyPlansForVM(). You usually force a call to
// this on the main thread by listening to the callback's
// compilationDidBecomeReadyAsynchronously() notification. Note that this call
// happens on another thread.
CompilationResult prepareForExecutionAsynchronously(
ExecState*, JITCode::JITType, PassRefPtr<DeferredCompilationCallback>,
JITCompilationEffort = JITCompilationMustSucceed,
unsigned bytecodeIndex = UINT_MAX);
// Exactly equivalent to codeBlock->ownerExecutable()->installCode(codeBlock);
void install();
// Exactly equivalent to codeBlock->ownerExecutable()->newReplacementCodeBlockFor(codeBlock->specializationKind())
PassRefPtr<CodeBlock> newReplacement();
#if ENABLE(JIT)
void setJITCode(PassRefPtr<JITCode> code, MacroAssemblerCodePtr codeWithArityCheck)
{
ConcurrentJITLocker locker(m_lock);
......@@ -318,14 +286,23 @@ public:
WTF::loadLoadFence(); // This probably isn't needed. Oh well, paranoia is good.
return result;
}
#if ENABLE(JIT)
bool hasBaselineJITProfiling() const
{
return jitType() == JITCode::BaselineJIT;
}
#if ENABLE(DFG_JIT)
virtual JSObject* compileOptimized(ExecState*, JSScope*, CompilationResult&, unsigned bytecodeIndex) = 0;
virtual CompilationResult replaceWithDeferredOptimizedCode(PassRefPtr<DFG::Plan>) = 0;
#endif // ENABLE(DFG_JIT)
void jettison();
CompilationResult jitCompile(ExecState* exec)
{
if (jitType() != JITCode::InterpreterThunk) {
ASSERT(jitType() == JITCode::BaselineJIT);
return CompilationNotNeeded;
}
return jitCompileImpl(exec);
}
virtual CodeBlock* replacement() = 0;
virtual DFG::CapabilityLevel capabilityLevelInternal() = 0;
......@@ -338,6 +315,8 @@ public:
DFG::CapabilityLevel capabilityLevelState() { return m_capabilityLevelState; }
bool hasOptimizedReplacement();
#else
JITCode::JITType jitType() const { return JITCode::InterpreterThunk; }
#endif
ScriptExecutable* ownerExecutable() const { return m_ownerExecutable.get(); }
......@@ -990,6 +969,7 @@ public:
protected:
#if ENABLE(JIT)
virtual CompilationResult jitCompileImpl(ExecState*) = 0;
virtual void jettisonImpl() = 0;
#endif
virtual void visitWeakReferences(SlotVisitor&);
......@@ -1004,10 +984,6 @@ protected:
private:
friend class DFGCodeBlocks;
CompilationResult prepareForExecutionImpl(
ExecState*, JITCode::JITType, JITCompilationEffort, unsigned bytecodeIndex,
PassRefPtr<DeferredCompilationCallback>);
void noticeIncomingCall(ExecState* callerFrame);
double optimizationThresholdScalingFactor();
......@@ -1109,12 +1085,12 @@ private:
SegmentedVector<LLIntCallLinkInfo, 8> m_llintCallLinkInfos;
SentinelLinkedList<LLIntCallLinkInfo, BasicRawSentinelNode<LLIntCallLinkInfo> > m_incomingLLIntCalls;
#endif
RefPtr<JITCode> m_jitCode;
MacroAssemblerCodePtr m_jitCodeWithArityCheck;
#if ENABLE(JIT)
Vector<StructureStubInfo> m_structureStubInfos;
Vector<ByValInfo> m_byValInfos;
Vector<CallLinkInfo> m_callLinkInfos;
RefPtr<JITCode> m_jitCode;
MacroAssemblerCodePtr m_jitCodeWithArityCheck;
SentinelLinkedList<CallLinkInfo, BasicRawSentinelNode<CallLinkInfo> > m_incomingCalls;
#endif
#if ENABLE(DFG_JIT) || ENABLE(LLINT)
......@@ -1218,7 +1194,13 @@ public:
#if ENABLE(JIT)
protected:
#if ENABLE(DFG_JIT)
virtual JSObject* compileOptimized(ExecState*, JSScope*, CompilationResult&, unsigned bytecodeIndex);
virtual CompilationResult replaceWithDeferredOptimizedCode(PassRefPtr<DFG::Plan>);
#endif // ENABLE(DFG_JIT)
virtual void jettisonImpl();
virtual CompilationResult jitCompileImpl(ExecState*);
virtual CodeBlock* replacement();
virtual DFG::CapabilityLevel capabilityLevelInternal();
#endif
......@@ -1241,7 +1223,13 @@ public:
#if ENABLE(JIT)
protected:
#if ENABLE(DFG_JIT)
virtual JSObject* compileOptimized(ExecState*, JSScope*, CompilationResult&, unsigned bytecodeIndex);
virtual CompilationResult replaceWithDeferredOptimizedCode(PassRefPtr<DFG::Plan>);
#endif // ENABLE(DFG_JIT)
virtual void jettisonImpl();
virtual CompilationResult jitCompileImpl(ExecState*);
virtual CodeBlock* replacement();
virtual DFG::CapabilityLevel capabilityLevelInternal();
#endif
......@@ -1264,7 +1252,13 @@ public:
#if ENABLE(JIT)
protected:
#if ENABLE(DFG_JIT)
virtual JSObject* compileOptimized(ExecState*, JSScope*, CompilationResult&, unsigned bytecodeIndex);
virtual CompilationResult replaceWithDeferredOptimizedCode(PassRefPtr<DFG::Plan>);
#endif // ENABLE(DFG_JIT)
virtual void jettisonImpl();
virtual CompilationResult jitCompileImpl(ExecState*);