| Index: test/mjsunit/regress/regress-load-elements.js
|
| diff --git a/test/mjsunit/compiler/optimized-closures.js b/test/mjsunit/regress/regress-load-elements.js
|
| similarity index 79%
|
| copy from test/mjsunit/compiler/optimized-closures.js
|
| copy to test/mjsunit/regress/regress-load-elements.js
|
| index eaf75f8d00ccd9123ed0f5232a91137845fc3973..68cdc8e8a1544f242b0881687cb024b7abc393bb 100644
|
| --- a/test/mjsunit/compiler/optimized-closures.js
|
| +++ b/test/mjsunit/regress/regress-load-elements.js
|
| @@ -27,31 +27,23 @@
|
|
|
| // Flags: --allow-natives-syntax
|
|
|
| -// Test optimized closures.
|
| -
|
| -var a = new Array(100);
|
| -
|
| -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 bad_func(o,a) {
|
| + for (var i = 0; i < 1; ++i) {
|
| + o.prop = 0;
|
| + var x = a[0];
|
| }
|
| }
|
|
|
| -f();
|
| -assertEquals(42, a[0]);
|
| -assertEquals(49, a[7]);
|
| -assertEquals(-19, a[23]);
|
| -
|
| -
|
| +o = new Object();
|
| +a = {};
|
| +a[0] = 1;
|
| +bad_func(o, a);
|
|
|
| +o = new Object();
|
| +bad_func(o, a);
|
|
|
| +// Optimize. Before the fix, the elements-load and subsequent fixed-array-length
|
| +// were hoisted above the map check. This is invalid since not all types
|
| +// necessarily have elements.
|
| +%OptimizeFunctionOnNextCall(bad_func);
|
| +bad_func(o, "");
|
|
|