Index: test/mjsunit/regress/regress-convert-hole.js |
diff --git a/test/mjsunit/regress/regress-convert-hole.js b/test/mjsunit/regress/regress-convert-hole.js |
index 14242219262e5aaa5f9591ecc7a36d3bfbdae451..3316f307d9fb7493ed8686cc1b0c60088e6bb726 100644 |
--- a/test/mjsunit/regress/regress-convert-hole.js |
+++ b/test/mjsunit/regress/regress-convert-hole.js |
@@ -27,7 +27,7 @@ |
// Flags: --allow-natives-syntax |
-function f(test, test2, a, i) { |
+function f_store(test, test2, a, i) { |
var o = [0.5,1,,3]; |
var d; |
if (test) { |
@@ -42,11 +42,67 @@ function f(test, test2, a, i) { |
return d; |
} |
-var a = [0, 0, 0, {}]; |
-f(true, false, a, 0); |
-f(true, true, a, 0); |
-f(false, false, a, 1); |
-f(false, true, a, 1); |
-%OptimizeFunctionOnNextCall(f); |
-f(false, false, a, 2); |
-assertEquals(undefined, a[2]); |
+var a1 = [0, 0, 0, {}]; |
+f_store(true, false, a1, 0); |
+f_store(true, true, a1, 0); |
+f_store(false, false, a1, 1); |
+f_store(false, true, a1, 1); |
+%OptimizeFunctionOnNextCall(f_store); |
+f_store(false, false, a1, 2); |
+assertEquals(undefined, a1[2]); |
+ |
+function test_arg(expected) { |
+ return function(v) { |
+ assertEquals(expected, v); |
+ } |
+} |
+ |
+function f_call(f, test, test2, i) { |
+ var o = [0.5,1,,3]; |
+ var d; |
+ if (test) { |
+ d = 1.5; |
+ } else { |
+ d = o[i]; |
+ } |
+ if (test2) { |
+ d += 1; |
+ } |
+ f(d); |
+ return d; |
+} |
+ |
+f_call(test_arg(1.5), true, false, 0); |
+f_call(test_arg(2.5), true, true, 0); |
+f_call(test_arg(1), false, false, 1); |
+f_call(test_arg(2), false, true, 1); |
+%OptimizeFunctionOnNextCall(f_call); |
+f_call(test_arg(undefined), false, false, 2); |
+ |
+ |
+function f_external(test, test2, test3, a, i) { |
+ var o = [0.5,1,,3]; |
+ var d; |
+ if (test) { |
+ d = 1.5; |
+ } else { |
+ d = o[i]; |
+ } |
+ if (test2) { |
+ d += 1; |
+ } |
+ if (test3) { |
+ d = d|0; |
+ } |
+ a[d] = 1; |
+ return d; |
+} |
+ |
+var a2 = new Int32Array(10); |
+f_external(true, false, true, a2, 0); |
+f_external(true, true, true, a2, 0); |
+f_external(false, false, true, a2, 1); |
+f_external(false, true, true, a2, 1); |
+%OptimizeFunctionOnNextCall(f_external); |
+f_external(false, false, false, a2, 2); |
+assertEquals(1, a2[undefined]); |