Index: test/mjsunit/regress/regress-crbug-196583.js |
diff --git a/test/mjsunit/regress/regress-2539.js b/test/mjsunit/regress/regress-crbug-196583.js |
similarity index 79% |
copy from test/mjsunit/regress/regress-2539.js |
copy to test/mjsunit/regress/regress-crbug-196583.js |
index 5d263f8912bb7f44083d159cfead81ba33a3a3b4..c486158e22e92d2f73fe3473d822a8f6136aed4b 100644 |
--- a/test/mjsunit/regress/regress-2539.js |
+++ b/test/mjsunit/regress/regress-crbug-196583.js |
@@ -27,29 +27,26 @@ |
// Flags: --allow-natives-syntax |
-"use strict"; |
-var dispatcher = {}; |
-dispatcher.func = C; |
+var a = 1; |
+a.__proto__.f = 1; |
+a.__proto__.f = function() { return 1; } |
-function A() { |
- B(10, 11); |
-} |
+// Create some polymorphism. |
+function B() {} |
+B.prototype = {f: function() { return 2; }}; |
+var b = new B(); |
+function C() {} |
+C.prototype = {g: "foo", f: function() { return 3; }}; |
+var c = new C(); |
-function B(x,y) { |
- x = 0; y = 0; |
- dispatcher.func.apply(this, arguments); |
- assertSame(2, arguments.length); |
- assertSame(10, arguments[0]); |
- assertSame(11, arguments[1]); |
+function crash(obj) { |
+ return obj.f(); |
} |
-function C(x,y) { |
- assertSame(2, arguments.length); |
- assertSame(10, arguments[0]); |
- assertSame(11, arguments[1]); |
+for (var i = 0; i < 2; i++) { |
+ crash(a); |
+ crash(b); |
+ crash(c); |
} |
- |
-A(); |
-A(); |
-%OptimizeFunctionOnNextCall(A); |
-A(); |
+%OptimizeFunctionOnNextCall(crash); |
+assertEquals(1, crash(a)); |