Index: test/mjsunit/regress/regress-int32-truncation.js |
diff --git a/test/mjsunit/regress/regress-2489.js b/test/mjsunit/regress/regress-int32-truncation.js |
similarity index 81% |
copy from test/mjsunit/regress/regress-2489.js |
copy to test/mjsunit/regress/regress-int32-truncation.js |
index 882c4f794a88e24d1d64e86a466b27c39f51e625..dec4ac1195a6c4928d84eac8cc8dc9496bf66600 100644 |
--- a/test/mjsunit/regress/regress-2489.js |
+++ b/test/mjsunit/regress/regress-int32-truncation.js |
@@ -27,24 +27,35 @@ |
// Flags: --allow-natives-syntax |
-"use strict"; |
- |
-function f(a, b) { |
- return g("c", "d"); |
+function f(i, b) { |
+ var a = 0; |
+ if (b) { |
+ var c = 1 << i; |
+ a = c + c; |
+ } |
+ var x = a >> 3; |
+ return a; |
} |
-function g(a, b) { |
- g.constructor.apply(this, arguments); |
-} |
+f(1, false); |
+f(1, true); |
+%OptimizeFunctionOnNextCall(f); |
+assertEquals((1 << 30) * 2, f(30, true)); |
-g.constructor = function(a, b) { |
- assertEquals("c", a); |
- assertEquals("d", b); |
+ |
+var global = 1; |
+ |
+function f2(b) { |
+ var a = 0; |
+ if (b) { |
+ a = global; |
+ } |
+ var x = a >> 3; |
+ return a; |
} |
-f("a", "b"); |
-f("a", "b"); |
-%OptimizeFunctionOnNextCall(f); |
-f("a", "b"); |
-g.x = "deopt"; |
-f("a", "b"); |
+f2(false); |
+f2(true); |
+%OptimizeFunctionOnNextCall(f2); |
+global = 2.5; |
+assertEquals(global, f2(true)); |