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

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

Issue 1863123002: [crankshaft] Make infinite loop preserve control flow. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 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/crankshaft/hydrogen.cc ('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-599710.js
diff --git a/test/mjsunit/regress/regress-599710.js b/test/mjsunit/regress/regress-599710.js
new file mode 100644
index 0000000000000000000000000000000000000000..dd1ba8d969b5f28b8239aeb65e183511120fcd98
--- /dev/null
+++ b/test/mjsunit/regress/regress-599710.js
@@ -0,0 +1,49 @@
+// Copyright 2016 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax
+
+var f1 = function() { while (1) { } }
+
+function g1() {
+ var s = "hey";
+ f1 = function() { return true; }
+ if (f1()) { return s; }
+}
+
+%OptimizeFunctionOnNextCall(g1);
+assertEquals("hey", g1());
+
+var f2 = function() { do { } while (1); }
+
+function g2() {
+ var s = "hey";
+ f2 = function() { return true; }
+ if (f2()) { return s; }
+}
+
+%OptimizeFunctionOnNextCall(g2);
+assertEquals("hey", g2());
+
+var f3 = function() { for (;;); }
+
+function g3() {
+ var s = "hey";
+ f3 = function() { return true; }
+ if (f3()) { return s; }
+}
+
+%OptimizeFunctionOnNextCall(g3);
+assertEquals("hey", g3());
+
+var f4 = function() { for (;;); }
+
+function g4() {
+ var s = "hey";
+ f4 = function() { return true; }
+ while (f4()) { return s; }
+}
+
+%OptimizeFunctionOnNextCall(g4);
+assertEquals("hey", g4());
« no previous file with comments | « src/crankshaft/hydrogen.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698