[cleanup] Add missing %PrepareFunctionForOptimize in mjsunit tests

Bug: v8:8801,v8:8394,v8:9183
Change-Id: If482c6a14f389d54c6ca3891aa7b8475f7a1fce1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1660617
Commit-Queue: Ross McIlroy <rmcilroy@chromium.org>
Reviewed-by: Mythri Alle <mythria@chromium.org>
Auto-Submit: Ross McIlroy <rmcilroy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62192}
This commit is contained in:
Ross McIlroy 2019-06-14 17:27:09 +01:00 committed by Commit Bot
parent 9b5635ee41
commit d7a8170d2d
24 changed files with 36 additions and 5 deletions

View File

@ -53,7 +53,7 @@ function test(factories, w) {
%PrepareFunctionForOptimization(w);
factories.forEach(function(f) { w(f(), 0); });
factories.forEach(function(f) { w(f(), 0); });
%OptimizeFunctionOnNextCall(w);
%OptimizeFunctionOnNextCall(w);
factories.forEach(function(f) { w(f(), 0); });
}

View File

@ -41,6 +41,7 @@ function f(restIsArray, rest) {
}
%PrepareFunctionForOptimization(f);
%PrepareFunctionForOptimization(f);
f(false, 'b', 'c');
f(false, 'b', 'c');
f(false, 'b', 'c');

View File

@ -48,6 +48,7 @@ var expected = [1,2,3,3,4,5,6,7,8,9,bozo];
// Make sure we generate optimized code for the first closure after
// warming it up properly so that the literals boilerplate is generated
// and the optimized code uses CreateArrayLiteralShallow runtime call.
%PrepareFunctionForOptimization(closure1);
assertEquals(0, closure1(false));
assertEquals(expected, closure1(true));
%OptimizeFunctionOnNextCall(closure1);
@ -55,6 +56,7 @@ assertEquals(expected, closure1(true));
// Optimize the second closure, which should reuse the optimized code
// from the first closure with the same literal boilerplates.
%PrepareFunctionForOptimization(closure2);
assertEquals(0, closure2(false));
%OptimizeFunctionOnNextCall(closure2);
assertEquals(expected, closure2(true));

View File

@ -32,6 +32,7 @@ var foo = (function() {
})();
%PrepareFunctionForOptimization(foo);
%PrepareFunctionForOptimization(foo);
foo();
foo();
%OptimizeFunctionOnNextCall(foo);

View File

@ -70,6 +70,7 @@ source += "x=1; return _0;"
var f = new Function(source);
%PrepareFunctionForOptimization(f);
%PrepareFunctionForOptimization(f);
f();
%OptimizeFunctionOnNextCall(f);
f();

View File

@ -38,6 +38,7 @@ function foo(x) {
}
%PrepareFunctionForOptimization(foo);
%PrepareFunctionForOptimization(foo);
foo(0);
foo(0);
%OptimizeFunctionOnNextCall(foo);

View File

@ -38,6 +38,7 @@ function f() {
}
%PrepareFunctionForOptimization(f);
%PrepareFunctionForOptimization(f);
f();
f();
f();

View File

@ -38,6 +38,7 @@ function f() {
}
%PrepareFunctionForOptimization(f);
%PrepareFunctionForOptimization(f);
f();
f();
f();

View File

@ -39,6 +39,7 @@ function foo(x, fun) {
}
%PrepareFunctionForOptimization(foo);
%PrepareFunctionForOptimization(foo);
assertThrows("foo(1, bailout)");
assertThrows("foo(1, bailout)");
%OptimizeFunctionOnNextCall(foo);

View File

