Index: test/mjsunit/constant-branch-folding-liveness.js |
diff --git a/test/mjsunit/regress/regress-2813.js b/test/mjsunit/constant-branch-folding-liveness.js |
similarity index 81% |
copy from test/mjsunit/regress/regress-2813.js |
copy to test/mjsunit/constant-branch-folding-liveness.js |
index 97ae43b316a2177596927cf5465fa2214cc11c61..ca3fdc774606bfa56669b8a3b289af9845176ff3 100644 |
--- a/test/mjsunit/regress/regress-2813.js |
+++ b/test/mjsunit/constant-branch-folding-liveness.js |
@@ -27,18 +27,21 @@ |
// Flags: --allow-natives-syntax |
-function foo(x) { |
+function funky() { return false; } |
+var global; |
+ |
+function foo(x, fun) { |
var a = x + 1; |
- var b = x + 2; |
- if (x != 0) { |
- if (x > 0 & x < 100) { |
- return a; |
- } |
+ var b = x + 2; // Need another Simulate to fold the first one into. |
+ global = true; // Need a side effect to deopt to. |
+ if (fun()) { |
+ return a; |
} |
return 0; |
} |
-assertEquals(0, foo(0)); |
-assertEquals(0, foo(0)); |
+assertEquals(0, foo(1, funky)); |
+assertEquals(0, foo(1, funky)); |
%OptimizeFunctionOnNextCall(foo); |
-assertEquals(3, foo(2)); |
+assertEquals(0, foo(1, funky)); |
+assertEquals(2, foo(1, function() { return true; })); |