JSVALUE32_64 DFG JIT - unboxed integers and cells in register file must be...

JSVALUE32_64 DFG JIT - unboxed integers and cells in register file must be reboxed before exiting from DFG JIT
https://bugs.webkit.org/show_bug.cgi?id=69205

Patch by Yuqiang Xian <yuqiang.xian@intel.com> on 2011-10-01
Reviewed by Gavin Barraclough.

If there are unboxed integers and cells in register file (e.g. by SetLocal),
they must be reboxed before exiting from the speculative DFG JIT execution.
This patch also adds a new ValueSourceKind (CellInRegisterFile) and a new
ValueRecoveryTechnique (AlreadyInRegisterFileAsCell).

* dfg/DFGJITCompiler32_64.cpp:
(JSC::DFG::JITCompiler::exitSpeculativeWithOSR):
* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::ValueSource::dump):
(JSC::DFG::ValueRecovery::dump):
(JSC::DFG::SpeculativeJIT::computeValueRecoveryFor):
* dfg/DFGSpeculativeJIT.h:
(JSC::DFG::ValueSource::forPrediction):
(JSC::DFG::ValueRecovery::alreadyInRegisterFileAsUnboxedCell):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@96458 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 87fb93e0
2011-10-01 Yuqiang Xian <yuqiang.xian@intel.com>
JSVALUE32_64 DFG JIT - unboxed integers and cells in register file must be reboxed before exiting from DFG JIT
https://bugs.webkit.org/show_bug.cgi?id=69205
Reviewed by Gavin Barraclough.
If there are unboxed integers and cells in register file (e.g. by SetLocal),
they must be reboxed before exiting from the speculative DFG JIT execution.
This patch also adds a new ValueSourceKind (CellInRegisterFile) and a new
ValueRecoveryTechnique (AlreadyInRegisterFileAsCell).
* dfg/DFGJITCompiler32_64.cpp:
(JSC::DFG::JITCompiler::exitSpeculativeWithOSR):
* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::ValueSource::dump):
(JSC::DFG::ValueRecovery::dump):
(JSC::DFG::SpeculativeJIT::computeValueRecoveryFor):
* dfg/DFGSpeculativeJIT.h:
(JSC::DFG::ValueSource::forPrediction):
(JSC::DFG::ValueRecovery::alreadyInRegisterFileAsUnboxedCell):
2011-10-01 Sheriff Bot <webkit.review.bot@gmail.com>
Unreviewed, rolling out r96421.
......@@ -146,7 +146,8 @@ void JITCompiler::exitSpeculativeWithOSR(const OSRExit& exit, SpeculationRecover
// Int32s, have no FPRs, and have no constants. If there are constants, we
// expect most of them to be jsUndefined(); if that's true then we handle that
// specially to minimize code size and execution time.
bool haveUnboxedInt32s = false;
bool haveUnboxedInt32InRegisterFile = false;
bool haveUnboxedCellInRegisterFile = false;
bool haveFPRs = false;
bool haveConstants = false;
bool haveUndefined = false;
......@@ -182,8 +183,12 @@ void JITCompiler::exitSpeculativeWithOSR(const OSRExit& exit, SpeculationRecover
}
break;
case UnboxedInt32InGPR:
haveUnboxedInt32s = true;
case AlreadyInRegisterFileAsUnboxedInt32:
haveUnboxedInt32InRegisterFile = true;
break;
case AlreadyInRegisterFileAsUnboxedCell:
haveUnboxedCellInRegisterFile = true;
break;
case InFPR:
......@@ -206,9 +211,26 @@ void JITCompiler::exitSpeculativeWithOSR(const OSRExit& exit, SpeculationRecover
// From here on, the code assumes that it is profitable to maximize the distance
// between when something is computed and when it is stored.
// 4) Perform all reboxing of integers.
// Currently we don't rebox for JSValue32_64.
// 4) Perform all reboxing of integers and cells, except for those in registers.
if (haveUnboxedInt32InRegisterFile || haveUnboxedCellInRegisterFile) {
for (int index = 0; index < exit.numberOfRecoveries(); ++index) {
const ValueRecovery& recovery = exit.valueRecovery(index);
switch (recovery.technique()) {
case AlreadyInRegisterFileAsUnboxedInt32:
store32(TrustedImm32(JSValue::Int32Tag), tagFor(static_cast<VirtualRegister>(exit.operandForIndex(index))));
break;
case AlreadyInRegisterFileAsUnboxedCell:
store32(TrustedImm32(JSValue::CellTag), tagFor(static_cast<VirtualRegister>(exit.operandForIndex(index))));
break;
default:
break;
}
}
}
// 5) Dump all non-poisoned GPRs. For poisoned GPRs, save them into the scratch storage.
// Note that GPRs do not have a fast change (like haveFPRs) because we expect that
// most OSR failure points will have at least one GPR that needs to be dumped.
......
......@@ -44,6 +44,9 @@ void ValueSource::dump(FILE* out) const
case Int32InRegisterFile:
fprintf(out, "Int32");
break;
case CellInRegisterFile:
fprintf(out, "Cell");
break;
case HaveNode:
fprintf(out, "Node(%d)", m_nodeIndex);
break;
......@@ -59,6 +62,9 @@ void ValueRecovery::dump(FILE* out) const
case AlreadyInRegisterFileAsUnboxedInt32:
fprintf(out, "(int32)");
break;
case AlreadyInRegisterFileAsUnboxedCell:
fprintf(out, "(cell)");
break;
case InGPR:
fprintf(out, "%%%s", GPRInfo::debugName(gpr()));
break;
......@@ -399,6 +405,9 @@ ValueRecovery SpeculativeJIT::computeValueRecoveryFor(const ValueSource& valueSo
case Int32InRegisterFile:
return ValueRecovery::alreadyInRegisterFileAsUnboxedInt32();
case CellInRegisterFile:
return ValueRecovery::alreadyInRegisterFileAsUnboxedCell();
case HaveNode: {
if (m_jit.isConstant(valueSource.nodeIndex()))
return ValueRecovery::constant(m_jit.valueOfJSConstant(valueSource.nodeIndex()));
......
......@@ -70,6 +70,7 @@ enum ValueSourceKind {
SourceNotSet,
ValueInRegisterFile,
Int32InRegisterFile,
CellInRegisterFile,
HaveNode
};
......@@ -97,6 +98,8 @@ public:
{
if (isInt32Prediction(prediction))
return ValueSource(Int32InRegisterFile);
if (isCellPrediction(prediction))
return ValueSource(CellInRegisterFile);
return ValueSource(ValueInRegisterFile);
}
......@@ -145,6 +148,7 @@ enum ValueRecoveryTechnique {
AlreadyInRegisterFile,
// It's already in the register file but unboxed.
AlreadyInRegisterFileAsUnboxedInt32,
AlreadyInRegisterFileAsUnboxedCell,
// It's in a register.
InGPR,
UnboxedInt32InGPR,
......@@ -181,6 +185,13 @@ public:
return result;
}
static ValueRecovery alreadyInRegisterFileAsUnboxedCell()
{
ValueRecovery result;
result.m_technique = AlreadyInRegisterFileAsUnboxedCell;
return result;
}
static ValueRecovery inGPR(GPRReg gpr, DataFormat dataFormat)
{
ASSERT(dataFormat != DataFormatNone);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment