- Revision
- 168780
- Author
- [email protected]
- Date
- 2014-05-13 21:29:21 -0700 (Tue, 13 May 2014)
Log Message
[ftlopt] DFG should not exit due to inadequate profiling coverage when it can trivially fill in the profiling coverage due to variable constant inference and the better prediction modeling of typed array GetByVals
https://bugs.webkit.org/show_bug.cgi?id=132896
Reviewed by Geoffrey Garen.
This is a slight win on SunSpider, but it's meant to ultimately help us on
embenchen/lua. We already do well on that benchmark but our convergence is slower than
I'd like.
* dfg/DFGArrayMode.cpp:
(JSC::DFG::ArrayMode::refine):
* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::parseBlock):
* dfg/DFGFixupPhase.cpp:
(JSC::DFG::FixupPhase::fixupNode):
* dfg/DFGPredictionPropagationPhase.cpp:
(JSC::DFG::PredictionPropagationPhase::propagate):
Modified Paths
Diff
Modified: branches/ftlopt/Source/_javascript_Core/ChangeLog (168779 => 168780)
--- branches/ftlopt/Source/_javascript_Core/ChangeLog 2014-05-14 04:15:16 UTC (rev 168779)
+++ branches/ftlopt/Source/_javascript_Core/ChangeLog 2014-05-14 04:29:21 UTC (rev 168780)
@@ -1,3 +1,23 @@
+2014-05-13 Filip Pizlo <[email protected]>
+
+ [ftlopt] DFG should not exit due to inadequate profiling coverage when it can trivially fill in the profiling coverage due to variable constant inference and the better prediction modeling of typed array GetByVals
+ https://bugs.webkit.org/show_bug.cgi?id=132896
+
+ Reviewed by Geoffrey Garen.
+
+ This is a slight win on SunSpider, but it's meant to ultimately help us on
+ embenchen/lua. We already do well on that benchmark but our convergence is slower than
+ I'd like.
+
+ * dfg/DFGArrayMode.cpp:
+ (JSC::DFG::ArrayMode::refine):
+ * dfg/DFGByteCodeParser.cpp:
+ (JSC::DFG::ByteCodeParser::parseBlock):
+ * dfg/DFGFixupPhase.cpp:
+ (JSC::DFG::FixupPhase::fixupNode):
+ * dfg/DFGPredictionPropagationPhase.cpp:
+ (JSC::DFG::PredictionPropagationPhase::propagate):
+
2014-05-08 Filip Pizlo <[email protected]>
jsSubstring() should be lazy
Modified: branches/ftlopt/Source/_javascript_Core/dfg/DFGArrayMode.cpp (168779 => 168780)
--- branches/ftlopt/Source/_javascript_Core/dfg/DFGArrayMode.cpp 2014-05-14 04:15:16 UTC (rev 168779)
+++ branches/ftlopt/Source/_javascript_Core/dfg/DFGArrayMode.cpp 2014-05-14 04:29:21 UTC (rev 168780)
@@ -158,9 +158,6 @@
// should just trust the array profile.
switch (type()) {
- case Array::Unprofiled:
- return ArrayMode(Array::ForceExit);
-
case Array::Undecided:
if (!value)
return withType(Array::ForceExit);
@@ -189,6 +186,7 @@
return withConversion(Array::RageConvert);
return *this;
+ case Array::Unprofiled:
case Array::SelectUsingPredictions: {
base &= ~SpecOther;
@@ -239,6 +237,8 @@
if (isFloat64ArraySpeculation(base))
return result.withType(Array::Float64Array);
+ if (type() == Array::Unprofiled)
+ return ArrayMode(Array::ForceExit);
return ArrayMode(Array::Generic);
}
Modified: branches/ftlopt/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp (168779 => 168780)
--- branches/ftlopt/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp 2014-05-14 04:15:16 UTC (rev 168779)
+++ branches/ftlopt/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp 2014-05-14 04:29:21 UTC (rev 168780)
@@ -2632,7 +2632,7 @@
// === Property access operations ===
case op_get_by_val: {
- SpeculatedType prediction = getPrediction();
+ SpeculatedType prediction = getPredictionWithoutOSRExit();
Node* base = get(VirtualRegister(currentInstruction[2].u.operand));
ArrayMode arrayMode = getArrayModeConsideringSlowPath(currentInstruction[4].u.arrayProfile, Array::Read);
@@ -3051,12 +3051,12 @@
UNUSED_PARAM(watchpoints); // We will use this in the future. For now we set it as a way of documenting the fact that that's what index 5 is in GlobalVar mode.
- SpeculatedType prediction = getPrediction();
JSGlobalObject* globalObject = m_inlineStackTop->m_codeBlock->globalObject();
switch (resolveType) {
case GlobalProperty:
case GlobalPropertyWithVarInjectionChecks: {
+ SpeculatedType prediction = getPrediction();
GetByIdStatus status = GetByIdStatus::computeFor(*m_vm, structure, uid);
if (status.state() != GetByIdStatus::Simple || status.numVariants() != 1) {
set(VirtualRegister(dst), addToGraph(GetByIdFlush, OpInfo(identifierNumber), OpInfo(prediction), get(VirtualRegister(scope))));
@@ -3078,6 +3078,7 @@
JSValue specificValue =
watchpointSet ? watchpointSet->inferredValue() : JSValue();
if (!specificValue) {
+ SpeculatedType prediction = getPrediction();
set(VirtualRegister(dst), addToGraph(GetGlobalVar, OpInfo(operand), OpInfo(prediction)));
break;
}
@@ -3104,6 +3105,7 @@
}
}
}
+ SpeculatedType prediction = getPrediction();
set(VirtualRegister(dst),
addToGraph(GetClosureVar, OpInfo(operand), OpInfo(prediction),
addToGraph(GetClosureRegisters, scopeNode)));
Modified: branches/ftlopt/Source/_javascript_Core/dfg/DFGFixupPhase.cpp (168779 => 168780)
--- branches/ftlopt/Source/_javascript_Core/dfg/DFGFixupPhase.cpp 2014-05-14 04:15:16 UTC (rev 168779)
+++ branches/ftlopt/Source/_javascript_Core/dfg/DFGFixupPhase.cpp 2014-05-14 04:29:21 UTC (rev 168780)
@@ -493,6 +493,11 @@
}
case GetByVal: {
+ if (!node->prediction()) {
+ m_insertionSet.insertNode(
+ m_indexInBlock, SpecNone, ForceOSRExit, node->origin);
+ }
+
node->setArrayMode(
node->arrayMode().refine(
m_graph, node,
Modified: branches/ftlopt/Source/_javascript_Core/dfg/DFGPredictionPropagationPhase.cpp (168779 => 168780)
--- branches/ftlopt/Source/_javascript_Core/dfg/DFGPredictionPropagationPhase.cpp 2014-05-14 04:15:16 UTC (rev 168779)
+++ branches/ftlopt/Source/_javascript_Core/dfg/DFGPredictionPropagationPhase.cpp 2014-05-14 04:29:21 UTC (rev 168780)
@@ -369,18 +369,23 @@
case GetByVal: {
if (!node->child1()->prediction())
break;
- if (!node->getHeapPrediction())
- break;
if (node->child1()->shouldSpeculateFloat32Array()
|| node->child1()->shouldSpeculateFloat64Array())
changed |= mergePrediction(SpecFullDouble);
else if (node->child1()->shouldSpeculateUint32Array()) {
- if (isInt32Speculation(node->getHeapPrediction()))
+ if (isInt32SpeculationForArithmetic(node->getHeapPrediction()))
changed |= mergePrediction(SpecInt32);
else
changed |= mergePrediction(SpecInt52);
- } else
+ } else if (
+ node->child1()->shouldSpeculateInt8Array()
+ || node->child1()->shouldSpeculateInt16Array()
+ || node->child1()->shouldSpeculateInt32Array()
+ || node->child1()->shouldSpeculateUint8Array()
+ || node->child1()->shouldSpeculateUint16Array())
+ changed |= mergePrediction(SpecInt32);
+ else
changed |= mergePrediction(node->getHeapPrediction());
break;
}