@ -20,10 +20,12 @@ function foo(a) {
var a = new Int32Array(10);
%PrepareFunctionForOptimization(foo);
foo(a);
foo(a);
%OptimizeFunctionOnNextCall(foo);
foo(a);
%PrepareFunctionForOptimization(foo);
%OptimizeFunctionOnNextCall(foo);
foo(a);
assertOptimized(foo);

View File

@ -44,6 +44,7 @@
function baz(f, deopt) { return foo("x", deopt, f); }
%PrepareFunctionForOptimization(baz);
%PrepareFunctionForOptimization(baz);
baz(f1, 0);
baz(f2, 0);
%OptimizeFunctionOnNextCall(baz);
@ -68,6 +69,7 @@
function baz(deopt) { return foo("x", deopt); }
%PrepareFunctionForOptimization(baz);
%PrepareFunctionForOptimization(baz);
baz(0);
baz(0);
%OptimizeFunctionOnNextCall(baz);
@ -92,6 +94,7 @@
function baz(deopt) { return foo(0, deopt); }
%PrepareFunctionForOptimization(baz);
%PrepareFunctionForOptimization(baz);
baz(0);
baz(0);
%OptimizeFunctionOnNextCall(baz);

View File

@ -39,5 +39,6 @@ function foo(len) { return new Array(len); }
%PrepareFunctionForOptimization(foo);
foo(0);
foo(0);
%PrepareFunctionForOptimization(bar);
%OptimizeFunctionOnNextCall(bar);
foo(0);

View File

@ -39,6 +39,7 @@ function withCommaExpressionInConditional(x) {
}
%PrepareFunctionForOptimization(withCommaExpressionInConditional);
%PrepareFunctionForOptimization(withCommaExpressionInConditional);
for (var i = 0; i < 5; i++) {
withCommaExpressionInConditional(i);
}

View File

@ -40,6 +40,7 @@ function __f_0(__v_1,__v_0,i) {
}
%PrepareFunctionForOptimization(__f_0);
try {
%PrepareFunctionForOptimization(__f_0);
__f_0(__v_1,__v_0,0);
__f_0(__v_1,__v_0,0);
%OptimizeFunctionOnNextCall(__f_0);
@ -85,6 +86,7 @@ function __f_7(o) {
return o.__f_4();
}
try {
%PrepareFunctionForOptimization(__f_7);
for (var __v_7 = 0; __v_7 < 5; __v_7++) __f_7(__v_5);
%OptimizeFunctionOnNextCall(__f_7);
__f_7(__v_5);
@ -112,6 +114,7 @@ gc();
var __v_8;
} catch(e) { print("Caught: " + e); }
function __f_9(n) { return __v_9.charAt(n); }
%PrepareFunctionForOptimization(__f_9);
try {
for (var __v_7 = 0; __v_7 < 5; __v_7++) {
__v_8 = __f_9(0);

View File

@ -15,6 +15,7 @@ function foo(a) {
for (i = 0; i < 1; i++) ;
}
}
%PrepareFunctionForOptimization(foo);
%OptimizeFunctionOnNextCall(foo);
foo();
@ -27,5 +28,6 @@ var __v_45;
for (__v_45 = 128; __v_45 < 256; __v_45++) {
}
}
%PrepareFunctionForOptimization(bar);
%OptimizeFunctionOnNextCall(bar);
assertThrows(bar);

View File

@ -36,6 +36,7 @@ function foo(object) {
}
return key;
}
%PrepareFunctionForOptimization(foo);
// Collect type feedback for slow-mode for-in.
foo(training);

View File

@ -12,6 +12,8 @@ var f = (function() {
return foo;
})();
%PrepareFunctionForOptimization(f);
function deopt(f) {
return {
toString : function() {

View File

@ -10,6 +10,7 @@ function g() {
f();
}
%PrepareFunctionForOptimization(g);
assertThrows(g, SyntaxError);
%OptimizeFunctionOnNextCall(g);
assertThrows(g, SyntaxError);

View File

@ -12,8 +12,9 @@
Object.defineProperty(C.prototype, "boom", { get: function() {
if (should_deoptimize_caller) %DeoptimizeFunction(D.prototype.f);
return this.m
}})
}});
%PrepareFunctionForOptimization(D.prototype.f);
assertEquals(23, new D().f());
assertEquals(23, new D().f());
%OptimizeFunctionOnNextCall(D.prototype.f);
@ -30,8 +31,9 @@
Object.defineProperty(C.prototype, "boom", { get: function() {
if (should_deoptimize_caller) %DeoptimizeFunction(D.prototype.f);
return this.m
}})
}});
%PrepareFunctionForOptimization(D.prototype.f);
assertEquals(23, new D().f("boom"));
assertEquals(23, new D().f("boom"));
%OptimizeFunctionOnNextCall(D.prototype.f);

View File

@ -9,6 +9,7 @@
if (o == 'warmup') { return g() }
with (o) { return x }
}
%PrepareFunctionForOptimization(f);
function g() {
// Only a marker function serving as weak embedded object.
}

View File

@ -12,6 +12,7 @@ function f(osr_and_recurse) {
for (var i = 0; i < 3; ++i) {
if (i == 1) %OptimizeOsr();
}
%PrepareFunctionForOptimization(f);
%OptimizeFunctionOnNextCall(f);
f(false); // Trigger tier-up due to recursive call.
boom(this); // Causes a deopt due to below dependency.

View File

@ -8,6 +8,7 @@ function foo(a, b) {
return a + "0123456789012";
}
%PrepareFunctionForOptimization(foo);
foo("a");
foo("a");
%OptimizeFunctionOnNextCall(foo);
@ -16,6 +17,7 @@ foo("a");
var a = "a".repeat(%StringMaxLength());
assertThrows(function() { foo(a); }, RangeError);
%PrepareFunctionForOptimization(foo);
%OptimizeFunctionOnNextCall(foo);
assertThrows(function() { foo(a); }, RangeError);
assertOptimized(foo);

View File

@ -9,10 +9,10 @@ function f(n) {
function g() {
return x;
};
%PrepareFunctionForOptimization(g);
for (var i = 0; i < n; ++i) {
var x = i;
a[i] = g;
%PrepareFunctionForOptimization(g);
%OptimizeFunctionOnNextCall(g);
g();
}

View File

@ -10,10 +10,10 @@ function f(n) {
function g() {
return x;
};
%PrepareFunctionForOptimization(g);
for (var i = 0; i < n; ++i) {
var x = i;
a[i] = g;
%PrepareFunctionForOptimization(g);
%OptimizeFunctionOnNextCall(g);
g();
}