DFG::Node::shouldNotSpeculateInteger() should be eliminated
https://bugs.webkit.org/show_bug.cgi?id=82123
Reviewed by Geoff Garen.
* dfg/DFGAbstractState.cpp:
(JSC::DFG::AbstractState::execute):
* dfg/DFGNode.h:
(Node):
* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compilePutByValForByteArray):
(JSC::DFG::SpeculativeJIT::compilePutByValForIntTypedArray):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@112013 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog
index e7af42e..177d83b 100644
--- a/Source/JavaScriptCore/ChangeLog
+++ b/Source/JavaScriptCore/ChangeLog
@@ -1,3 +1,18 @@
+2012-03-24 Filip Pizlo <fpizlo@apple.com>
+
+ DFG::Node::shouldNotSpeculateInteger() should be eliminated
+ https://bugs.webkit.org/show_bug.cgi?id=82123
+
+ Reviewed by Geoff Garen.
+
+ * dfg/DFGAbstractState.cpp:
+ (JSC::DFG::AbstractState::execute):
+ * dfg/DFGNode.h:
+ (Node):
+ * dfg/DFGSpeculativeJIT.cpp:
+ (JSC::DFG::SpeculativeJIT::compilePutByValForByteArray):
+ (JSC::DFG::SpeculativeJIT::compilePutByValForIntTypedArray):
+
2012-03-24 Yong Li <yoli@rim.com>
Increase getByIdSlowCase ConstantSpace/InstructionSpace for CPU(ARM_TRADITIONAL)
diff --git a/Source/JavaScriptCore/dfg/DFGAbstractState.cpp b/Source/JavaScriptCore/dfg/DFGAbstractState.cpp
index b1a9e89..c8d0f2b 100644
--- a/Source/JavaScriptCore/dfg/DFGAbstractState.cpp
+++ b/Source/JavaScriptCore/dfg/DFGAbstractState.cpp
@@ -352,7 +352,8 @@
case ArithMul:
case ArithDiv:
case ArithMin:
- case ArithMax: {
+ case ArithMax:
+ case ArithMod: {
if (Node::shouldSpeculateInteger(m_graph[node.child1()], m_graph[node.child2()]) && node.canSpeculateInteger()) {
forNode(node.child1()).filter(PredictInt32);
forNode(node.child2()).filter(PredictInt32);
@@ -365,19 +366,6 @@
break;
}
- case ArithMod: {
- if (m_graph[node.child1()].shouldNotSpeculateInteger() || m_graph[node.child2()].shouldNotSpeculateInteger() || !node.canSpeculateInteger()) {
- forNode(node.child1()).filter(PredictNumber);
- forNode(node.child2()).filter(PredictNumber);
- forNode(nodeIndex).set(PredictDouble);
- break;
- }
- forNode(node.child1()).filter(PredictInt32);
- forNode(node.child2()).filter(PredictInt32);
- forNode(nodeIndex).set(PredictInt32);
- break;
- }
-
case ArithAbs:
if (m_graph[node.child1()].shouldSpeculateInteger() && node.canSpeculateInteger()) {
forNode(node.child1()).filter(PredictInt32);
@@ -555,50 +543,74 @@
if (m_graph[node.child1()].shouldSpeculateByteArray()) {
forNode(node.child1()).filter(PredictByteArray);
forNode(node.child2()).filter(PredictInt32);
- forNode(node.child3()).filter(PredictNumber);
+ if (m_graph[node.child3()].shouldSpeculateInteger())
+ forNode(node.child3()).filter(PredictInt32);
+ else
+ forNode(node.child3()).filter(PredictNumber);
break;
}
if (m_graph[node.child1()].shouldSpeculateInt8Array()) {
forNode(node.child1()).filter(PredictInt8Array);
forNode(node.child2()).filter(PredictInt32);
- forNode(node.child3()).filter(PredictNumber);
+ if (m_graph[node.child3()].shouldSpeculateInteger())
+ forNode(node.child3()).filter(PredictInt32);
+ else
+ forNode(node.child3()).filter(PredictNumber);
break;
}
if (m_graph[node.child1()].shouldSpeculateInt16Array()) {
forNode(node.child1()).filter(PredictInt16Array);
forNode(node.child2()).filter(PredictInt32);
- forNode(node.child3()).filter(PredictNumber);
+ if (m_graph[node.child3()].shouldSpeculateInteger())
+ forNode(node.child3()).filter(PredictInt32);
+ else
+ forNode(node.child3()).filter(PredictNumber);
break;
}
if (m_graph[node.child1()].shouldSpeculateInt32Array()) {
forNode(node.child1()).filter(PredictInt32Array);
forNode(node.child2()).filter(PredictInt32);
- forNode(node.child3()).filter(PredictNumber);
+ if (m_graph[node.child3()].shouldSpeculateInteger())
+ forNode(node.child3()).filter(PredictInt32);
+ else
+ forNode(node.child3()).filter(PredictNumber);
break;
}
if (m_graph[node.child1()].shouldSpeculateUint8Array()) {
forNode(node.child1()).filter(PredictUint8Array);
forNode(node.child2()).filter(PredictInt32);
- forNode(node.child3()).filter(PredictNumber);
+ if (m_graph[node.child3()].shouldSpeculateInteger())
+ forNode(node.child3()).filter(PredictInt32);
+ else
+ forNode(node.child3()).filter(PredictNumber);
break;
}
if (m_graph[node.child1()].shouldSpeculateUint8ClampedArray()) {
forNode(node.child1()).filter(PredictUint8ClampedArray);
forNode(node.child2()).filter(PredictInt32);
- forNode(node.child3()).filter(PredictNumber);
+ if (m_graph[node.child3()].shouldSpeculateInteger())
+ forNode(node.child3()).filter(PredictInt32);
+ else
+ forNode(node.child3()).filter(PredictNumber);
break;
}
if (m_graph[node.child1()].shouldSpeculateUint16Array()) {
forNode(node.child1()).filter(PredictUint16Array);
forNode(node.child2()).filter(PredictInt32);
- forNode(node.child3()).filter(PredictNumber);
+ if (m_graph[node.child3()].shouldSpeculateInteger())
+ forNode(node.child3()).filter(PredictInt32);
+ else
+ forNode(node.child3()).filter(PredictNumber);
break;
}
if (m_graph[node.child1()].shouldSpeculateUint32Array()) {
forNode(node.child1()).filter(PredictUint32Array);
forNode(node.child2()).filter(PredictInt32);
- forNode(node.child3()).filter(PredictNumber);
+ if (m_graph[node.child3()].shouldSpeculateInteger())
+ forNode(node.child3()).filter(PredictInt32);
+ else
+ forNode(node.child3()).filter(PredictNumber);
break;
}
if (m_graph[node.child1()].shouldSpeculateFloat32Array()) {
diff --git a/Source/JavaScriptCore/dfg/DFGNode.h b/Source/JavaScriptCore/dfg/DFGNode.h
index e61fee4a7..8601721 100644
--- a/Source/JavaScriptCore/dfg/DFGNode.h
+++ b/Source/JavaScriptCore/dfg/DFGNode.h
@@ -679,11 +679,6 @@
return isNumberPrediction(prediction());
}
- bool shouldNotSpeculateInteger()
- {
- return !!(prediction() & PredictDouble);
- }
-
bool shouldSpeculateBoolean()
{
return isBooleanPrediction(prediction());
diff --git a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp
index f6cbf1d..fa70f5c 100644
--- a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp
+++ b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp
@@ -1749,7 +1749,7 @@
m_jit.move(Imm32(clampedValue), scratchReg);
value.adopt(scratch);
valueGPR = scratchReg;
- } else if (!at(valueUse).shouldNotSpeculateInteger()) {
+ } else if (at(valueUse).shouldSpeculateInteger()) {
SpeculateIntegerOperand valueOp(this, valueUse);
GPRTemporary scratch(this);
GPRReg scratchReg = scratch.gpr();
@@ -1912,7 +1912,7 @@
m_jit.move(Imm32(static_cast<int>(d)), scratchReg);
value.adopt(scratch);
valueGPR = scratchReg;
- } else if (!at(valueUse).shouldNotSpeculateInteger()) {
+ } else if (at(valueUse).shouldSpeculateInteger()) {
SpeculateIntegerOperand valueOp(this, valueUse);
GPRTemporary scratch(this);
GPRReg scratchReg = scratch.gpr();