Commit 8b0cbd23 authored by Paolo Severini's avatar Paolo Severini Committed by V8 LUCI CQ

Fix flaky tests mjsunit/compiler/call-with-arraylike-or-spread*

The tests are not compatible with the --stress-background-compile flag.

Bug: v8:11821
Change-Id: Iecef6a2838109fddc9f0ecc145a9f8971bc9bc3c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2918214Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
Commit-Queue: Paolo Severini <paolosev@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#74959}
parent 906193e0
...@@ -17,25 +17,25 @@ ...@@ -17,25 +17,25 @@
"use strict"; "use strict";
// Setting value to be retrieved in place of hole. // Setting value to be retrieved in place of hole.
Array.prototype[1] = 'x'; Array.prototype[2] = 'x';
var sum_js3_got_interpreted = true; var sum_js_got_interpreted = true;
function sum_js3(a, b, c) { function sum_js(a, b, c, d) {
sum_js3_got_interpreted = %IsBeingInterpreted(); sum_js_got_interpreted = %IsBeingInterpreted();
return a + b + c; return a + b + c + d;
} }
function foo(x, y) { function foo(x, y) {
return sum_js3.apply(null, [x, , y]); return sum_js.apply(null, ["", x, ,y]);
} }
%PrepareFunctionForOptimization(sum_js3); %PrepareFunctionForOptimization(sum_js);
%PrepareFunctionForOptimization(foo); %PrepareFunctionForOptimization(foo);
assertEquals('AxB', foo('A', 'B')); assertEquals('AxB', foo('A', 'B'));
assertTrue(sum_js3_got_interpreted); assertTrue(sum_js_got_interpreted);
// The protector should be invalidated, which prevents inlining. // The protector should be invalidated, which prevents inlining.
%OptimizeFunctionOnNextCall(foo); %OptimizeFunctionOnNextCall(foo);
assertEquals('AxB', foo('A', 'B')); assertEquals('AxB', foo('A', 'B'));
assertTrue(sum_js3_got_interpreted); assertTrue(sum_js_got_interpreted);
assertOptimized(foo); assertOptimized(foo);
})(); })();
...@@ -20,33 +20,33 @@ ...@@ -20,33 +20,33 @@
(function () { (function () {
"use strict"; "use strict";
var sum_js3_got_interpreted = true; var sum_js_got_interpreted = true;
function sum_js3(a, b, c) { function sum_js(a, b, c, d) {
sum_js3_got_interpreted = %IsBeingInterpreted(); sum_js_got_interpreted = %IsBeingInterpreted();
return a + b + c; return a + b + c + d;
} }
function foo(x, y) { function foo(x, y) {
return sum_js3.apply(null, [x, , y]); return sum_js.apply(null, ["", x, ,y]);
} }
%PrepareFunctionForOptimization(sum_js3); %PrepareFunctionForOptimization(sum_js);
%PrepareFunctionForOptimization(foo); %PrepareFunctionForOptimization(foo);
assertEquals('AundefinedB', foo('A', 'B')); assertEquals('AundefinedB', foo('A', 'B'));
assertTrue(sum_js3_got_interpreted); assertTrue(sum_js_got_interpreted);
%OptimizeFunctionOnNextCall(foo); %OptimizeFunctionOnNextCall(foo);
assertEquals('AundefinedB', foo('A', 'B')); assertEquals('AundefinedB', foo('A', 'B'));
assertFalse(sum_js3_got_interpreted); assertFalse(sum_js_got_interpreted);
assertOptimized(foo); assertOptimized(foo);
// Modify the array prototype, define a default value for element [1]. // Modify the array prototype, define a default value for element [1].
Array.prototype[1] = 'x'; Array.prototype[2] = 'x';
assertUnoptimized(foo); assertUnoptimized(foo);
// Now the call will not be inlined. // Now the call will not be inlined.
%PrepareFunctionForOptimization(foo); %PrepareFunctionForOptimization(foo);
%OptimizeFunctionOnNextCall(foo); %OptimizeFunctionOnNextCall(foo);
assertEquals('AxB', foo('A', 'B')); assertEquals('AxB', foo('A', 'B'));
assertTrue(sum_js3_got_interpreted); assertTrue(sum_js_got_interpreted);
assertOptimized(foo); assertOptimized(foo);
})(); })();
...@@ -18,9 +18,9 @@ ...@@ -18,9 +18,9 @@
// Test deopt when array map changes. // Test deopt when array map changes.
(function () { (function () {
"use strict"; "use strict";
var sum_js3_got_interpreted = true; var sum_js_got_interpreted = true;
function sum_js3(a, b, c) { function sum_js(a, b, c) {
sum_js3_got_interpreted = %IsBeingInterpreted(); sum_js_got_interpreted = %IsBeingInterpreted();
return a + b + c; return a + b + c;
} }
function foo(x, y, z, str) { function foo(x, y, z, str) {
...@@ -28,25 +28,25 @@ ...@@ -28,25 +28,25 @@
if (str) { if (str) {
v[0] = str; v[0] = str;
} }
return sum_js3.apply(null, v); return sum_js.apply(null, v);
} }
%PrepareFunctionForOptimization(sum_js3); %PrepareFunctionForOptimization(sum_js);
for (let i = 0; i < 5; i++) { for (let i = 0; i < 5; i++) {
%PrepareFunctionForOptimization(foo); %PrepareFunctionForOptimization(foo);
assertEquals(78, foo(26, 6, 46, null)); assertEquals(78, foo(26, 6, 46, null));
assertTrue(sum_js3_got_interpreted); assertTrue(sum_js_got_interpreted);
// Compile function foo; inlines 'sum_js3' into 'foo'. // Compile function foo; inlines 'sum_js' into 'foo'.
%OptimizeFunctionOnNextCall(foo); %OptimizeFunctionOnNextCall(foo);
assertEquals(78, foo(26, 6, 46, null)); assertEquals(78, foo(26, 6, 46, null));
assertOptimized(foo); assertOptimized(foo);
if (i < 3) { if (i < 3) {
assertFalse(sum_js3_got_interpreted); assertFalse(sum_js_got_interpreted);
} else { } else {
// i: 3: Speculation mode prevents optimization of sum_js3.apply() call. // i: 3: Speculation mode prevents optimization of sum_js.apply() call.
assertTrue(sum_js3_got_interpreted); assertTrue(sum_js_got_interpreted);
} }
// This should deoptimize: // This should deoptimize:
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
// i: 1,2: Deopt eager: wrong map. // i: 1,2: Deopt eager: wrong map.
// i: 3: Won't deopt anymore. // i: 3: Won't deopt anymore.
assertEquals("v8646", foo(26, 6, 46, "v8")); assertEquals("v8646", foo(26, 6, 46, "v8"));
assertTrue(sum_js3_got_interpreted); assertTrue(sum_js_got_interpreted);
if (i < 3) { if (i < 3) {
assertUnoptimized(foo); assertUnoptimized(foo);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment