Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (125981 => 125982)
--- trunk/Source/_javascript_Core/ChangeLog 2012-08-19 19:49:17 UTC (rev 125981)
+++ trunk/Source/_javascript_Core/ChangeLog 2012-08-19 21:59:12 UTC (rev 125982)
@@ -1,5 +1,70 @@
2012-08-17 Filip Pizlo <[email protected]>
+ The current state of the call frame should be taken into account in the DFG for both predictions and proofs
+ https://bugs.webkit.org/show_bug.cgi?id=94412
+
+ Reviewed by Geoffrey Garen.
+
+ This ensures that no matter how smart the DFG gets, it'll always know through
+ which entrypoint OSR will try to enter, and with which values it will attempt
+ to do so. For prologue OSR, this has no effect other than adding the current
+ arguments to the argument predictions. For loop OSR, this makes our treatment
+ of the loop slightly more conservative - just conservative enough to ensure
+ that OSR succeeds.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::ProgramCodeBlock::compileOptimized):
+ (JSC::EvalCodeBlock::compileOptimized):
+ (JSC::FunctionCodeBlock::compileOptimized):
+ * bytecode/CodeBlock.h:
+ (CodeBlock):
+ (ProgramCodeBlock):
+ (EvalCodeBlock):
+ (FunctionCodeBlock):
+ * dfg/DFGAbstractState.cpp:
+ (JSC::DFG::AbstractState::initialize):
+ * dfg/DFGAbstractValue.h:
+ (JSC::DFG::AbstractValue::setMostSpecific):
+ (AbstractValue):
+ * dfg/DFGByteCodeParser.cpp:
+ (JSC::DFG::ByteCodeParser::fixVariableAccessPredictions):
+ (JSC::DFG::ByteCodeParser::parse):
+ * dfg/DFGDriver.cpp:
+ (JSC::DFG::compile):
+ (JSC::DFG::tryCompile):
+ (JSC::DFG::tryCompileFunction):
+ * dfg/DFGDriver.h:
+ (DFG):
+ (JSC::DFG::tryCompile):
+ (JSC::DFG::tryCompileFunction):
+ * dfg/DFGGraph.h:
+ (JSC::DFG::Graph::Graph):
+ (Graph):
+ * jit/JITDriver.h:
+ (JSC::jitCompileIfAppropriate):
+ (JSC::jitCompileFunctionIfAppropriate):
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ * runtime/Executable.cpp:
+ (JSC::EvalExecutable::compileOptimized):
+ (JSC::EvalExecutable::compileInternal):
+ (JSC::ProgramExecutable::compileOptimized):
+ (JSC::ProgramExecutable::compileInternal):
+ (JSC::FunctionExecutable::compileOptimizedForCall):
+ (JSC::FunctionExecutable::compileOptimizedForConstruct):
+ (JSC::FunctionExecutable::compileForCallInternal):
+ (JSC::FunctionExecutable::compileForConstructInternal):
+ * runtime/Executable.h:
+ (EvalExecutable):
+ (ProgramExecutable):
+ (FunctionExecutable):
+ (JSC::FunctionExecutable::compileOptimizedFor):
+ * runtime/ExecutionHarness.h:
+ (JSC::prepareForExecution):
+ (JSC::prepareFunctionForExecution):
+
+2012-08-17 Filip Pizlo <[email protected]>
+
DFG CSE should be more honest about when it changed the IR
https://bugs.webkit.org/show_bug.cgi?id=94408
Modified: trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp (125981 => 125982)
--- trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp 2012-08-19 19:49:17 UTC (rev 125981)
+++ trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp 2012-08-19 21:59:12 UTC (rev 125982)
@@ -2687,27 +2687,27 @@
return &static_cast<FunctionExecutable*>(ownerExecutable())->generatedBytecodeFor(m_isConstructor ? CodeForConstruct : CodeForCall);
}
-JSObject* ProgramCodeBlock::compileOptimized(ExecState* exec, ScopeChainNode* scopeChainNode)
+JSObject* ProgramCodeBlock::compileOptimized(ExecState* exec, ScopeChainNode* scopeChainNode, unsigned bytecodeIndex)
{
if (replacement()->getJITType() == JITCode::nextTierJIT(getJITType()))
return 0;
- JSObject* error = static_cast<ProgramExecutable*>(ownerExecutable())->compileOptimized(exec, scopeChainNode);
+ JSObject* error = static_cast<ProgramExecutable*>(ownerExecutable())->compileOptimized(exec, scopeChainNode, bytecodeIndex);
return error;
}
-JSObject* EvalCodeBlock::compileOptimized(ExecState* exec, ScopeChainNode* scopeChainNode)
+JSObject* EvalCodeBlock::compileOptimized(ExecState* exec, ScopeChainNode* scopeChainNode, unsigned bytecodeIndex)
{
if (replacement()->getJITType() == JITCode::nextTierJIT(getJITType()))
return 0;
- JSObject* error = static_cast<EvalExecutable*>(ownerExecutable())->compileOptimized(exec, scopeChainNode);
+ JSObject* error = static_cast<EvalExecutable*>(ownerExecutable())->compileOptimized(exec, scopeChainNode, bytecodeIndex);
return error;
}
-JSObject* FunctionCodeBlock::compileOptimized(ExecState* exec, ScopeChainNode* scopeChainNode)
+JSObject* FunctionCodeBlock::compileOptimized(ExecState* exec, ScopeChainNode* scopeChainNode, unsigned bytecodeIndex)
{
if (replacement()->getJITType() == JITCode::nextTierJIT(getJITType()))
return 0;
- JSObject* error = static_cast<FunctionExecutable*>(ownerExecutable())->compileOptimizedFor(exec, scopeChainNode, m_isConstructor ? CodeForConstruct : CodeForCall);
+ JSObject* error = static_cast<FunctionExecutable*>(ownerExecutable())->compileOptimizedFor(exec, scopeChainNode, bytecodeIndex, m_isConstructor ? CodeForConstruct : CodeForCall);
return error;
}
Modified: trunk/Source/_javascript_Core/bytecode/CodeBlock.h (125981 => 125982)
--- trunk/Source/_javascript_Core/bytecode/CodeBlock.h 2012-08-19 19:49:17 UTC (rev 125981)
+++ trunk/Source/_javascript_Core/bytecode/CodeBlock.h 2012-08-19 21:59:12 UTC (rev 125982)
@@ -442,7 +442,7 @@
MacroAssemblerCodePtr getJITCodeWithArityCheck() { return m_jitCodeWithArityCheck; }
JITCode::JITType getJITType() { return m_jitCode.jitType(); }
ExecutableMemoryHandle* executableMemory() { return getJITCode().getExecutableMemory(); }
- virtual JSObject* compileOptimized(ExecState*, ScopeChainNode*) = 0;
+ virtual JSObject* compileOptimized(ExecState*, ScopeChainNode*, unsigned bytecodeIndex) = 0;
virtual void jettison() = 0;
enum JITCompilationResult { AlreadyCompiled, CouldNotCompile, CompiledSuccessfully };
JITCompilationResult jitCompile(ExecState* exec)
@@ -1448,7 +1448,7 @@
#if ENABLE(JIT)
protected:
- virtual JSObject* compileOptimized(ExecState*, ScopeChainNode*);
+ virtual JSObject* compileOptimized(ExecState*, ScopeChainNode*, unsigned bytecodeIndex);
virtual void jettison();
virtual bool jitCompileImpl(ExecState*);
virtual CodeBlock* replacement();
@@ -1483,7 +1483,7 @@
#if ENABLE(JIT)
protected:
- virtual JSObject* compileOptimized(ExecState*, ScopeChainNode*);
+ virtual JSObject* compileOptimized(ExecState*, ScopeChainNode*, unsigned bytecodeIndex);
virtual void jettison();
virtual bool jitCompileImpl(ExecState*);
virtual CodeBlock* replacement();
@@ -1521,7 +1521,7 @@
#if ENABLE(JIT)
protected:
- virtual JSObject* compileOptimized(ExecState*, ScopeChainNode*);
+ virtual JSObject* compileOptimized(ExecState*, ScopeChainNode*, unsigned bytecodeIndex);
virtual void jettison();
virtual bool jitCompileImpl(ExecState*);
virtual CodeBlock* replacement();
Modified: trunk/Source/_javascript_Core/dfg/DFGAbstractState.cpp (125981 => 125982)
--- trunk/Source/_javascript_Core/dfg/DFGAbstractState.cpp 2012-08-19 19:49:17 UTC (rev 125981)
+++ trunk/Source/_javascript_Core/dfg/DFGAbstractState.cpp 2012-08-19 21:59:12 UTC (rev 125982)
@@ -158,6 +158,16 @@
block->valuesAtHead.local(i).clear();
block->valuesAtTail.local(i).clear();
}
+ if (!block->isOSRTarget)
+ continue;
+ if (block->bytecodeBegin != graph.m_osrEntryBytecodeIndex)
+ continue;
+ for (size_t i = 0; i < graph.m_mustHandleValues.size(); ++i) {
+ AbstractValue value;
+ value.setMostSpecific(graph.m_mustHandleValues[i]);
+ block->valuesAtHead.operand(graph.m_mustHandleValues.operandForIndex(i)).merge(value);
+ }
+ block->cfaShouldRevisit = true;
}
}
Modified: trunk/Source/_javascript_Core/dfg/DFGAbstractValue.h (125981 => 125982)
--- trunk/Source/_javascript_Core/dfg/DFGAbstractValue.h 2012-08-19 19:49:17 UTC (rev 125981)
+++ trunk/Source/_javascript_Core/dfg/DFGAbstractValue.h 2012-08-19 21:59:12 UTC (rev 125982)
@@ -386,6 +386,23 @@
return result;
}
+ void setMostSpecific(JSValue value)
+ {
+ if (!!value && value.isCell()) {
+ Structure* structure = value.asCell()->structure();
+ m_structure = structure;
+ m_unclobberedStructure = structure;
+ } else {
+ m_structure.clear();
+ m_unclobberedStructure.clear();
+ }
+
+ m_type = speculationFromValue(value);
+ m_value = value;
+
+ checkConsistency();
+ }
+
void set(JSValue value)
{
if (!!value && value.isCell()) {
Modified: trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp (125981 => 125982)
--- trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp 2012-08-19 19:49:17 UTC (rev 125981)
+++ trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp 2012-08-19 21:59:12 UTC (rev 125982)
@@ -118,7 +118,7 @@
template<PhiStackType stackType>
void processPhiStack();
- void fixVariableAccessSpeculations();
+ void fixVariableAccessPredictions();
// Add spill locations to nodes.
void allocateVirtualRegisters();
@@ -3030,7 +3030,7 @@
}
}
-void ByteCodeParser::fixVariableAccessSpeculations()
+void ByteCodeParser::fixVariableAccessPredictions()
{
for (unsigned i = 0; i < m_graph.m_variableAccessData.size(); ++i) {
VariableAccessData* data = ""
@@ -3362,8 +3362,28 @@
m_graph.m_blocks[blockIndex].clear();
}
- fixVariableAccessSpeculations();
+ fixVariableAccessPredictions();
+ for (BlockIndex blockIndex = 0; blockIndex < m_graph.m_blocks.size(); ++blockIndex) {
+ BasicBlock* block = m_graph.m_blocks[blockIndex].get();
+ if (!block)
+ continue;
+ if (!block->isOSRTarget)
+ continue;
+ if (block->bytecodeBegin != m_graph.m_osrEntryBytecodeIndex)
+ continue;
+ for (size_t i = 0; i < m_graph.m_mustHandleValues.size(); ++i) {
+ NodeIndex nodeIndex = block->variablesAtHead.operand(
+ m_graph.m_mustHandleValues.operandForIndex(i));
+ if (nodeIndex == NoNode)
+ continue;
+ Node& node = m_graph[nodeIndex];
+ ASSERT(node.hasLocal());
+ node.variableAccessData()->predict(
+ speculationFromValue(m_graph.m_mustHandleValues[i]));
+ }
+ }
+
m_graph.m_preservedVars = m_preservedVars;
m_graph.m_localVars = m_numLocals;
m_graph.m_parameterSlots = m_parameterSlots;
Modified: trunk/Source/_javascript_Core/dfg/DFGDriver.cpp (125981 => 125982)
--- trunk/Source/_javascript_Core/dfg/DFGDriver.cpp 2012-08-19 19:49:17 UTC (rev 125981)
+++ trunk/Source/_javascript_Core/dfg/DFGDriver.cpp 2012-08-19 21:59:12 UTC (rev 125982)
@@ -57,7 +57,7 @@
}
enum CompileMode { CompileFunction, CompileOther };
-inline bool compile(CompileMode compileMode, ExecState* exec, CodeBlock* codeBlock, JITCode& jitCode, MacroAssemblerCodePtr* jitCodeWithArityCheck)
+inline bool compile(CompileMode compileMode, ExecState* exec, CodeBlock* codeBlock, JITCode& jitCode, MacroAssemblerCodePtr* jitCodeWithArityCheck, unsigned osrEntryBytecodeIndex)
{
SamplingRegion samplingRegion("DFG Compilation (Driver)");
@@ -66,6 +66,8 @@
ASSERT(codeBlock);
ASSERT(codeBlock->alternative());
ASSERT(codeBlock->alternative()->getJITType() == JITCode::BaselineJIT);
+
+ ASSERT(osrEntryBytecodeIndex != UINT_MAX);
if (!Options::useDFGJIT())
return false;
@@ -74,7 +76,30 @@
dataLog("DFG compiling code block %p(%p) for executable %p, number of instructions = %u.\n", codeBlock, codeBlock->alternative(), codeBlock->ownerExecutable(), codeBlock->instructionCount());
#endif
- Graph dfg(exec->globalData(), codeBlock);
+ // Derive our set of must-handle values. The compilation must be at least conservative
+ // enough to allow for OSR entry with these values.
+ unsigned numVarsWithValues;
+ if (osrEntryBytecodeIndex)
+ numVarsWithValues = codeBlock->m_numVars;
+ else
+ numVarsWithValues = 0;
+ Operands<JSValue> mustHandleValues(codeBlock->numParameters(), numVarsWithValues);
+ for (size_t i = 0; i < mustHandleValues.size(); ++i) {
+ int operand = mustHandleValues.operandForIndex(i);
+ if (operandIsArgument(operand)
+ && !operandToArgument(operand)
+ && compileMode == CompileFunction
+ && codeBlock->specializationKind() == CodeForConstruct) {
+ // Ugh. If we're in a constructor, the 'this' argument may hold garbage. It will
+ // also never be used. It doesn't matter what we put into the value for this,
+ // but it has to be an actual value that can be grokked by subsequent DFG passes,
+ // so we sanitize it here by turning it into Undefined.
+ mustHandleValues[i] = jsUndefined();
+ } else
+ mustHandleValues[i] = exec->uncheckedR(operand).jsValue();
+ }
+
+ Graph dfg(exec->globalData(), codeBlock, osrEntryBytecodeIndex, mustHandleValues);
if (!parse(exec, dfg))
return false;
@@ -137,14 +162,14 @@
return result;
}
-bool tryCompile(ExecState* exec, CodeBlock* codeBlock, JITCode& jitCode)
+bool tryCompile(ExecState* exec, CodeBlock* codeBlock, JITCode& jitCode, unsigned bytecodeIndex)
{
- return compile(CompileOther, exec, codeBlock, jitCode, 0);
+ return compile(CompileOther, exec, codeBlock, jitCode, 0, bytecodeIndex);
}
-bool tryCompileFunction(ExecState* exec, CodeBlock* codeBlock, JITCode& jitCode, MacroAssemblerCodePtr& jitCodeWithArityCheck)
+bool tryCompileFunction(ExecState* exec, CodeBlock* codeBlock, JITCode& jitCode, MacroAssemblerCodePtr& jitCodeWithArityCheck, unsigned bytecodeIndex)
{
- return compile(CompileFunction, exec, codeBlock, jitCode, &jitCodeWithArityCheck);
+ return compile(CompileFunction, exec, codeBlock, jitCode, &jitCodeWithArityCheck, bytecodeIndex);
}
} } // namespace JSC::DFG
Modified: trunk/Source/_javascript_Core/dfg/DFGDriver.h (125981 => 125982)
--- trunk/Source/_javascript_Core/dfg/DFGDriver.h 2012-08-19 19:49:17 UTC (rev 125981)
+++ trunk/Source/_javascript_Core/dfg/DFGDriver.h 2012-08-19 21:59:12 UTC (rev 125982)
@@ -41,11 +41,11 @@
JS_EXPORT_PRIVATE unsigned getNumCompilations();
#if ENABLE(DFG_JIT)
-bool tryCompile(ExecState*, CodeBlock*, JITCode&);
-bool tryCompileFunction(ExecState*, CodeBlock*, JITCode&, MacroAssemblerCodePtr& jitCodeWithArityCheck);
+bool tryCompile(ExecState*, CodeBlock*, JITCode&, unsigned bytecodeIndex);
+bool tryCompileFunction(ExecState*, CodeBlock*, JITCode&, MacroAssemblerCodePtr& jitCodeWithArityCheck, unsigned bytecodeIndex);
#else
-inline bool tryCompile(ExecState*, CodeBlock*, JITCode&) { return false; }
-inline bool tryCompileFunction(ExecState*, CodeBlock*, JITCode&, MacroAssemblerCodePtr&) { return false; }
+inline bool tryCompile(ExecState*, CodeBlock*, JITCode&, unsigned) { return false; }
+inline bool tryCompileFunction(ExecState*, CodeBlock*, JITCode&, MacroAssemblerCodePtr&, unsigned) { return false; }
#endif
} } // namespace JSC::DFG
Modified: trunk/Source/_javascript_Core/dfg/DFGGraph.h (125981 => 125982)
--- trunk/Source/_javascript_Core/dfg/DFGGraph.h 2012-08-19 19:49:17 UTC (rev 125981)
+++ trunk/Source/_javascript_Core/dfg/DFGGraph.h 2012-08-19 21:59:12 UTC (rev 125982)
@@ -76,11 +76,13 @@
// Nodes that are 'dead' remain in the vector with refCount 0.
class Graph : public Vector<Node, 64> {
public:
- Graph(JSGlobalData& globalData, CodeBlock* codeBlock)
+ Graph(JSGlobalData& globalData, CodeBlock* codeBlock, unsigned osrEntryBytecodeIndex, const Operands<JSValue>& mustHandleValues)
: m_globalData(globalData)
, m_codeBlock(codeBlock)
, m_profiledBlock(codeBlock->alternative())
, m_hasArguments(false)
+ , m_osrEntryBytecodeIndex(osrEntryBytecodeIndex)
+ , m_mustHandleValues(mustHandleValues)
{
ASSERT(m_profiledBlock);
}
@@ -710,6 +712,8 @@
Dominators m_dominators;
unsigned m_localVars;
unsigned m_parameterSlots;
+ unsigned m_osrEntryBytecodeIndex;
+ Operands<JSValue> m_mustHandleValues;
private:
void handleSuccessor(Vector<BlockIndex, 16>& worklist, BlockIndex blockIndex, BlockIndex successorIndex);
Modified: trunk/Source/_javascript_Core/jit/JITDriver.h (125981 => 125982)
--- trunk/Source/_javascript_Core/jit/JITDriver.h 2012-08-19 19:49:17 UTC (rev 125981)
+++ trunk/Source/_javascript_Core/jit/JITDriver.h 2012-08-19 21:59:12 UTC (rev 125982)
@@ -38,7 +38,7 @@
namespace JSC {
template<typename CodeBlockType>
-inline bool jitCompileIfAppropriate(ExecState* exec, OwnPtr<CodeBlockType>& codeBlock, JITCode& jitCode, JITCode::JITType jitType, JITCompilationEffort effort)
+inline bool jitCompileIfAppropriate(ExecState* exec, OwnPtr<CodeBlockType>& codeBlock, JITCode& jitCode, JITCode::JITType jitType, unsigned bytecodeIndex, JITCompilationEffort effort)
{
JSGlobalData& globalData = exec->globalData();
@@ -54,7 +54,7 @@
bool dfgCompiled = false;
if (jitType == JITCode::DFGJIT)
- dfgCompiled = DFG::tryCompile(exec, codeBlock.get(), jitCode);
+ dfgCompiled = DFG::tryCompile(exec, codeBlock.get(), jitCode, bytecodeIndex);
if (dfgCompiled) {
if (codeBlock->alternative())
codeBlock->alternative()->unlinkIncomingCalls();
@@ -75,7 +75,7 @@
return true;
}
-inline bool jitCompileFunctionIfAppropriate(ExecState* exec, OwnPtr<FunctionCodeBlock>& codeBlock, JITCode& jitCode, MacroAssemblerCodePtr& jitCodeWithArityCheck, SharedSymbolTable*& symbolTable, JITCode::JITType jitType, JITCompilationEffort effort)
+inline bool jitCompileFunctionIfAppropriate(ExecState* exec, OwnPtr<FunctionCodeBlock>& codeBlock, JITCode& jitCode, MacroAssemblerCodePtr& jitCodeWithArityCheck, SharedSymbolTable*& symbolTable, JITCode::JITType jitType, unsigned bytecodeIndex, JITCompilationEffort effort)
{
JSGlobalData& globalData = exec->globalData();
@@ -92,7 +92,7 @@
bool dfgCompiled = false;
if (jitType == JITCode::DFGJIT)
- dfgCompiled = DFG::tryCompileFunction(exec, codeBlock.get(), jitCode, jitCodeWithArityCheck);
+ dfgCompiled = DFG::tryCompileFunction(exec, codeBlock.get(), jitCode, jitCodeWithArityCheck, bytecodeIndex);
if (dfgCompiled) {
if (codeBlock->alternative())
codeBlock->alternative()->unlinkIncomingCalls();
Modified: trunk/Source/_javascript_Core/jit/JITStubs.cpp (125981 => 125982)
--- trunk/Source/_javascript_Core/jit/JITStubs.cpp 2012-08-19 19:49:17 UTC (rev 125981)
+++ trunk/Source/_javascript_Core/jit/JITStubs.cpp 2012-08-19 21:59:12 UTC (rev 125982)
@@ -2022,8 +2022,7 @@
}
ScopeChainNode* scopeChain = callFrame->scopeChain();
-
- JSObject* error = codeBlock->compileOptimized(callFrame, scopeChain);
+ JSObject* error = codeBlock->compileOptimized(callFrame, scopeChain, bytecodeIndex);
#if ENABLE(JIT_VERBOSE_OSR)
if (error)
dataLog("WARNING: optimized compilation failed.\n");
Modified: trunk/Source/_javascript_Core/runtime/Executable.cpp (125981 => 125982)
--- trunk/Source/_javascript_Core/runtime/Executable.cpp 2012-08-19 19:49:17 UTC (rev 125981)
+++ trunk/Source/_javascript_Core/runtime/Executable.cpp 2012-08-19 21:59:12 UTC (rev 125982)
@@ -160,13 +160,13 @@
static_cast<FunctionExecutable*>(cell)->FunctionExecutable::~FunctionExecutable();
}
-JSObject* EvalExecutable::compileOptimized(ExecState* exec, ScopeChainNode* scopeChainNode)
+JSObject* EvalExecutable::compileOptimized(ExecState* exec, ScopeChainNode* scopeChainNode, unsigned bytecodeIndex)
{
ASSERT(exec->globalData().dynamicGlobalObject);
ASSERT(!!m_evalCodeBlock);
JSObject* error = 0;
if (m_evalCodeBlock->getJITType() != JITCode::topTierJIT())
- error = compileInternal(exec, scopeChainNode, JITCode::nextTierJIT(m_evalCodeBlock->getJITType()));
+ error = compileInternal(exec, scopeChainNode, JITCode::nextTierJIT(m_evalCodeBlock->getJITType()), bytecodeIndex);
ASSERT(!!m_evalCodeBlock);
return error;
}
@@ -174,7 +174,7 @@
#if ENABLE(JIT)
bool EvalExecutable::jitCompile(ExecState* exec)
{
- return jitCompileIfAppropriate(exec, m_evalCodeBlock, m_jitCodeForCall, JITCode::bottomTierJIT(), JITCompilationCanFail);
+ return jitCompileIfAppropriate(exec, m_evalCodeBlock, m_jitCodeForCall, JITCode::bottomTierJIT(), UINT_MAX, JITCompilationCanFail);
}
#endif
@@ -193,7 +193,7 @@
}
}
-JSObject* EvalExecutable::compileInternal(ExecState* exec, ScopeChainNode* scopeChainNode, JITCode::JITType jitType)
+JSObject* EvalExecutable::compileInternal(ExecState* exec, ScopeChainNode* scopeChainNode, JITCode::JITType jitType, unsigned bytecodeIndex)
{
SamplingRegion samplingRegion(samplingDescription(jitType));
@@ -235,7 +235,7 @@
}
#if ENABLE(JIT)
- if (!prepareForExecution(exec, m_evalCodeBlock, m_jitCodeForCall, jitType))
+ if (!prepareForExecution(exec, m_evalCodeBlock, m_jitCodeForCall, jitType, bytecodeIndex))
return 0;
#endif
@@ -301,13 +301,13 @@
return exception;
}
-JSObject* ProgramExecutable::compileOptimized(ExecState* exec, ScopeChainNode* scopeChainNode)
+JSObject* ProgramExecutable::compileOptimized(ExecState* exec, ScopeChainNode* scopeChainNode, unsigned bytecodeIndex)
{
ASSERT(exec->globalData().dynamicGlobalObject);
ASSERT(!!m_programCodeBlock);
JSObject* error = 0;
if (m_programCodeBlock->getJITType() != JITCode::topTierJIT())
- error = compileInternal(exec, scopeChainNode, JITCode::nextTierJIT(m_programCodeBlock->getJITType()));
+ error = compileInternal(exec, scopeChainNode, JITCode::nextTierJIT(m_programCodeBlock->getJITType()), bytecodeIndex);
ASSERT(!!m_programCodeBlock);
return error;
}
@@ -315,11 +315,11 @@
#if ENABLE(JIT)
bool ProgramExecutable::jitCompile(ExecState* exec)
{
- return jitCompileIfAppropriate(exec, m_programCodeBlock, m_jitCodeForCall, JITCode::bottomTierJIT(), JITCompilationCanFail);
+ return jitCompileIfAppropriate(exec, m_programCodeBlock, m_jitCodeForCall, JITCode::bottomTierJIT(), UINT_MAX, JITCompilationCanFail);
}
#endif
-JSObject* ProgramExecutable::compileInternal(ExecState* exec, ScopeChainNode* scopeChainNode, JITCode::JITType jitType)
+JSObject* ProgramExecutable::compileInternal(ExecState* exec, ScopeChainNode* scopeChainNode, JITCode::JITType jitType, unsigned bytecodeIndex)
{
SamplingRegion samplingRegion(samplingDescription(jitType));
@@ -359,7 +359,7 @@
}
#if ENABLE(JIT)
- if (!prepareForExecution(exec, m_programCodeBlock, m_jitCodeForCall, jitType))
+ if (!prepareForExecution(exec, m_programCodeBlock, m_jitCodeForCall, jitType, bytecodeIndex))
return 0;
#endif
@@ -431,24 +431,24 @@
return result;
}
-JSObject* FunctionExecutable::compileOptimizedForCall(ExecState* exec, ScopeChainNode* scopeChainNode)
+JSObject* FunctionExecutable::compileOptimizedForCall(ExecState* exec, ScopeChainNode* scopeChainNode, unsigned bytecodeIndex)
{
ASSERT(exec->globalData().dynamicGlobalObject);
ASSERT(!!m_codeBlockForCall);
JSObject* error = 0;
if (m_codeBlockForCall->getJITType() != JITCode::topTierJIT())
- error = compileForCallInternal(exec, scopeChainNode, JITCode::nextTierJIT(m_codeBlockForCall->getJITType()));
+ error = compileForCallInternal(exec, scopeChainNode, JITCode::nextTierJIT(m_codeBlockForCall->getJITType()), bytecodeIndex);
ASSERT(!!m_codeBlockForCall);
return error;
}
-JSObject* FunctionExecutable::compileOptimizedForConstruct(ExecState* exec, ScopeChainNode* scopeChainNode)
+JSObject* FunctionExecutable::compileOptimizedForConstruct(ExecState* exec, ScopeChainNode* scopeChainNode, unsigned bytecodeIndex)
{
ASSERT(exec->globalData().dynamicGlobalObject);
ASSERT(!!m_codeBlockForConstruct);
JSObject* error = 0;
if (m_codeBlockForConstruct->getJITType() != JITCode::topTierJIT())
- error = compileForConstructInternal(exec, scopeChainNode, JITCode::nextTierJIT(m_codeBlockForConstruct->getJITType()));
+ error = compileForConstructInternal(exec, scopeChainNode, JITCode::nextTierJIT(m_codeBlockForConstruct->getJITType()), bytecodeIndex);
ASSERT(!!m_codeBlockForConstruct);
return error;
}
@@ -456,12 +456,12 @@
#if ENABLE(JIT)
bool FunctionExecutable::jitCompileForCall(ExecState* exec)
{
- return jitCompileFunctionIfAppropriate(exec, m_codeBlockForCall, m_jitCodeForCall, m_jitCodeForCallWithArityCheck, m_symbolTable, JITCode::bottomTierJIT(), JITCompilationCanFail);
+ return jitCompileFunctionIfAppropriate(exec, m_codeBlockForCall, m_jitCodeForCall, m_jitCodeForCallWithArityCheck, m_symbolTable, JITCode::bottomTierJIT(), UINT_MAX, JITCompilationCanFail);
}
bool FunctionExecutable::jitCompileForConstruct(ExecState* exec)
{
- return jitCompileFunctionIfAppropriate(exec, m_codeBlockForConstruct, m_jitCodeForConstruct, m_jitCodeForConstructWithArityCheck, m_symbolTable, JITCode::bottomTierJIT(), JITCompilationCanFail);
+ return jitCompileFunctionIfAppropriate(exec, m_codeBlockForConstruct, m_jitCodeForConstruct, m_jitCodeForConstructWithArityCheck, m_symbolTable, JITCode::bottomTierJIT(), UINT_MAX, JITCompilationCanFail);
}
#endif
@@ -502,7 +502,7 @@
return result.release();
}
-JSObject* FunctionExecutable::compileForCallInternal(ExecState* exec, ScopeChainNode* scopeChainNode, JITCode::JITType jitType)
+JSObject* FunctionExecutable::compileForCallInternal(ExecState* exec, ScopeChainNode* scopeChainNode, JITCode::JITType jitType, unsigned bytecodeIndex)
{
SamplingRegion samplingRegion(samplingDescription(jitType));
@@ -526,7 +526,7 @@
m_symbolTable = m_codeBlockForCall->sharedSymbolTable();
#if ENABLE(JIT)
- if (!prepareFunctionForExecution(exec, m_codeBlockForCall, m_jitCodeForCall, m_jitCodeForCallWithArityCheck, m_symbolTable, jitType, CodeForCall))
+ if (!prepareFunctionForExecution(exec, m_codeBlockForCall, m_jitCodeForCall, m_jitCodeForCallWithArityCheck, m_symbolTable, jitType, bytecodeIndex, CodeForCall))
return 0;
#endif
@@ -544,7 +544,7 @@
return 0;
}
-JSObject* FunctionExecutable::compileForConstructInternal(ExecState* exec, ScopeChainNode* scopeChainNode, JITCode::JITType jitType)
+JSObject* FunctionExecutable::compileForConstructInternal(ExecState* exec, ScopeChainNode* scopeChainNode, JITCode::JITType jitType, unsigned bytecodeIndex)
{
SamplingRegion samplingRegion(samplingDescription(jitType));
@@ -568,7 +568,7 @@
m_symbolTable = m_codeBlockForConstruct->sharedSymbolTable();
#if ENABLE(JIT)
- if (!prepareFunctionForExecution(exec, m_codeBlockForConstruct, m_jitCodeForConstruct, m_jitCodeForConstructWithArityCheck, m_symbolTable, jitType, CodeForConstruct))
+ if (!prepareFunctionForExecution(exec, m_codeBlockForConstruct, m_jitCodeForConstruct, m_jitCodeForConstructWithArityCheck, m_symbolTable, jitType, bytecodeIndex, CodeForConstruct))
return 0;
#endif
Modified: trunk/Source/_javascript_Core/runtime/Executable.h (125981 => 125982)
--- trunk/Source/_javascript_Core/runtime/Executable.h 2012-08-19 19:49:17 UTC (rev 125981)
+++ trunk/Source/_javascript_Core/runtime/Executable.h 2012-08-19 21:59:12 UTC (rev 125982)
@@ -377,7 +377,7 @@
return error;
}
- JSObject* compileOptimized(ExecState*, ScopeChainNode*);
+ JSObject* compileOptimized(ExecState*, ScopeChainNode*, unsigned bytecodeIndex);
#if ENABLE(JIT)
void jettisonOptimizedCode(JSGlobalData&);
@@ -418,7 +418,7 @@
static const unsigned StructureFlags = OverridesVisitChildren | ScriptExecutable::StructureFlags;
EvalExecutable(ExecState*, const SourceCode&, bool);
- JSObject* compileInternal(ExecState*, ScopeChainNode*, JITCode::JITType);
+ JSObject* compileInternal(ExecState*, ScopeChainNode*, JITCode::JITType, unsigned bytecodeIndex = UINT_MAX);
static void visitChildren(JSCell*, SlotVisitor&);
OwnPtr<EvalCodeBlock> m_evalCodeBlock;
@@ -448,7 +448,7 @@
return error;
}
- JSObject* compileOptimized(ExecState*, ScopeChainNode*);
+ JSObject* compileOptimized(ExecState*, ScopeChainNode*, unsigned bytecodeIndex);
#if ENABLE(JIT)
void jettisonOptimizedCode(JSGlobalData&);
@@ -485,7 +485,7 @@
static const unsigned StructureFlags = OverridesVisitChildren | ScriptExecutable::StructureFlags;
ProgramExecutable(ExecState*, const SourceCode&);
- JSObject* compileInternal(ExecState*, ScopeChainNode*, JITCode::JITType);
+ JSObject* compileInternal(ExecState*, ScopeChainNode*, JITCode::JITType, unsigned bytecodeIndex = UINT_MAX);
static void visitChildren(JSCell*, SlotVisitor&);
OwnPtr<ProgramCodeBlock> m_programCodeBlock;
@@ -543,7 +543,7 @@
return error;
}
- JSObject* compileOptimizedForCall(ExecState*, ScopeChainNode*);
+ JSObject* compileOptimizedForCall(ExecState*, ScopeChainNode*, unsigned bytecodeIndex);
#if ENABLE(JIT)
void jettisonOptimizedCodeForCall(JSGlobalData&);
@@ -571,7 +571,7 @@
return error;
}
- JSObject* compileOptimizedForConstruct(ExecState*, ScopeChainNode*);
+ JSObject* compileOptimizedForConstruct(ExecState*, ScopeChainNode*, unsigned bytecodeIndex);
#if ENABLE(JIT)
void jettisonOptimizedCodeForConstruct(JSGlobalData&);
@@ -601,16 +601,16 @@
return compileForConstruct(exec, scopeChainNode);
}
- JSObject* compileOptimizedFor(ExecState* exec, ScopeChainNode* scopeChainNode, CodeSpecializationKind kind)
+ JSObject* compileOptimizedFor(ExecState* exec, ScopeChainNode* scopeChainNode, unsigned bytecodeIndex, CodeSpecializationKind kind)
{
ASSERT(exec->callee());
ASSERT(exec->callee()->inherits(&JSFunction::s_info));
ASSERT(jsCast<JSFunction*>(exec->callee())->jsExecutable() == this);
if (kind == CodeForCall)
- return compileOptimizedForCall(exec, scopeChainNode);
+ return compileOptimizedForCall(exec, scopeChainNode, bytecodeIndex);
ASSERT(kind == CodeForConstruct);
- return compileOptimizedForConstruct(exec, scopeChainNode);
+ return compileOptimizedForConstruct(exec, scopeChainNode, bytecodeIndex);
}
#if ENABLE(JIT)
@@ -691,8 +691,8 @@
FunctionExecutable(JSGlobalData&, const Identifier& name, const Identifier& inferredName, const SourceCode&, bool forceUsesArguments, FunctionParameters*, bool);
FunctionExecutable(ExecState*, const Identifier& name, const Identifier& inferredName, const SourceCode&, bool forceUsesArguments, FunctionParameters*, bool);
- JSObject* compileForCallInternal(ExecState*, ScopeChainNode*, JITCode::JITType);
- JSObject* compileForConstructInternal(ExecState*, ScopeChainNode*, JITCode::JITType);
+ JSObject* compileForCallInternal(ExecState*, ScopeChainNode*, JITCode::JITType, unsigned bytecodeIndex = UINT_MAX);
+ JSObject* compileForConstructInternal(ExecState*, ScopeChainNode*, JITCode::JITType, unsigned bytecodeIndex = UINT_MAX);
OwnPtr<FunctionCodeBlock>& codeBlockFor(CodeSpecializationKind kind)
{
Modified: trunk/Source/_javascript_Core/runtime/ExecutionHarness.h (125981 => 125982)
--- trunk/Source/_javascript_Core/runtime/ExecutionHarness.h 2012-08-19 19:49:17 UTC (rev 125981)
+++ trunk/Source/_javascript_Core/runtime/ExecutionHarness.h 2012-08-19 21:59:12 UTC (rev 125982)
@@ -36,7 +36,7 @@
namespace JSC {
template<typename CodeBlockType>
-inline bool prepareForExecution(ExecState* exec, OwnPtr<CodeBlockType>& codeBlock, JITCode& jitCode, JITCode::JITType jitType)
+inline bool prepareForExecution(ExecState* exec, OwnPtr<CodeBlockType>& codeBlock, JITCode& jitCode, JITCode::JITType jitType, unsigned bytecodeIndex)
{
#if ENABLE(LLINT)
if (JITCode::isBaselineCode(jitType)) {
@@ -46,10 +46,10 @@
return true;
}
#endif // ENABLE(LLINT)
- return jitCompileIfAppropriate(exec, codeBlock, jitCode, jitType, JITCode::isBaselineCode(jitType) ? JITCompilationMustSucceed : JITCompilationCanFail);
+ return jitCompileIfAppropriate(exec, codeBlock, jitCode, jitType, bytecodeIndex, JITCode::isBaselineCode(jitType) ? JITCompilationMustSucceed : JITCompilationCanFail);
}
-inline bool prepareFunctionForExecution(ExecState* exec, OwnPtr<FunctionCodeBlock>& codeBlock, JITCode& jitCode, MacroAssemblerCodePtr& jitCodeWithArityCheck, SharedSymbolTable*& symbolTable, JITCode::JITType jitType, CodeSpecializationKind kind)
+inline bool prepareFunctionForExecution(ExecState* exec, OwnPtr<FunctionCodeBlock>& codeBlock, JITCode& jitCode, MacroAssemblerCodePtr& jitCodeWithArityCheck, SharedSymbolTable*& symbolTable, JITCode::JITType jitType, unsigned bytecodeIndex, CodeSpecializationKind kind)
{
#if ENABLE(LLINT)
if (JITCode::isBaselineCode(jitType)) {
@@ -61,7 +61,7 @@
#else
UNUSED_PARAM(kind);
#endif // ENABLE(LLINT)
- return jitCompileFunctionIfAppropriate(exec, codeBlock, jitCode, jitCodeWithArityCheck, symbolTable, jitType, JITCode::isBaselineCode(jitType) ? JITCompilationMustSucceed : JITCompilationCanFail);
+ return jitCompileFunctionIfAppropriate(exec, codeBlock, jitCode, jitCodeWithArityCheck, symbolTable, jitType, bytecodeIndex, JITCode::isBaselineCode(jitType) ? JITCompilationMustSucceed : JITCompilationCanFail);
}
} // namespace JSC