Index: test/mjsunit/regress/regress-smi-math-floor-round.js |
diff --git a/test/mjsunit/regress/regress-int32-truncation.js b/test/mjsunit/regress/regress-smi-math-floor-round.js |
similarity index 72% |
copy from test/mjsunit/regress/regress-int32-truncation.js |
copy to test/mjsunit/regress/regress-smi-math-floor-round.js |
index dec4ac1195a6c4928d84eac8cc8dc9496bf66600..7c033a3bd05b7561d9cdff8e24be8358d648341d 100644 |
--- a/test/mjsunit/regress/regress-int32-truncation.js |
+++ b/test/mjsunit/regress/regress-smi-math-floor-round.js |
@@ -27,35 +27,41 @@ |
// Flags: --allow-natives-syntax |
-function f(i, b) { |
- var a = 0; |
- if (b) { |
- var c = 1 << i; |
- a = c + c; |
- } |
- var x = a >> 3; |
- return a; |
+ |
+function f(o) { |
+ return Math.floor(o.x_smi) + 1; |
} |
-f(1, false); |
-f(1, true); |
+assertEquals(2, f({x_smi:1})); |
+assertEquals(2, f({x_smi:1})); |
%OptimizeFunctionOnNextCall(f); |
-assertEquals((1 << 30) * 2, f(30, true)); |
+assertEquals(2, f({x_smi:1})); |
+function f2(o) { |
+ return Math.floor(o.x_tagged) + 1; |
+} |
-var global = 1; |
+var o = {x_tagged:{}}; |
+o.x_tagged = 1.4; |
+assertEquals(2, f2(o)); |
+assertEquals(2, f2(o)); |
+%OptimizeFunctionOnNextCall(f2); |
+assertEquals(2, f2(o)); |
-function f2(b) { |
- var a = 0; |
- if (b) { |
- a = global; |
- } |
- var x = a >> 3; |
- return a; |
+function f3(o) { |
+ return Math.round(o.x_smi) + 1; |
} |
-f2(false); |
-f2(true); |
-%OptimizeFunctionOnNextCall(f2); |
-global = 2.5; |
-assertEquals(global, f2(true)); |
+assertEquals(2, f3({x_smi:1})); |
+assertEquals(2, f3({x_smi:1})); |
+%OptimizeFunctionOnNextCall(f3); |
+assertEquals(2, f3({x_smi:1})); |
+ |
+function f4(o) { |
+ return Math.round(o.x_tagged) + 1; |
+} |
+ |
+assertEquals(2, f4(o)); |
+assertEquals(2, f4(o)); |
+%OptimizeFunctionOnNextCall(f4); |
+assertEquals(2, f4(o)); |