Diff
Modified: branches/safari-600.3-branch/LayoutTests/ChangeLog (177390 => 177391)
--- branches/safari-600.3-branch/LayoutTests/ChangeLog 2014-12-16 21:22:13 UTC (rev 177390)
+++ branches/safari-600.3-branch/LayoutTests/ChangeLog 2014-12-16 21:24:24 UTC (rev 177391)
@@ -1,3 +1,21 @@
+2014-12-16 Matthew Hanson <[email protected]>
+
+ Merge r176399. rdar://problem/19267545
+
+ 2014-11-20 Mark Lam <[email protected]>
+
+ WTFCrashWithSecurityImplication under SpeculativeJIT::compile() when loading a page from theblaze.com.
+ <https://webkit.org/b/137642>
+
+ Reviewed by Filip Pizlo.
+
+ * js/dfg-inline-identity-expected.txt: Added.
+ * js/dfg-inline-identity.html: Added.
+ * js/script-tests/dfg-inline-identity.js: Added.
+ (o.toKey):
+ (foo):
+ (test):
+
2014-12-10 Matthew Hanson <[email protected]>
Merge r176972. <rdar://problem/19196762>
Added: branches/safari-600.3-branch/LayoutTests/js/dfg-inline-identity-expected.txt (0 => 177391)
--- branches/safari-600.3-branch/LayoutTests/js/dfg-inline-identity-expected.txt (rev 0)
+++ branches/safari-600.3-branch/LayoutTests/js/dfg-inline-identity-expected.txt 2014-12-16 21:24:24 UTC (rev 177391)
@@ -0,0 +1,9 @@
+This tests that an identity node in the inlined function does not crash the DFG's code generator.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: branches/safari-600.3-branch/LayoutTests/js/dfg-inline-identity.html (0 => 177391)
--- branches/safari-600.3-branch/LayoutTests/js/dfg-inline-identity.html (rev 0)
+++ branches/safari-600.3-branch/LayoutTests/js/dfg-inline-identity.html 2014-12-16 21:24:24 UTC (rev 177391)
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script src=""
+<script src=""
+</body>
+</html>
Added: branches/safari-600.3-branch/LayoutTests/js/script-tests/dfg-inline-identity.js (0 => 177391)
--- branches/safari-600.3-branch/LayoutTests/js/script-tests/dfg-inline-identity.js (rev 0)
+++ branches/safari-600.3-branch/LayoutTests/js/script-tests/dfg-inline-identity.js 2014-12-16 21:24:24 UTC (rev 177391)
@@ -0,0 +1,35 @@
+description(
+"This tests that an identity node in the inlined function does not crash the DFG's code generator."
+);
+
+var o = {
+ x1: 0,
+ x2: 0,
+ x3: 0,
+ toKey: function() {
+ return this.x1 + "," + this.x2 + "," + this.x3;
+ },
+};
+
+var a = [];
+
+var x1Adjust = 1.3;
+var x2Adjust = 2.7;
+var x3Adjust = 1.2;
+
+function foo(i) {
+ o.x1 += x1Adjust;
+ o.x2 += x2Adjust;
+ o.x3 += x3Adjust;
+
+ a[i] = o.toKey();
+}
+
+function test() {
+ for (var i = 0; i < 1000; i++)
+ foo(i);
+}
+
+test();
+
+var successfullyParsed = true;
Modified: branches/safari-600.3-branch/Source/_javascript_Core/ChangeLog (177390 => 177391)
--- branches/safari-600.3-branch/Source/_javascript_Core/ChangeLog 2014-12-16 21:22:13 UTC (rev 177390)
+++ branches/safari-600.3-branch/Source/_javascript_Core/ChangeLog 2014-12-16 21:24:24 UTC (rev 177391)
@@ -1,3 +1,32 @@
+2014-12-16 Matthew Hanson <[email protected]>
+
+ Merge r176399. rdar://problem/19267545
+
+ 2014-11-19 Mark Lam <[email protected]>
+
+ WTFCrashWithSecurityImplication under SpeculativeJIT::compile() when loading a page from theblaze.com.
+ <https://webkit.org/b/137642>
+
+ Reviewed by Filip Pizlo.
+
+ In the DFG, we have a ConstantFolding phase that occurs after all LocalCSE
+ phases have already transpired. Hence, Identity nodes introduced in the
+ ConstantFolding phase will be left in the node graph. Subsequently, the
+ DFG code generator asserts that CSE phases have consumed all Identity nodes.
+ This turns out to not be true. Hence, the crash. We fix this by teaching
+ the DFG code generator to emit code for Identity nodes.
+
+ Unlike the DFG, the FTL does not have this issue. That is because the FTL
+ plan has GlobalCSE phases that come after ConstantFolding and any other
+ phases that can generate Identity nodes. Hence, for the FTL, it is true that
+ CSE will consume all Identity nodes, and the code generator should not see any
+ Identity nodes.
+
+ * dfg/DFGSpeculativeJIT32_64.cpp:
+ (JSC::DFG::SpeculativeJIT::compile):
+ * dfg/DFGSpeculativeJIT64.cpp:
+ (JSC::DFG::SpeculativeJIT::compile):
+
2014-12-10 Matthew Hanson <[email protected]>
Merge r176972. <rdar://problem/19196762>
Modified: branches/safari-600.3-branch/Source/_javascript_Core/dfg/DFGSpeculativeJIT32_64.cpp (177390 => 177391)
--- branches/safari-600.3-branch/Source/_javascript_Core/dfg/DFGSpeculativeJIT32_64.cpp 2014-12-16 21:22:13 UTC (rev 177390)
+++ branches/safari-600.3-branch/Source/_javascript_Core/dfg/DFGSpeculativeJIT32_64.cpp 2014-12-16 21:24:24 UTC (rev 177391)
@@ -1688,7 +1688,26 @@
break;
case Identity: {
- RELEASE_ASSERT_NOT_REACHED();
+ speculate(node, node->child1());
+ switch (node->child1().useKind()) {
+ case DoubleRepUse:
+ case DoubleRepRealUse: {
+ SpeculateDoubleOperand op(this, node->child1());
+ doubleResult(op.fpr(), node);
+ break;
+ }
+ case Int52RepUse:
+ case MachineIntUse:
+ case DoubleRepMachineIntUse: {
+ RELEASE_ASSERT_NOT_REACHED();
+ break;
+ }
+ default: {
+ JSValueOperand op(this, node->child1());
+ jsValueResult(op.tagGPR(), op.payloadGPR(), node);
+ break;
+ }
+ } // switch
break;
}
Modified: branches/safari-600.3-branch/Source/_javascript_Core/dfg/DFGSpeculativeJIT64.cpp (177390 => 177391)
--- branches/safari-600.3-branch/Source/_javascript_Core/dfg/DFGSpeculativeJIT64.cpp 2014-12-16 21:22:13 UTC (rev 177390)
+++ branches/safari-600.3-branch/Source/_javascript_Core/dfg/DFGSpeculativeJIT64.cpp 2014-12-16 21:24:24 UTC (rev 177391)
@@ -1803,6 +1803,26 @@
case Identity: {
// CSE should always eliminate this.
RELEASE_ASSERT_NOT_REACHED();
+ speculate(node, node->child1());
+ switch (node->child1().useKind()) {
+ case DoubleRepUse:
+ case DoubleRepRealUse:
+ case DoubleRepMachineIntUse: {
+ SpeculateDoubleOperand op(this, node->child1());
+ doubleResult(op.fpr(), node);
+ break;
+ }
+ case Int52RepUse: {
+ SpeculateInt52Operand op(this, node->child1());
+ int52Result(op.gpr(), node);
+ break;
+ }
+ default: {
+ JSValueOperand op(this, node->child1());
+ jsValueResult(op.gpr(), node);
+ break;
+ }
+ } // switch
break;
}