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 @@
"use strict";
// Setting value to be retrieved in place of hole.
Array.prototype[1] = 'x';
Array.prototype[2] = 'x';
var sum_js3_got_interpreted = true;
function sum_js3(a, b, c) {
sum_js3_got_interpreted = %IsBeingInterpreted();
return a + b + c;
var sum_js_got_interpreted = true;
function sum_js(a, b, c, d) {
sum_js_got_interpreted = %IsBeingInterpreted();
return a + b + c + d;
}
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);
assertEquals('AxB', foo('A', 'B'));
assertTrue(sum_js3_got_interpreted);
assertTrue(sum_js_got_interpreted);
// The protector should be invalidated, which prevents inlining.
%OptimizeFunctionOnNextCall(foo);
assertEquals('AxB', foo('A', 'B'));
assertTrue(sum_js3_got_interpreted);
assertTrue(sum_js_got_interpreted);
assertOptimized(foo);
})();
......@@ -20,33 +20,33 @@
(function () {
"use strict";
var sum_js3_got_interpreted = true;
function sum_js3(a, b, c) {
sum_js3_got_interpreted = %IsBeingInterpreted();
return a + b + c;
var sum_js_got_interpreted = true;
function sum_js(a, b, c, d) {
sum_js_got_interpreted = %IsBeingInterpreted();
return a + b + c + d;
}
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);
assertEquals('AundefinedB', foo('A', 'B'));
assertTrue(sum_js3_got_interpreted);
assertTrue(sum_js_got_interpreted);
%OptimizeFunctionOnNextCall(foo);
assertEquals('AundefinedB', foo('A', 'B'));
assertFalse(sum_js3_got_interpreted);
assertFalse(sum_js_got_interpreted);
assertOptimized(foo);
// Modify the array prototype, define a default value for element [1].
Array.prototype[1] = 'x';
Array.prototype[2] = 'x';
assertUnoptimized(foo);
// Now the call will not be inlined.
%PrepareFunctionForOptimization(foo);
%OptimizeFunctionOnNextCall(foo);
assertEquals('AxB', foo('A', 'B'));
assertTrue(sum_js3_got_interpreted);
assertTrue(sum_js_got_interpreted);
assertOptimized(foo);
})();
......@@ -18,9 +18,9 @@
// Test deopt when array map changes.
(function () {
"use strict";
var sum_js3_got_interpreted = true;
function sum_js3(a, b, c) {
sum_js3_got_interpreted = %IsBeingInterpreted();
var sum_js_got_interpreted = true;
function sum_js(a, b, c) {
sum_js_got_interpreted = %IsBeingInterpreted();
return a + b + c;
}
function foo(x, y, z, str) {
......@@ -28,25 +28,25 @@
if (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++) {
%PrepareFunctionForOptimization(foo);
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);
assertEquals(78, foo(26, 6, 46, null));
assertOptimized(foo);
if (i < 3) {
assertFalse(sum_js3_got_interpreted);
assertFalse(sum_js_got_interpreted);
} else {
// i: 3: Speculation mode prevents optimization of sum_js3.apply() call.
assertTrue(sum_js3_got_interpreted);
// i: 3: Speculation mode prevents optimization of sum_js.apply() call.
assertTrue(sum_js_got_interpreted);
}
// This should deoptimize:
......@@ -54,7 +54,7 @@
// i: 1,2: Deopt eager: wrong map.
// i: 3: Won't deopt anymore.
assertEquals("v8646", foo(26, 6, 46, "v8"));
assertTrue(sum_js3_got_interpreted);
assertTrue(sum_js_got_interpreted);
if (i < 3) {
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