| Index: test/mjsunit/regress/regress-crbug-134055.js
|
| diff --git a/test/mjsunit/compiler/optimized-closures.js b/test/mjsunit/regress/regress-crbug-134055.js
|
| similarity index 72%
|
| copy from test/mjsunit/compiler/optimized-closures.js
|
| copy to test/mjsunit/regress/regress-crbug-134055.js
|
| index eaf75f8d00ccd9123ed0f5232a91137845fc3973..9b658fb6f650f04520001f61f8e34d0202c5fb7d 100644
|
| --- a/test/mjsunit/compiler/optimized-closures.js
|
| +++ b/test/mjsunit/regress/regress-crbug-134055.js
|
| @@ -27,31 +27,37 @@
|
|
|
| // Flags: --allow-natives-syntax
|
|
|
| -// Test optimized closures.
|
| -
|
| -var a = new Array(100);
|
| +function crash(obj) {
|
| + return obj.foo;
|
| +}
|
|
|
| -function f() {
|
| - var x=0;
|
| - for (var i=0; i<100; i++) {
|
| - var g = function goo(y) {
|
| - function h() {
|
| - if (goo.arguments[0] == 23) return -42;
|
| - return 42;
|
| - }
|
| - return x + y + h(y);
|
| - }
|
| - g(0);
|
| - %OptimizeFunctionOnNextCall(g);
|
| - a[i] = g(i);
|
| +function base(number_of_properties) {
|
| + var result = new Array();
|
| + for (var i = 0; i < number_of_properties; i++) {
|
| + result["property" + i] = "value" + i;
|
| }
|
| + result.foo = number_of_properties;
|
| + return result;
|
| }
|
|
|
| -f();
|
| -assertEquals(42, a[0]);
|
| -assertEquals(49, a[7]);
|
| -assertEquals(-19, a[23]);
|
| -
|
| -
|
| -
|
| -
|
| +var a = base(12);
|
| +var b = base(13);
|
| +var c = base(14);
|
| +var d = base(15);
|
| +
|
| +crash(a); // Premonomorphic.
|
| +crash(a);
|
| +crash(b);
|
| +crash(c);
|
| +crash(d); // Polymorphic, degree 4.
|
| +
|
| +//Prepare ElementsKind transition map chain.
|
| +var x = base(13);
|
| +x[0] = "object";
|
| +x = base(14);
|
| +x[0] = "object";
|
| +x = base(15);
|
| +x[0] = "object";
|
| +
|
| +%OptimizeFunctionOnNextCall(crash);
|
| +crash(a);
|
|
|