[cleanup] Add PrepareFunctionForOptimization to regression tests(2)

R=mythria@chromium.org

Bug: v8:9183
Change-Id: Ia534816b460eaf005a0017afeb2d55ccb3402a37
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1660473
Reviewed-by: Mythri Alle <mythria@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62169}
This commit is contained in:
Andreas Haas 2019-06-14 11:50:03 +02:00 committed by Commit Bot
parent 054af8477c
commit 76d33a174e
14 changed files with 19 additions and 0 deletions

View File

@ -47,8 +47,10 @@ function mkNumberDictionary() {
}
function write(a, i) { a[i] = "bazinga!"; }
%PrepareFunctionForOptimization(write);
function test(factories, w) {
%PrepareFunctionForOptimization(w);
factories.forEach(function(f) { w(f(), 0); });
factories.forEach(function(f) { w(f(), 0); });
%OptimizeFunctionOnNextCall(w);

View File

@ -39,6 +39,7 @@ function f(restIsArray, rest) {
var arrIsArguments = (arr[1] !== rest);
assertEquals(restIsArray, arrIsArguments);
}
%PrepareFunctionForOptimization(f);
f(false, 'b', 'c');
f(false, 'b', 'c');

View File

@ -40,7 +40,9 @@ function MakeClosure() {
// Create two closures that share the same literal boilerplates.
var closure1 = MakeClosure();
%PrepareFunctionForOptimization(closure1);
var closure2 = MakeClosure();
%PrepareFunctionForOptimization(closure2);
var expected = [1,2,3,3,4,5,6,7,8,9,bozo];
// Make sure we generate optimized code for the first closure after

View File

@ -30,6 +30,7 @@
var foo = (function() {
return eval("(function bar() { return 1; })");
})();
%PrepareFunctionForOptimization(foo);
foo();
foo();

View File

@ -68,6 +68,7 @@ for (var i = 750; i < 3000; i++) {
source += "x=1; return _0;"
var f = new Function(source);
%PrepareFunctionForOptimization(f);
f();
%OptimizeFunctionOnNextCall(f);

View File

@ -36,6 +36,7 @@ function foo(x) {
}
return result;
}
%PrepareFunctionForOptimization(foo);
foo(0);
foo(0);

View File

@ -36,6 +36,7 @@ function f() {
a[i]++;
assertTrue(isNaN(a[i]));
}
%PrepareFunctionForOptimization(f);
f();
f();

View File

@ -36,6 +36,7 @@ function f() {
a[i] = 1/y;
assertFalse(isNaN(a[i]));
}
%PrepareFunctionForOptimization(f);
f();
f();

View File

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

View File

@ -16,6 +16,7 @@ function foo(a) {
}
return sum;
}
%PrepareFunctionForOptimization(foo);
var a = new Int32Array(10);

View File

@ -42,6 +42,7 @@
function foo() { return bar(arguments[0], arguments[1], arguments[2]); }
function baz(f, deopt) { return foo("x", deopt, f); }
%PrepareFunctionForOptimization(baz);
baz(f1, 0);
baz(f2, 0);
@ -65,6 +66,7 @@
function foo() { return bar(arguments[0], arguments[1]); }
function baz(deopt) { return foo("x", deopt); }
%PrepareFunctionForOptimization(baz);
baz(0);
baz(0);
@ -88,6 +90,7 @@
function foo() { return bar(arguments[0], arguments[1]); }
function baz(deopt) { return foo(0, deopt); }
%PrepareFunctionForOptimization(baz);
baz(0);
baz(0);

View File

@ -30,11 +30,13 @@
function bar() { return new Array(); }
%PrepareFunctionForOptimization(bar);
bar();
bar();
%OptimizeFunctionOnNextCall(bar);
a = bar();
function foo(len) { return new Array(len); }
%PrepareFunctionForOptimization(foo);
foo(0);
foo(0);
%OptimizeFunctionOnNextCall(bar);

View File

@ -37,6 +37,7 @@ function withCommaExpressionInConditional(x) {
}
return (y = x + 1, y > 1) ? 'medium' : 'small';
}
%PrepareFunctionForOptimization(withCommaExpressionInConditional);
for (var i = 0; i < 5; i++) {
withCommaExpressionInConditional(i);

View File

@ -38,6 +38,7 @@ function __f_0(__v_1,__v_0,i) {
__v_1.a = __v_0[i];
gc();
}
%PrepareFunctionForOptimization(__f_0);
try {
__f_0(__v_1,__v_0,0);
__f_0(__v_1,__v_0,0);