Index: test/mjsunit/regress/regress-deopt-store-effect.js |
diff --git a/test/mjsunit/compiler/multiply-sub.js b/test/mjsunit/regress/regress-deopt-store-effect.js |
similarity index 64% |
copy from test/mjsunit/compiler/multiply-sub.js |
copy to test/mjsunit/regress/regress-deopt-store-effect.js |
index 4793181d47a2b4a2b2390f5049758e651ef1ec1c..59094d3aeb78f699abc54b422d869f4c9a509aeb 100644 |
--- a/test/mjsunit/compiler/multiply-sub.js |
+++ b/test/mjsunit/regress/regress-deopt-store-effect.js |
@@ -26,31 +26,57 @@ |
// 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. |
-function f(a, b, c) { |
- return a - b * c; |
-} |
+// Test deopt after generic store with effect context. |
+var pro = { x : 1 } |
+var a = {} |
+a.__proto__ = pro |
+delete pro.x |
-function g(a, b, c) { |
- return a * b - c; |
+function g(o) { |
+ return 7 + (o.z = 1, 20); |
} |
-function h(a, b, c, d) { |
- return a * b - c * d; |
+g(a); |
+g(a); |
+%OptimizeFunctionOnNextCall(g); |
+Object.defineProperty(pro, "z", { |
+ set: function(v) { %DeoptimizeFunction(g); }, |
+ get: function() { return 20; } |
+}); |
+ |
+assertEquals(27, g(a)); |
+ |
+// Test deopt after polymorphic as monomorphic store with effect context. |
+ |
+var i = { z : 2, r : 1 } |
+var j = { z : 2 } |
+var p = { a : 10 } |
+var pp = { a : 20, b : 1 } |
+ |
+function bar(o, p) { |
+ return 7 + (o.z = 1, p.a); |
} |
-assertEquals(-5.41, f(1.1, 2.1, 3.1)); |
-assertEquals(-5.41, f(1.1, 2.1, 3.1)); |
-%OptimizeFunctionOnNextCall(f); |
-assertEquals(-5.41, f(1.1, 2.1, 3.1)); |
+bar(i, p); |
+bar(i, p); |
+bar(j, p); |
+%OptimizeFunctionOnNextCall(bar); |
+assertEquals(27, bar(i, pp)); |
-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)); |
+// Test deopt after polymorphic store with effect context. |
+ |
+var i = { r : 1, z : 2 } |
+var j = { z : 2 } |
+var p = { a : 10 } |
+var pp = { a : 20, b : 1 } |
+ |
+function bar1(o, p) { |
+ return 7 + (o.z = 1, p.a); |
+} |
-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(-1.5, h(1.5, 3.0, 12, 0.5)); |
+bar1(i, p); |
+bar1(i, p); |
+bar1(j, p); |
+%OptimizeFunctionOnNextCall(bar1); |
+assertEquals(27, bar1(i, pp)); |