Index: test/mjsunit/regress/regress-137768.js |
diff --git a/test/mjsunit/compiler/optimized-closures.js b/test/mjsunit/regress/regress-137768.js |
similarity index 64% |
copy from test/mjsunit/compiler/optimized-closures.js |
copy to test/mjsunit/regress/regress-137768.js |
index eaf75f8d00ccd9123ed0f5232a91137845fc3973..10417f1f2213717bc3fcf1a68a75ecc0d466c5a5 100644 |
--- a/test/mjsunit/compiler/optimized-closures.js |
+++ b/test/mjsunit/regress/regress-137768.js |
@@ -27,31 +27,37 @@ |
// 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) { |
+ var s = 0; |
+ for (var i = 0; i < 1; ++i) { |
+ o.newFileToChangeMap = undefined; |
+ var x = a[0]; |
+ s += Math.floor(a); |
Jakob Kummerow
2012/07/20 08:45:18
Did you mean floor(x)? Either way, this test works
|
} |
+ return s; |
} |
-f(); |
-assertEquals(42, a[0]); |
-assertEquals(49, a[7]); |
-assertEquals(-19, a[23]); |
- |
- |
- |
- |
+o = new Object(); |
+a = [1, 2, 3]; |
+bad_func(o, a); |
+ |
+// Make sure that we're out of pre-monomorphic state for the member add of |
+// 'newFileToChangeMap' which causes a map transition. |
+o = new Object(); |
+a = [1, 2, 3]; |
+bad_func(o, a); |
+ |
+// Optimize, bofre the fix, the element load and subsequent tagged-to-i were |
Jakob Kummerow
2012/07/20 08:45:18
nit: messed up comment ("bofre", incomplete senten
|
+// hoisted above the map check, which can't be hoisted due map-changing store |
+// that adds |
+o = new Object(); |
+a = [1, 2, 3]; |
+%OptimizeFunctionOnNextCall(bad_func); |
+bad_func(o, a); |
+ |
+// Pass in a array of doubles. Before the fix, the optimized load and |
+// tagged-to-i will treat part of a double value as a pointer and de-ref the |
Jakob Kummerow
2012/07/20 08:45:18
nit: slightly messed up comment. s/de-ref the/de-r
|
+// before the map check was executed that should have deopt. |
+o = new Object(); |
+a = [1.5, 2.5, 3.5]; |
+bad_func(o, a); |