Commit 8cbbc2e8 authored by Mythri A's avatar Mythri A Committed by Commit Bot

[cleanup] Add missing %PrepareFunctionForOptimize in mjsunit tests

Bug: v8:8801,v8:8394,v8:9183
Change-Id: I88c0268b30d4b927f9856db7a3b054b74baf1923
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1660608
Commit-Queue: Ross McIlroy <rmcilroy@chromium.org>
Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62189}
parent 63a9919a
......@@ -101,6 +101,7 @@ check_test_base(a, 3, false);
// Test that we deopt on failed bounds checks.
var dictionary_map_array = new Int32Array(128);
test_base(dictionary_map_array, 5, true);
%PrepareFunctionForOptimization(test_base);
test_base(dictionary_map_array, 6, true);
test_base(dictionary_map_array, 5, false);
test_base(dictionary_map_array, 6, false);
......@@ -110,6 +111,7 @@ assertUnoptimized(test_base);
// Forget about the dictionary_map_array's map.
%ClearFunctionFeedback(test_base);
%PrepareFunctionForOptimization(test_base);
test_base(a, 5, true);
test_base(a, 6, true);
......@@ -170,6 +172,7 @@ function short_test(a, i) {
a[i + 9] = 0;
a[i - 10] = 0;
}
%PrepareFunctionForOptimization(short_test);
short_test(short_a, 50);
short_test(short_a, 50);
%OptimizeFunctionOnNextCall(short_test);
......
......@@ -126,7 +126,8 @@ function assertKind(expected, obj, name_opt) {
assertTrue(a instanceof Array);
var contextB = Realm.create();
Realm.eval(contextB, "function bar2() { return new Array(); };");
Realm.eval(contextB,
"function bar2() { return new Array(); }; %PrepareFunctionForOptimization(bar2)");
Realm.eval(contextB, "bar2(); bar2();");
Realm.eval(contextB, "%OptimizeFunctionOnNextCall(bar2);");
Realm.eval(contextB, "bar2();");
......
......@@ -645,6 +645,7 @@ assertEquals(undefined, arr.reduceRight(function(val) { return val }));
g();
deopt = true;
g();
%PrepareFunctionForOptimization(g);
deopt = false;
array = [11,22,33,45,56,6,77,84,93,101];
%OptimizeFunctionOnNextCall(g);
......@@ -670,6 +671,7 @@ assertEquals(undefined, arr.reduceRight(function(val) { return val }));
g();
deopt = true;
g();
%PrepareFunctionForOptimization(g);
deopt = false;
array = [11,22,33,45,56,6,77,84,93,101];
%OptimizeFunctionOnNextCall(g);
......@@ -706,6 +708,7 @@ assertEquals(undefined, arr.reduceRight(function(val) { return val }));
g();
deopt = true;
g();
%PrepareFunctionForOptimization(g);
deopt = false;
array = [11,22,33,45,56,6,77,84,93,101];
%OptimizeFunctionOnNextCall(g);
......@@ -756,6 +759,7 @@ assertEquals(undefined, arr.reduceRight(function(val) { return val }));
done = true;
assertEquals(null, g());
done = false;
%PrepareFunctionForOptimization(g);
g(); g();
%OptimizeFunctionOnNextCall(g);
g();
......@@ -788,6 +792,7 @@ assertEquals(undefined, arr.reduceRight(function(val) { return val }));
done = true;
assertEquals(null, g());
done = false;
%PrepareFunctionForOptimization(g);
g(); g();
%OptimizeFunctionOnNextCall(g);
g();
......@@ -820,6 +825,7 @@ assertEquals(undefined, arr.reduceRight(function(val) { return val }));
done = true;
assertEquals(null, g());
done = false;
%PrepareFunctionForOptimization(g);
g(); g();
%OptimizeFunctionOnNextCall(g);
g();
......@@ -853,6 +859,7 @@ assertEquals(undefined, arr.reduceRight(function(val) { return val }));
done = true;
assertEquals(null, g());
done = false;
%PrepareFunctionForOptimization(g);
g(); g();
%OptimizeFunctionOnNextCall(g);
g();
......@@ -906,6 +913,7 @@ assertEquals(undefined, arr.reduceRight(function(val) { return val }));
done = true;
assertEquals(null, g());
done = false;
%PrepareFunctionForOptimization(g);
g(); g();
%OptimizeFunctionOnNextCall(g);
g();
......@@ -941,6 +949,7 @@ assertEquals(undefined, arr.reduceRight(function(val) { return val }));
done = true;
assertEquals(null, g());
done = false;
%PrepareFunctionForOptimization(g);
g(); g();
%OptimizeFunctionOnNextCall(g);
g();
......@@ -1031,6 +1040,7 @@ assertEquals(undefined, arr.reduceRight(function(val) { return val }));
g();
deopt = true;
g();
%PrepareFunctionForOptimization(g);
deopt = false;
array = [11,22,33,45,56,6,77,84,93,101];
%OptimizeFunctionOnNextCall(g);
......@@ -1081,6 +1091,7 @@ assertEquals(undefined, arr.reduceRight(function(val) { return val }));
done = true;
assertEquals(null, g());
done = false;
%PrepareFunctionForOptimization(g);
g(); g();
%OptimizeFunctionOnNextCall(g);
g();
......@@ -1113,6 +1124,7 @@ assertEquals(undefined, arr.reduceRight(function(val) { return val }));
done = true;
assertEquals(null, g());
done = false;
%PrepareFunctionForOptimization(g);
g(); g();
%OptimizeFunctionOnNextCall(g);
g();
......@@ -1145,6 +1157,7 @@ assertEquals(undefined, arr.reduceRight(function(val) { return val }));
done = true;
assertEquals(null, g());
done = false;
%PrepareFunctionForOptimization(g);
g(); g();
%OptimizeFunctionOnNextCall(g);
g();
......@@ -1178,6 +1191,7 @@ assertEquals(undefined, arr.reduceRight(function(val) { return val }));
done = true;
assertEquals(null, g());
done = false;
%PrepareFunctionForOptimization(g);
g(); g();
%OptimizeFunctionOnNextCall(g);
g();
......@@ -1231,6 +1245,7 @@ assertEquals(undefined, arr.reduceRight(function(val) { return val }));
done = true;
assertEquals(null, g());
done = false;
%PrepareFunctionForOptimization(g);
g(); g();
%OptimizeFunctionOnNextCall(g);
g();
......@@ -1266,6 +1281,7 @@ assertEquals(undefined, arr.reduceRight(function(val) { return val }));
done = true;
assertEquals(null, g());
done = false;
%PrepareFunctionForOptimization(g);
g(); g();
%OptimizeFunctionOnNextCall(g);
g();
......
......@@ -82,6 +82,7 @@ failWithMessage = (msg) => %AbortJS(msg);
function foo() {
return new Promise((a, b) => { throw new Error(); });
}
%PrepareFunctionForOptimization(foo);
function bar(i) {
let error = null;
......
......@@ -19,6 +19,7 @@ foo(function(){});
foo(function(){});
%OptimizeFunctionOnNextCall(foo);
foo(function(){});
%PrepareFunctionForOptimization(foo);
%OptimizeFunctionOnNextCall(foo);
foo(function(){});
assertOptimized(foo);
......@@ -23,6 +23,7 @@ foo([0, 1, 2]);
foo([0, 1, 2]);
%OptimizeFunctionOnNextCall(foo);
foo([0, 1, 2]);
%PrepareFunctionForOptimization(foo);
%OptimizeFunctionOnNextCall(foo);
foo([0, 1, 2]);
assertOptimized(foo);
......@@ -29,6 +29,7 @@
// Verifies that closures in presence of eval work fine.
function withEval(expr, filter) {
%PrepareFunctionForOptimization(filter);
function walk(v) {
for (var i in v) {
for (var i in v) {}
......
......@@ -37,6 +37,7 @@ function test(f, iterations) {
for (let i = 0; i < n; i++) {
%OptimizeFunctionOnNextCall(f);
f();
%PrepareFunctionForOptimization(f);
}
// Assert that the function finally stabilized.
assertOptimized(f);
......
......@@ -233,12 +233,12 @@ convert_to_fast(smis);
convert_to_fast(doubles);
// Test transition chain SMI->DOUBLE->FAST (crankshafted function will
// transition to FAST directly).
%EnsureFeedbackVectorForFunction(convert_mixed);
function convert_mixed(array, value, kind) {
array[1] = value;
assertKind(kind, array);
assertEquals(value, array[1]);
}
%PrepareFunctionForOptimization(convert_mixed);
smis = construct_smis();
for (var i = 0; i < 3; i++) {
convert_mixed(smis, 1.5, elements_kind.fast_double);
......
......@@ -32,10 +32,10 @@ var test_id = 0;
function testTrunc(expected, input) {
var test = new Function('n',
'"' + (test_id++) + '";return Math.trunc(n)');
%PrepareFunctionForOptimization(test);
assertEquals(expected, test(input));
assertEquals(expected, test(input));
assertEquals(expected, test(input));
%PrepareFunctionForOptimization(test);
%OptimizeFunctionOnNextCall(test);
assertEquals(expected, test(input));
......
......@@ -9,6 +9,7 @@ var test_id = 0;
function testCeil(expect, input) {
var test = new Function('n',
'"' + (test_id++) + '";return Math.ceil(n)');
%PrepareFunctionForOptimization(test);
assertEquals(expect, test(input));
assertEquals(expect, test(input));
assertEquals(expect, test(input));
......
......@@ -190,6 +190,8 @@ function TestAllScenarios(f) {
%DeoptimizeFunction(AssignStrict);
%ClearFunctionFeedback(Assign);
%ClearFunctionFeedback(AssignStrict);
%PrepareFunctionForOptimization(Assign);
%PrepareFunctionForOptimization(AssignStrict);
for (var i = 0; i < t; ++i) {
var o = create();
assertFalse("a" in o && !("a" in o.__proto__));
......
......@@ -32,6 +32,7 @@ function __f_4(i1) {
};
%PrepareFunctionForOptimization(__f_4);
function __f_3(i1) {
%PrepareFunctionForOptimization(__f_4);
__f_4(i1);
__f_4(i1 + 16);
__f_4(i1 + 32);
......
......@@ -36,6 +36,7 @@ function sum(a, b) {
};
%PrepareFunctionForOptimization(sum);
function test(x, y, expectNaN) {
%PrepareFunctionForOptimization(sum);
for (var i = 0; i < 5; i++) {
assertEquals(expectNaN, isNaN(sum(x, y)));
}
......
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