Index: test/mjsunit/compiler/assignment-deopt.js |
diff --git a/test/mjsunit/compiler/assignment-deopt.js b/test/mjsunit/compiler/assignment-deopt.js |
index 74f185bb1cd065b85ae1a2fed5b2d2200a309fdd..2b006254171c32b969c73f0236cf1ebe1b96880e 100644 |
--- a/test/mjsunit/compiler/assignment-deopt.js |
+++ b/test/mjsunit/compiler/assignment-deopt.js |
@@ -25,6 +25,8 @@ |
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
+// Flags: --allow-natives-syntax |
+ |
// Test deopt with count operation on parameter. |
var max_smi = 1073741823; |
var o = {x:0}; |
@@ -44,12 +46,15 @@ o.x = "42"; |
assign2(o); |
assertEquals("421", o.x); |
-var s = max_smi - 10000; |
+var s = max_smi - 10; |
o.x = s; |
-for(var i = 0; i < 20000; i++) { |
+for(var i = 0; i < 20; i++) { |
assign2(o); |
+ if (i == 4) { |
+ %OptimizeFunctionOnNextCall(assign2); |
+ } |
} |
-assertEquals(max_smi + 10000, o.x); |
+assertEquals(max_smi + 10, o.x); |
// Test deopt with count operation on keyed property. |
@@ -59,36 +64,48 @@ o = ["42"]; |
assign3(o, 0); |
assertEquals("421", o[0]); |
-var s = max_smi - 10000; |
+var s = max_smi - 10; |
o[0] = s; |
-for(var i = 0; i < 20000; i++) { |
+for(var i = 0; i < 20; i++) { |
assign3(o, 0); |
+ if (i == 4) { |
+ %OptimizeFunctionOnNextCall(assign3); |
+ } |
} |
-assertEquals(max_smi + 10000, o[0]); |
+assertEquals(max_smi + 10, o[0]); |
-assign3(o,"0"); |
+assign3(o, "0"); |
-assertEquals(max_smi + 10001, o[0]); |
+assertEquals(max_smi + 11, o[0]); |
// Test bailout when accessing a non-existing array element. |
o[0] = 0; |
-for(var i = 0; i < 10000; i++) { |
+for(var i = 0; i < 5; i++) { |
assign3(o, 0); |
} |
-assign3(o,1); |
+%OptimizeFunctionOnNextCall(assign3); |
+assign3(o, 0); |
+assign3(o, 1); |
// Test bailout with count operation in a value context. |
function assign5(x,y) { return (x += 1) + y; } |
-for (var i = 0; i < 10000; ++i) assertEquals(4, assign5(2, 1)); |
+for (var i = 0; i < 5; ++i) assertEquals(4, assign5(2, 1)); |
+%OptimizeFunctionOnNextCall(assign5); |
+assertEquals(4, assign5(2, 1)); |
+ |
assertEquals(4.1, assign5(2, 1.1)); |
assertEquals(4.1, assign5(2.1, 1)); |
function assign7(o,y) { return (o.x += 1) + y; } |
o = {x:0}; |
-for (var i = 0; i < 10000; ++i) { |
+for (var i = 0; i < 5; ++i) { |
o.x = 42; |
assertEquals(44, assign7(o, 1)); |
} |
+%OptimizeFunctionOnNextCall(assign7); |
+o.x = 42; |
+assertEquals(44, assign7(o, 1)); |
+ |
o.x = 42; |
assertEquals(44.1, assign7(o, 1.1)); |
o.x = 42.1; |
@@ -96,10 +113,14 @@ assertEquals(44.1, assign7(o, 1)); |
function assign9(o,y) { return (o[0] += 1) + y; } |
q = [0]; |
-for (var i = 0; i < 10000; ++i) { |
+for (var i = 0; i < 5; ++i) { |
q[0] = 42; |
assertEquals(44, assign9(q, 1)); |
} |
+%OptimizeFunctionOnNextCall(assign9); |
+q[0] = 42; |
+assertEquals(44, assign9(q, 1)); |
+ |
q[0] = 42; |
assertEquals(44.1, assign9(q, 1.1)); |
q[0] = 42.1; |
@@ -109,11 +130,16 @@ assertEquals(44.1, assign9(q, 1)); |
function assign10(p) { return p.x += 1 } |
var g1 = {x:0}; |
var g2 = {y:0, x:42}; |
-for (var i = 0; i < 10000; ++i) { |
+for (var i = 0; i < 5; ++i) { |
g1.x = 42; |
assertEquals(43, assign10(g1)); |
assertEquals(43, g1.x); |
} |
+%OptimizeFunctionOnNextCall(assign10); |
+g1.x = 42; |
+assertEquals(43, assign10(g1)); |
+assertEquals(43, g1.x); |
+ |
assertEquals(43, assign10(g2)); |
assertEquals(43, g2.x); |
@@ -123,10 +149,14 @@ o = {x:0}; |
var g3 = { valueOf: function() { o.y = "bar"; return 42; }}; |
function assign11(p) { return p.x += 1; } |
-for (var i = 0; i < 10000; i++) { |
+for (var i = 0; i < 5; i++) { |
o.x = "a"; |
assign11(o); |
} |
+%OptimizeFunctionOnNextCall(assign11); |
+o.x = "a"; |
+assign11(o); |
+ |
assertEquals("a11", assign11(o)); |
o.x = g3; |
assertEquals(43, assign11(o)); |
@@ -136,10 +166,14 @@ o = [0]; |
var g4 = { valueOf: function() { o.y = "bar"; return 42; }}; |
function assign12(p) { return p[0] += 1; } |
-for (var i = 0; i < 1000000; i++) { |
+for (var i = 0; i < 5; i++) { |
o[0] = "a"; |
assign12(o); |
} |
+%OptimizeFunctionOnNextCall(assign12); |
+o[0] = "a"; |
+assign12(o); |
+ |
assertEquals("a11", assign12(o)); |
o[0] = g4; |
assertEquals(43, assign12(o)); |