[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:
parent
9b5635ee41
commit
d7a8170d2d
@ -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); });
|
||||
}
|
||||
|
||||
|
@ -41,6 +41,7 @@ function f(restIsArray, rest) {
|
||||
}
|
||||
%PrepareFunctionForOptimization(f);
|
||||
|
||||
%PrepareFunctionForOptimization(f);
|
||||
f(false, 'b', 'c');
|
||||
f(false, 'b', 'c');
|
||||
f(false, 'b', 'c');
|
||||
|
@ -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));
|
||||
|
@ -32,6 +32,7 @@ var foo = (function() {
|
||||
})();
|
||||
%PrepareFunctionForOptimization(foo);
|
||||
|
||||
%PrepareFunctionForOptimization(foo);
|
||||
foo();
|
||||
foo();
|
||||
%OptimizeFunctionOnNextCall(foo);
|
||||
|
@ -70,6 +70,7 @@ source += "x=1; return _0;"
|
||||
var f = new Function(source);
|
||||
%PrepareFunctionForOptimization(f);
|
||||
|
||||
%PrepareFunctionForOptimization(f);
|
||||
f();
|
||||
%OptimizeFunctionOnNextCall(f);
|
||||
f();
|
||||
|
@ -38,6 +38,7 @@ function foo(x) {
|
||||
}
|
||||
%PrepareFunctionForOptimization(foo);
|
||||
|
||||
%PrepareFunctionForOptimization(foo);
|
||||
foo(0);
|
||||
foo(0);
|
||||
%OptimizeFunctionOnNextCall(foo);
|
||||
|
@ -38,6 +38,7 @@ function f() {
|
||||
}
|
||||
%PrepareFunctionForOptimization(f);
|
||||
|
||||
%PrepareFunctionForOptimization(f);
|
||||
f();
|
||||
f();
|
||||
f();
|
||||
|
@ -38,6 +38,7 @@ function f() {
|
||||
}
|
||||
%PrepareFunctionForOptimization(f);
|
||||
|
||||
%PrepareFunctionForOptimization(f);
|
||||
f();
|
||||
f();
|
||||
f();
|
||||
|
@ -39,6 +39,7 @@ function foo(x, fun) {
|
||||
}
|
||||
%PrepareFunctionForOptimization(foo);
|
||||
|
||||
%PrepareFunctionForOptimization(foo);
|
||||
assertThrows("foo(1, bailout)");
|
||||
assertThrows("foo(1, bailout)");
|
||||
%OptimizeFunctionOnNextCall(foo);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -39,5 +39,6 @@ function foo(len) { return new Array(len); }
|
||||
%PrepareFunctionForOptimization(foo);
|
||||
foo(0);
|
||||
foo(0);
|
||||
%PrepareFunctionForOptimization(bar);
|
||||
%OptimizeFunctionOnNextCall(bar);
|
||||
foo(0);
|
||||
|
@ -39,6 +39,7 @@ function withCommaExpressionInConditional(x) {
|
||||
}
|
||||
%PrepareFunctionForOptimization(withCommaExpressionInConditional);
|
||||
|
||||
%PrepareFunctionForOptimization(withCommaExpressionInConditional);
|
||||
for (var i = 0; i < 5; i++) {
|
||||
withCommaExpressionInConditional(i);
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -36,6 +36,7 @@ function foo(object) {
|
||||
}
|
||||
return key;
|
||||
}
|
||||
%PrepareFunctionForOptimization(foo);
|
||||
|
||||
// Collect type feedback for slow-mode for-in.
|
||||
foo(training);
|
||||
|
@ -12,6 +12,8 @@ var f = (function() {
|
||||
return foo;
|
||||
})();
|
||||
|
||||
%PrepareFunctionForOptimization(f);
|
||||
|
||||
function deopt(f) {
|
||||
return {
|
||||
toString : function() {
|
||||
|
@ -10,6 +10,7 @@ function g() {
|
||||
f();
|
||||
}
|
||||
|
||||
%PrepareFunctionForOptimization(g);
|
||||
assertThrows(g, SyntaxError);
|
||||
%OptimizeFunctionOnNextCall(g);
|
||||
assertThrows(g, SyntaxError);
|
||||
|
@ -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);
|
||||
|
@ -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.
|
||||
}
|
||||
|
@ -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.
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user