Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(475)

Unified Diff: test/mjsunit/regress/regress-2250.js

Issue 10867033: Disable speculative LICM when it may lead to unnecessary deopts (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: feedback addressed Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects-inl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/regress/regress-2250.js
diff --git a/test/mjsunit/regress/regress-2110.js b/test/mjsunit/regress/regress-2250.js
similarity index 62%
copy from test/mjsunit/regress/regress-2110.js
copy to test/mjsunit/regress/regress-2250.js
index d7f78d26a7b4d16c4217d2b0ac136e52e4542eb1..b3b0db3fc386fdd469f580f57dcc77bd40a5f930 100644
--- a/test/mjsunit/regress/regress-2110.js
+++ b/test/mjsunit/regress/regress-2250.js
@@ -27,27 +27,42 @@
// Flags: --allow-natives-syntax
-var uint8 = new Uint8Array(1);
+// The original problem from the bug: In the example below SMI check for b
+// generated for inlining of equals invocation (marked with (*)) will be hoisted
+// out of the loop across the typeof b === "object" condition and cause an
+// immediate deopt. Another problem here is that no matter how many time we
+// deopt and reopt we will continue to produce the wrong code.
+//
+// The fix is to notice when a deopt and subsequent reopt doesn't find
+// additional type information, indicating that optimistic LICM should be
+// disabled during compilation.
+
+function eq(a, b) {
+ if (typeof b === "object") {
+ return b.equals(a); // (*)
+ }
+ return a === b;
+}
+
+Object.prototype.equals = function (other) {
+ return (this === other);
+};
function test() {
- uint8[0] = 0x800000aa;
- assertEquals(0xaa, uint8[0]);
+ for (var i = 0; !eq(i, 10); i++)
+ ;
}
+eq({}, {});
+eq({}, {});
+eq(1, 1);
+eq(1, 1);
test();
-test();
+%OptimizeFunctionOnNextCall(test);
test();
%OptimizeFunctionOnNextCall(test);
+// Second compilation should have noticed that LICM wasn't a good idea, and now
+// function should no longer deopt when called.
test();
+assertTrue(2 != %GetOptimizationStatus(test));
-var uint32 = new Uint32Array(1);
-
-function test2() {
- uint32[0] = 0x80123456789abcde;
- assertEquals(0x789ac000, uint32[0]);
-}
-
-test2();
-test2();
-%OptimizeFunctionOnNextCall(test2);
-test2();
« no previous file with comments | « src/objects-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698