Index: test/mjsunit/compiler/regress-5320.js |
diff --git a/test/mjsunit/compiler/deopt-materialize-accumulator.js b/test/mjsunit/compiler/regress-5320.js |
similarity index 70% |
copy from test/mjsunit/compiler/deopt-materialize-accumulator.js |
copy to test/mjsunit/compiler/regress-5320.js |
index 0b19df8a1cf03fef0e94a92d7408d2a7dece0796..2e30a7b4f57aee8813f1d484ff491607093f222a 100644 |
--- a/test/mjsunit/compiler/deopt-materialize-accumulator.js |
+++ b/test/mjsunit/compiler/regress-5320.js |
@@ -26,16 +26,27 @@ |
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
// Flags: --allow-natives-syntax |
-// |
-// Tests that Turbofan correctly materializes values which are in the |
-// interpreters accumulator during deopt. |
-var global = 3; |
-function f(a) { |
- // This will trigger a deopt since global was previously a SMI, with the |
- // accumulator holding an unboxed double which needs materialized. |
- global = Math.sqrt(a); |
+function OptimizeTruncatingBinaryOp(func) { |
+ func(42, -2); |
+ func(31, undefined); |
+ %BaselineFunctionOnNextCall(func); |
+ func(42, -2); |
+ func(31, undefined); |
+ %OptimizeFunctionOnNextCall(func); |
+ func(-1, 2.1); |
+ assertOptimized(func); |
} |
-%OptimizeFunctionOnNextCall(f); |
-f(0.25); |
-assertEquals(0.5, global); |
+ |
+// SAR |
+OptimizeTruncatingBinaryOp(function(a, b) { return a >> b; }); |
+// SHR |
+OptimizeTruncatingBinaryOp(function(a, b) { return a >>> b; }); |
+// SHL |
+OptimizeTruncatingBinaryOp(function(a, b) { return a << b; }); |
+// BIT_AND |
+OptimizeTruncatingBinaryOp(function(a, b) { return a & b; }); |
+// BIT_OR |
+OptimizeTruncatingBinaryOp(function(a, b) { return a | b; }); |
+// BIT_XOR |
+OptimizeTruncatingBinaryOp(function(a, b) { return a ^ b; }); |