Index: test/mjsunit/compiler/multiply-sub.js |
diff --git a/test/mjsunit/compiler/regress-const.js b/test/mjsunit/compiler/multiply-sub.js |
similarity index 72% |
copy from test/mjsunit/compiler/regress-const.js |
copy to test/mjsunit/compiler/multiply-sub.js |
index aa55d0fd3ae17051a084a6bf28c2257f2abc8495..4793181d47a2b4a2b2390f5049758e651ef1ec1c 100644 |
--- a/test/mjsunit/compiler/regress-const.js |
+++ b/test/mjsunit/compiler/multiply-sub.js |
@@ -1,4 +1,4 @@ |
-// Copyright 2011 the V8 project authors. All rights reserved. |
+// Copyright 2013 the V8 project authors. All rights reserved. |
// Redistribution and use in source and binary forms, with or without |
// modification, are permitted provided that the following conditions are |
// met: |
@@ -26,43 +26,31 @@ |
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
// Flags: --allow-natives-syntax |
+// Test expressions that can be computed with a multiply-add instruction. |
-// Test const initialization and assignments. |
-function f() { |
- var x = 42; |
- while (true) { |
- const y = x; |
- if (--x == 0) return y; |
- } |
+function f(a, b, c) { |
+ return a - b * c; |
} |
-function g() { |
- const x = 42; |
- x += 1; |
- return x; |
+function g(a, b, c) { |
+ return a * b - c; |
} |
-for (var i = 0; i < 5; i++) { |
- f(); |
- g(); |
+function h(a, b, c, d) { |
+ return a * b - c * d; |
} |
+assertEquals(-5.41, f(1.1, 2.1, 3.1)); |
+assertEquals(-5.41, f(1.1, 2.1, 3.1)); |
%OptimizeFunctionOnNextCall(f); |
-%OptimizeFunctionOnNextCall(g); |
- |
-assertEquals(42, f()); |
-assertEquals(42, g()); |
+assertEquals(-5.41, f(1.1, 2.1, 3.1)); |
+assertEquals(8.36, g(2.2, 3.3, -1.1)); |
+assertEquals(8.36, g(2.2, 3.3, -1.1)); |
+%OptimizeFunctionOnNextCall(g); |
+assertEquals(8.36, g(2.2, 3.3, -1.1)); |
-function h(a, b) { |
- var r = a + b; |
- const X = 42; |
- return r + X; |
-} |
- |
-for (var i = 0; i < 5; i++) h(1,2); |
- |
+assertEquals(-1.5, h(1.5, 3.0, 12, 0.5)); |
+assertEquals(-1.5, h(1.5, 3.0, 12, 0.5)); |
%OptimizeFunctionOnNextCall(h); |
- |
-assertEquals(45, h(1,2)); |
-assertEquals("foo742", h("foo", 7)); |
+assertEquals(-1.5, h(1.5, 3.0, 12, 0.5)); |