Commit 22d8d3be authored by Jakob Gruber's avatar Jakob Gruber Committed by V8 LUCI CQ

Remove OptimizeFunctionForTopTier

It's no longer needed.

Bug: v8:12552
Change-Id: I3522ab621001ee07ce7037888934279e4050dea9
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3484318
Auto-Submit: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#79235}
parent b7b79ad8
......@@ -433,32 +433,6 @@ RUNTIME_FUNCTION(Runtime_PrepareFunctionForOptimization) {
return ReadOnlyRoots(isolate).undefined_value();
}
RUNTIME_FUNCTION(Runtime_OptimizeFunctionForTopTier) {
// TODO(rmcilroy): Ideally this should be rolled into
// OptimizeFunctionOnNextCall, but there is no way to mark the tier to be
// optimized using the regular optimization marking system.
HandleScope scope(isolate);
if (args.length() != 1) {
return CrashUnlessFuzzing(isolate);
}
CONVERT_ARG_HANDLE_CHECKED(Object, function_object, 0);
if (!function_object->IsJSFunction()) return CrashUnlessFuzzing(isolate);
Handle<JSFunction> function = Handle<JSFunction>::cast(function_object);
IsCompiledScope is_compiled_scope(
function->shared().is_compiled_scope(isolate));
if (!CanOptimizeFunction(function, isolate,
TierupKind::kTierupBytecodeOrMidTier,
&is_compiled_scope)) {
return ReadOnlyRoots(isolate).undefined_value();
}
Compiler::CompileOptimized(isolate, function, ConcurrencyMode::kNotConcurrent,
CodeKindForTopTier());
return ReadOnlyRoots(isolate).undefined_value();
}
RUNTIME_FUNCTION(Runtime_OptimizeOsr) {
HandleScope handle_scope(isolate);
DCHECK(args.length() == 0 || args.length() == 1);
......
......@@ -529,7 +529,6 @@ namespace internal {
F(NeverOptimizeFunction, 1, 1) \
F(NewRegExpWithBacktrackLimit, 3, 1) \
F(NotifyContextDisposed, 0, 1) \
F(OptimizeFunctionForTopTier, 1, 1) \
F(OptimizeFunctionOnNextCall, -1, 1) \
F(OptimizeOsr, -1, 1) \
F(PrepareFunctionForOptimization, -1, 1) \
......
......@@ -14,7 +14,7 @@
%PrepareFunctionForOptimization(foo);
assertFalse(foo());
assertFalse(foo());
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
assertFalse(foo());
})();
......@@ -28,7 +28,7 @@
%PrepareFunctionForOptimization(foo);
assertFalse(foo());
assertFalse(foo());
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
assertFalse(foo());
})();
......@@ -42,7 +42,7 @@
%PrepareFunctionForOptimization(foo);
assertFalse(foo());
assertFalse(foo());
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
assertFalse(foo());
})();
......@@ -56,7 +56,7 @@
%PrepareFunctionForOptimization(foo);
assertFalse(foo());
assertFalse(foo());
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
assertFalse(foo());
})();
......@@ -70,7 +70,7 @@
%PrepareFunctionForOptimization(foo);
assertFalse(foo());
assertFalse(foo());
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
assertFalse(foo());
})();
......@@ -86,7 +86,7 @@
assertFalse(foo(a));
assertTrue(foo(b));
assertFalse(foo(a));
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
assertTrue(foo(b));
assertFalse(foo(a));
......@@ -107,7 +107,7 @@
assertFalse(foo(a));
assertTrue(foo(b));
assertFalse(foo(a));
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
assertTrue(foo(b));
assertFalse(foo(a));
......@@ -128,7 +128,7 @@
assertFalse(foo(a));
assertTrue(foo(b));
assertFalse(foo(a));
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
assertTrue(foo(b));
assertFalse(foo(a));
......@@ -149,7 +149,7 @@
assertFalse(foo(a));
assertTrue(foo(b));
assertFalse(foo(a));
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
assertTrue(foo(b));
assertFalse(foo(a));
assertTrue(foo(null));
......@@ -173,7 +173,7 @@
assertFalse(foo(a));
assertTrue(foo(b));
assertFalse(foo(a));
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
assertTrue(foo(b));
assertFalse(foo(a));
assertTrue(foo(null));
......
......@@ -38,7 +38,7 @@
assertTrue(sum_js_got_interpreted);
// The protector should be invalidated, which prevents inlining.
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
assertEquals('AxB', foo('A', 'B'));
assertTrue(sum_js_got_interpreted);
assertOptimized(foo);
......
......@@ -38,7 +38,7 @@
assertEquals('AundefinedB', foo('A', 'B'));
assertTrue(sum_js_got_interpreted);
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
assertEquals('AundefinedB', foo('A', 'B'));
assertFalse(sum_js_got_interpreted);
assertOptimized(foo);
......@@ -49,7 +49,7 @@
// Now the call will not be inlined.
%PrepareFunctionForOptimization(foo);
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
assertEquals('AxB', foo('A', 'B'));
assertTrue(sum_js_got_interpreted);
assertOptimized(foo);
......
......@@ -42,7 +42,7 @@
assertTrue(sum_js_got_interpreted);
// Compile function foo; inlines 'sum_js' into 'foo'.
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
assertEquals(78, foo(26, 6, 46, null));
assertOptimized(foo);
%PrepareFunctionForOptimization(foo);
......
......@@ -49,8 +49,8 @@
assertTrue(log_got_interpreted);
// Compile foo.
%OptimizeFunctionForTopTier(log);
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(log);
%OptimizeFunctionOnNextCall(foo);
assertEquals(42, foo());
// The call with spread should not have been inlined, because of the
// generator/iterator.
......
......@@ -49,8 +49,8 @@
assertTrue(log_got_interpreted);
// Compile foo.
%OptimizeFunctionForTopTier(log);
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(log);
%OptimizeFunctionOnNextCall(foo);
assertEquals(42, foo());
// The call with spread should not have been inlined, because of the
// generator/iterator.
......
......@@ -41,8 +41,8 @@
assertTrue(log_got_interpreted);
// Compile foo.
%OptimizeFunctionForTopTier(log);
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(log);
%OptimizeFunctionOnNextCall(foo);
assertEquals(1, foo());
// The call with spread should have been inlined.
assertFalse(log_got_interpreted);
......@@ -63,7 +63,7 @@
// Recompile 'foo'.
%PrepareFunctionForOptimization(foo);
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
assertEquals(42, foo());
// The call with spread will not be inlined because we have redefined the
// array iterator.
......
......@@ -34,7 +34,7 @@
%PrepareFunctionForOptimization(sum_js);
%PrepareFunctionForOptimization(foo);
assertEquals('abc', foo('a', 'b', 'c'));
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
assertTrue(sum_js_got_interpreted);
assertEquals('abc', foo('a', 'b', 'c'));
assertOptimized(foo);
......@@ -74,7 +74,7 @@
%PrepareFunctionForOptimization(sum_js);
%PrepareFunctionForOptimization(foo);
assertEquals('AundefinedB', foo('A', 'B'));
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
assertTrue(sum_js_got_interpreted);
assertEquals('AundefinedB', foo('A', 'B'));
assertFalse(sum_js_got_interpreted);
......@@ -96,7 +96,7 @@
%PrepareFunctionForOptimization(sum_js);
%PrepareFunctionForOptimization(foo);
assertEquals(45.31, foo(16.11, 26.06));
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
assertTrue(sum_js_got_interpreted);
// This is expected to deoptimize
......@@ -107,7 +107,7 @@
// Optimize again
%PrepareFunctionForOptimization(foo);
assertEquals(45.31, foo(16.11, 26.06));
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
assertTrue(sum_js_got_interpreted);
// This should stay optimized, but with the call not inlined.
......@@ -134,7 +134,7 @@
%PrepareFunctionForOptimization(foo);
// Here array size changes.
assertEquals('abc', foo('a', 'b', 'c'));
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
assertTrue(sum_js_got_interpreted);
// Here it should deoptimize.
assertEquals('abc', foo('a', 'b', 'c'));
......@@ -142,7 +142,7 @@
assertTrue(sum_js_got_interpreted);
// Now speculation mode prevents the optimization.
%PrepareFunctionForOptimization(foo);
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
assertEquals('abc', foo('a', 'b', 'c'));
assertTrue(sum_js_got_interpreted);
assertOptimized(foo);
......@@ -163,7 +163,7 @@
%PrepareFunctionForOptimization(sum_js);
%PrepareFunctionForOptimization(foo);
assertEquals(56.34, foo(11.03, 16.11, 26.06));
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
assertTrue(sum_js_got_interpreted);
assertEquals(56.34, foo(11.03, 16.11, 26.06));
assertFalse(sum_js_got_interpreted);
......@@ -185,7 +185,7 @@
%PrepareFunctionForOptimization(fortytwo);
%PrepareFunctionForOptimization(foo);
assertEquals(42, foo());
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
assertTrue(got_interpreted);
assertEquals(42, foo());
assertFalse(got_interpreted);
......@@ -212,7 +212,7 @@
%PrepareFunctionForOptimization(fortytwo);
%PrepareFunctionForOptimization(foo);
assertEquals(44, foo());
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
assertTrue(got_interpreted);
assertEquals(44, foo());
assertTrue(got_interpreted);
......@@ -239,7 +239,7 @@
%PrepareFunctionForOptimization(sum_js);
%PrepareFunctionForOptimization(foo);
assertEquals('abc', foo('a', 'b', 'c'));
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
assertTrue(sum_js_got_interpreted);
assertEquals('abc', foo('a', 'b', 'c'));
assertFalse(sum_js_got_interpreted);
......@@ -261,7 +261,7 @@
%PrepareFunctionForOptimization(fortytwo);
%PrepareFunctionForOptimization(foo);
assertEquals(42, foo());
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
assertTrue(got_interpreted);
assertEquals(42, foo());
assertFalse(got_interpreted);
......@@ -288,7 +288,7 @@
%PrepareFunctionForOptimization(fortytwo);
%PrepareFunctionForOptimization(foo);
assertEquals(44, foo());
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
assertTrue(got_interpreted);
assertEquals(44, foo());
assertTrue(got_interpreted);
......@@ -316,7 +316,7 @@
%PrepareFunctionForOptimization(sum_js);
%PrepareFunctionForOptimization(foo);
assertEquals('abc', foo('a', 'b', 'c'));
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
assertTrue(sum_js_got_interpreted);
assertEquals('abc', foo('a', 'b', 'c'));
assertFalse(sum_js_got_interpreted);
......@@ -339,7 +339,7 @@
%PrepareFunctionForOptimization(sum_js);
%PrepareFunctionForOptimization(foo);
assertEquals('abc', foo('a', 'b', 'c'));
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
assertTrue(sum_js_got_interpreted);
assertEquals('abc', foo('a', 'b', 'c'));
assertFalse(sum_js_got_interpreted);
......@@ -365,7 +365,7 @@
%PrepareFunctionForOptimization(max);
%PrepareFunctionForOptimization(foo);
assertEquals(5, foo(1, 2, 3));
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
assertTrue(max_got_interpreted);
assertEquals(5, foo(1, 2, 3));
assertTrue(max_got_interpreted);
......@@ -394,7 +394,7 @@
%PrepareFunctionForOptimization(sum_js);
%PrepareFunctionForOptimization(foo);
assertEquals('abccba', foo('a', 'b', 'c'));
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
assertTrue(sum_js_got_interpreted);
assertEquals('abccba', foo('a', 'b', 'c'));
assertFalse(sum_js_got_interpreted);
......@@ -421,7 +421,7 @@
len = 0;
%PrepareFunctionForOptimization(foo);
assertEquals(3, foo(1, 2, 3));
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
assertEquals(3, foo(1, 2, 3));
assertOptimized(foo);
// Deoptimize when input of Math.max is not number
......@@ -432,7 +432,7 @@
len = 2;
%PrepareFunctionForOptimization(foo1);
assertEquals(3, foo1(1, 2, 3));
%OptimizeFunctionForTopTier(foo1);
%OptimizeFunctionOnNextCall(foo1);
assertEquals(3, foo1(1, 2, 3));
//Deoptimize when array length changes
assertUnoptimized(foo1);
......@@ -458,7 +458,7 @@
len = 0;
%PrepareFunctionForOptimization(foo);
assertEquals(2, foo(1, 2, 3));
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
assertEquals(2, foo(1, 2, 3));
assertOptimized(foo);
// Deoptimzie when input of Math.max is not number
......@@ -469,7 +469,7 @@
len = 2;
%PrepareFunctionForOptimization(foo1);
assertEquals(3, foo1(1, 2, 3));
%OptimizeFunctionForTopTier(foo1);
%OptimizeFunctionOnNextCall(foo1);
assertEquals(3, foo1(1, 2, 3));
assertOptimized(foo1);
// No Deoptimization when array length changes
......@@ -497,8 +497,8 @@
%PrepareFunctionForOptimization(foo_closure);
%PrepareFunctionForOptimization(foo);
assertEquals('abc', foo('a', 'b', 'c'));
%OptimizeFunctionForTopTier(foo_closure);
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo_closure);
%OptimizeFunctionOnNextCall(foo);
assertTrue(sum_got_interpreted);
assertEquals('abc', foo('a', 'b', 'c'));
assertFalse(sum_got_interpreted);
......@@ -523,7 +523,7 @@
assertEquals(166, foo(40, 42, 44));
assertTrue(sum_got_interpreted);
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
assertEquals(166, foo(40, 42, 44));
assertFalse(sum_got_interpreted);
assertOptimized(foo);
......@@ -547,7 +547,7 @@
assertEquals(166, foo(40, 42, 44));
assertTrue(sum_got_interpreted);
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
assertEquals(166, foo(40, 42, 44));
assertFalse(sum_got_interpreted);
assertOptimized(foo);
......@@ -570,7 +570,7 @@
assertEquals('42abc', foo('a', 'b', 'c'));
assertTrue(sum_got_interpreted);
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
assertEquals('42abc', foo('a', 'b', 'c'));
assertFalse(sum_got_interpreted);
assertOptimized(foo);
......@@ -593,7 +593,7 @@
assertEquals('45abc', foo('a', 'b', 'c'));
assertTrue(sum_got_interpreted);
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
assertEquals('45abc', foo('a', 'b', 'c'));
assertFalse(sum_got_interpreted);
assertOptimized(foo);
......@@ -614,7 +614,7 @@
%PrepareFunctionForOptimization(sum_js);
%PrepareFunctionForOptimization(foo);
assertEquals('ABundefined3', foo('A', 'B'));
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
assertTrue(sum_js_got_interpreted);
assertEquals('ABundefined3', foo('A', 'B'));
assertFalse(sum_js_got_interpreted);
......@@ -636,7 +636,7 @@
%PrepareFunctionForOptimization(sum_js);
%PrepareFunctionForOptimization(foo);
assertEquals('abc6', foo('a', 'b', 'c', 'd', 'e'));
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
assertTrue(sum_js_got_interpreted);
assertEquals('abc6', foo('a', 'b', 'c', 'd', 'e'));
assertFalse(sum_js_got_interpreted);
......@@ -659,7 +659,7 @@
%PrepareFunctionForOptimization(sum_js);
%PrepareFunctionForOptimization(foo);
assertEquals('ABundefined3', foo('A', 'B'));
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
assertTrue(sum_js_got_interpreted);
assertEquals('ABundefined3', foo('A', 'B'));
assertFalse(sum_js_got_interpreted);
......@@ -682,7 +682,7 @@
%PrepareFunctionForOptimization(sum_js);
%PrepareFunctionForOptimization(foo);
assertEquals('abc6', foo('a', 'b', 'c', 'd', 'e'));
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
assertTrue(sum_js_got_interpreted);
assertEquals('abc6', foo('a', 'b', 'c', 'd', 'e'));
assertFalse(sum_js_got_interpreted);
......@@ -704,7 +704,7 @@
%PrepareFunctionForOptimization(sum_js);
%PrepareFunctionForOptimization(foo);
assertEquals('abcde', foo('a', 'b', 'c', 'd', 'e'));
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
assertTrue(sum_js_got_interpreted);
assertEquals('abcde', foo('a', 'b', 'c', 'd', 'e'));
assertFalse(sum_js_got_interpreted);
......@@ -729,7 +729,7 @@
assertTrue(sum_js_got_interpreted);
// The call is not inlined with CreateArguments.
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
assertEquals('abc', foo('a', 'b', 'c'));
assertTrue(sum_js_got_interpreted);
assertOptimized(foo);
......@@ -757,7 +757,7 @@
assertTrue(sum_js_got_interpreted);
// Optimization also works if the call is in an inlined function.
%OptimizeFunctionForTopTier(bar);
%OptimizeFunctionOnNextCall(bar);
assertEquals('cba', bar('a', 'b', 'c'));
assertFalse(sum_js_got_interpreted);
assertOptimized(bar);
......
......@@ -31,7 +31,7 @@ function boom() {
foo();
foo();
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
foo();
})();
......@@ -62,6 +62,6 @@ function boom() {
foo();
foo();
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
foo();
})();
......@@ -22,5 +22,5 @@ function foo() { return %TurbofanStaticAssert(bar(global)); }
bar({gaga() {}});
foo();
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
foo();
......@@ -22,5 +22,5 @@ function foo(obj) { obj.gaga; %TurbofanStaticAssert(bar(obj)); }
bar({gaga() {}});
foo(global);
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
foo(global);
......@@ -12,6 +12,6 @@ function foo(x) {
%PrepareFunctionForOptimization(foo);
foo(121);
foo(122);
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
foo(123);
})();
......@@ -12,7 +12,7 @@
%PrepareFunctionForOptimization(foo);
assertEquals(1, foo());
assertEquals(1, foo());
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
assertEquals(1, foo());
assertOptimized(foo);
a.length = 1;
......@@ -28,7 +28,7 @@
%PrepareFunctionForOptimization(foo);
assertEquals(1, foo());
assertEquals(1, foo());
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
assertEquals(1, foo());
assertOptimized(foo);
a[0] = 42;
......@@ -44,7 +44,7 @@
%PrepareFunctionForOptimization(foo);
assertEquals(1, foo());
assertEquals(1, foo());
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
assertEquals(1, foo());
assertOptimized(foo);
a[0] = 42;
......@@ -58,7 +58,7 @@
%PrepareFunctionForOptimization(foo);
assertEquals(1, foo());
assertEquals(1, foo());
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
assertEquals(1, foo());
assertOptimized(foo);
a[0] = 42;
......@@ -72,7 +72,7 @@
%PrepareFunctionForOptimization(foo);
assertEquals(1, foo());
assertEquals(1, foo());
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
assertEquals(1, foo());
assertOptimized(foo);
a[0] = 42;
......@@ -87,7 +87,7 @@
%PrepareFunctionForOptimization(foo);
assertEquals(1, foo());
assertEquals(1, foo());
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
assertEquals(1, foo());
assertOptimized(foo);
a[0] = 42;
......@@ -101,7 +101,7 @@
%PrepareFunctionForOptimization(foo);
assertEquals(1, foo());
assertEquals(1, foo());
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
assertEquals(1, foo());
assertOptimized(foo);
a[0] = 42;
......@@ -115,7 +115,7 @@
%PrepareFunctionForOptimization(foo);
assertEquals(1, foo());
assertEquals(1, foo());
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
assertEquals(1, foo());
assertOptimized(foo);
a[0] = 42;
......
......@@ -30,5 +30,5 @@ bar({aaaa:1});
bar({aaaaa:1});
foo();
foo();
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
foo();
......@@ -26,5 +26,5 @@ bar({aaaa:1});
bar({aaaaa:1});
foo();
foo();
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
foo();
......@@ -25,5 +25,5 @@ new class extends C { constructor() { super(); this.c = 1 } }
new class extends C { constructor() { super(); this.d = 1 } }
foo();
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
foo();
......@@ -18,5 +18,5 @@ function foo(cond, v1, v2) {
%PrepareFunctionForOptimization(foo);
foo(1, 10, 20); foo(2, 30, 40);
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
foo(1, 10, 20); foo(2, 30, 40);
......@@ -19,7 +19,7 @@ inline_polymorphic(make_closure());
// Compile using top tier since we need value numbering phase for the
// TurbofanStaticAssert to deduce answer is 42 at compile time. In Turboprop
// this phase is disabled.
%OptimizeFunctionForTopTier(inline_polymorphic);
%OptimizeFunctionOnNextCall(inline_polymorphic);
inline_polymorphic(make_closure());
try {
......
......@@ -13,5 +13,5 @@ function foo() { return %IsBeingInterpreted(); }
assertTrue(bar());
assertTrue(bar());
%OptimizeFunctionForTopTier(bar);
%OptimizeFunctionOnNextCall(bar);
assertFalse(bar());
......@@ -13,5 +13,5 @@ function foo() { return %IsBeingInterpreted(); }
assertTrue(bar());
assertTrue(bar());
%OptimizeFunctionForTopTier(bar);
%OptimizeFunctionOnNextCall(bar);
assertTrue(bar());
......@@ -37,5 +37,5 @@ function main() {
main();
main();
%OptimizeFunctionForTopTier(main);
%OptimizeFunctionOnNextCall(main);
main();
......@@ -29,5 +29,5 @@ bar({aaaa:1});
bar({aaaaa:1});
foo();
foo();
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
foo();
......@@ -30,7 +30,7 @@
%PrepareFunctionForOptimization(lit_const_smi);
lit_const_smi(); lit_const_smi();
%OptimizeFunctionForTopTier(lit_const_smi); lit_const_smi();
%OptimizeFunctionOnNextCall(lit_const_smi); lit_const_smi();
function lit_const_object() {
......@@ -46,7 +46,7 @@
%PrepareFunctionForOptimization(lit_const_object);
lit_const_object(); lit_const_object();
%OptimizeFunctionForTopTier(lit_const_object); lit_const_object();
%OptimizeFunctionOnNextCall(lit_const_object); lit_const_object();
function lit_computed_smi(k) {
......@@ -62,11 +62,11 @@
%PrepareFunctionForOptimization(lit_computed_smi);
lit_computed_smi(1); lit_computed_smi(2);
%OptimizeFunctionForTopTier(lit_computed_smi); lit_computed_smi(3);
%OptimizeFunctionOnNextCall(lit_computed_smi); lit_computed_smi(3);
// TODO(bmeurer): Fix const tracking for double fields in object literals
// lit_computed_smi(1.1); lit_computed_smi(2.2);
// %OptimizeFunctionForTopTier(lit_computed_smi); lit_computed_smi(3.3);
// %OptimizeFunctionOnNextCall(lit_computed_smi); lit_computed_smi(3.3);
function lit_param_object(k) {
......@@ -81,7 +81,7 @@
%PrepareFunctionForOptimization(lit_param_object);
lit_param_object({x: 1}); lit_param_object({x: 2});
%OptimizeFunctionForTopTier(lit_param_object); lit_param_object({x: 3});
%OptimizeFunctionOnNextCall(lit_param_object); lit_param_object({x: 3});
function nested_lit_param(k) {
......@@ -96,11 +96,11 @@
%PrepareFunctionForOptimization(nested_lit_param);
nested_lit_param(1); nested_lit_param(2);
%OptimizeFunctionForTopTier(nested_lit_param); nested_lit_param(3);
%OptimizeFunctionOnNextCall(nested_lit_param); nested_lit_param(3);
// TODO(bmeurer): Fix const tracking for double fields in object literals
// nested_lit_param(1.1); nested_lit_param(2.2);
// %OptimizeFunctionForTopTier(nested_lit_param); nested_lit_param(3.3);
// %OptimizeFunctionOnNextCall(nested_lit_param); nested_lit_param(3.3);
function nested_lit_param_object(k) {
......@@ -115,7 +115,7 @@
%PrepareFunctionForOptimization(nested_lit_param_object);
nested_lit_param_object({x: 1}); nested_lit_param_object({x: 2});
%OptimizeFunctionForTopTier(nested_lit_param_object);
%OptimizeFunctionOnNextCall(nested_lit_param_object);
nested_lit_param_object({x: 3});
......@@ -138,16 +138,16 @@
%PrepareFunctionForOptimization(inst_param);
inst_param(1); inst_param(2);
%OptimizeFunctionForTopTier(inst_param); inst_param(3);
%OptimizeFunctionOnNextCall(inst_param); inst_param(3);
// TODO(gsps): Reenable once we fully support const field information
// tracking in the presence of pointer compression.
// inst_param(1.1); inst_param(2.2);
// %OptimizeFunctionForTopTier(inst_param); inst_param(3.3);
// %OptimizeFunctionOnNextCall(inst_param); inst_param(3.3);
%PrepareFunctionForOptimization(inst_param);
inst_param({x: 1}); inst_param({x: 2});
%OptimizeFunctionForTopTier(inst_param); inst_param({x: 3});
%OptimizeFunctionOnNextCall(inst_param); inst_param({x: 3});
function inst_computed(k) {
......@@ -168,9 +168,9 @@
%PrepareFunctionForOptimization(inst_computed);
inst_computed(1); inst_computed(2);
%OptimizeFunctionForTopTier(inst_computed); inst_computed(3);
%OptimizeFunctionOnNextCall(inst_computed); inst_computed(3);
%PrepareFunctionForOptimization(inst_computed);
inst_computed(1.1); inst_computed(2.2);
%OptimizeFunctionForTopTier(inst_computed); inst_computed(3.3);
%OptimizeFunctionOnNextCall(inst_computed); inst_computed(3.3);
})();
......@@ -22,7 +22,7 @@ function TestFunctionPrototypeApply(x) {
%PrepareFunctionForOptimization(TestFunctionPrototypeApply);
assertEquals(TestFunctionPrototypeApply(-13), 13);
assertEquals(TestFunctionPrototypeApply(42), 42);
%OptimizeFunctionForTopTier(TestFunctionPrototypeApply);
%OptimizeFunctionOnNextCall(TestFunctionPrototypeApply);
assertEquals(TestFunctionPrototypeApply(-13), 13);
assertOptimized(TestFunctionPrototypeApply);
TestFunctionPrototypeApply("abc");
......@@ -39,7 +39,7 @@ function TestFunctionPrototypeApplyReceiver(func, x, y) {
%PrepareFunctionForOptimization(TestFunctionPrototypeApplyReceiver);
assertEquals(-13, TestFunctionPrototypeApplyReceiver(MathMin, -13, 42));
assertEquals(-4, TestFunctionPrototypeApplyReceiver(MathMin, 3, -4));
%OptimizeFunctionForTopTier(TestFunctionPrototypeApplyReceiver);
%OptimizeFunctionOnNextCall(TestFunctionPrototypeApplyReceiver);
assertEquals(7, TestFunctionPrototypeApplyReceiver(MathMin, 7, 9));
assertOptimized(TestFunctionPrototypeApplyReceiver);
TestFunctionPrototypeApplyReceiver(MathMin, "abc");
......@@ -60,14 +60,14 @@ assertUnoptimized(TestFunctionPrototypeApplyReceiver);
%PrepareFunctionForOptimization(foo);
%PrepareFunctionForOptimization(test);
assertEquals(-13, test(-13, 42));
%OptimizeFunctionForTopTier(test);
%OptimizeFunctionOnNextCall(test);
assertEquals(-13, test(-13, 42));
assertOptimized(test);
%PrepareFunctionForOptimization(test);
F = Math.max;
assertEquals(42, test(-13, 42));
assertUnoptimized(test);
%OptimizeFunctionForTopTier(test);
%OptimizeFunctionOnNextCall(test);
assertEquals(42, test(-13, 42));
F = Math.min;
assertEquals(-13, test(-13, 42));
......@@ -82,7 +82,7 @@ function TestFunctionPrototypeCall(x) {
%PrepareFunctionForOptimization(TestFunctionPrototypeCall);
TestFunctionPrototypeCall(42);
TestFunctionPrototypeCall(52);
%OptimizeFunctionForTopTier(TestFunctionPrototypeCall);
%OptimizeFunctionOnNextCall(TestFunctionPrototypeCall);
TestFunctionPrototypeCall(12);
assertOptimized(TestFunctionPrototypeCall);
TestFunctionPrototypeCall("abc");
......@@ -97,7 +97,7 @@ function TestArrayForEach(x) {
%PrepareFunctionForOptimization(TestArrayForEach);
TestArrayForEach([1, 3, -4]);
TestArrayForEach([-9, 9, 0]);
%OptimizeFunctionForTopTier(TestArrayForEach);
%OptimizeFunctionOnNextCall(TestArrayForEach);
TestArrayForEach([1, 3, -4]);
assertOptimized(TestArrayForEach);
TestArrayForEach(["abc", "xy"]);
......@@ -112,7 +112,7 @@ function TestArrayReduce(x) {
%PrepareFunctionForOptimization(TestArrayReduce);
assertEquals(TestArrayReduce([1, 2, -3, 4]), -24);
assertEquals(TestArrayReduce([3, 5, 7]), 105);
%OptimizeFunctionForTopTier(TestArrayReduce);
%OptimizeFunctionOnNextCall(TestArrayReduce);
assertEquals(TestArrayReduce([1, 2, -3, 4]), -24);
assertOptimized(TestArrayReduce);
TestArrayReduce(["abc", "xy"]);
......@@ -127,7 +127,7 @@ function TestArrayReduceRight(x) {
%PrepareFunctionForOptimization(TestArrayReduceRight);
assertEquals(TestArrayReduceRight([1, 2, -3, 4]), -24);
assertEquals(TestArrayReduceRight([3, 5, 7]), 105);
%OptimizeFunctionForTopTier(TestArrayReduceRight);
%OptimizeFunctionOnNextCall(TestArrayReduceRight);
assertEquals(TestArrayReduceRight([1, 2, -3, 4]), -24);
assertOptimized(TestArrayReduceRight);
TestArrayReduceRight(["abc", "xy"]);
......@@ -142,7 +142,7 @@ function TestArrayMap(x) {
%PrepareFunctionForOptimization(TestArrayMap);
assertEquals(TestArrayMap([1, -2, -3, 4]), [1, 2, 3, 4]);
assertEquals(TestArrayMap([5, -5, 5, -5]), [5, 5, 5, 5]);
%OptimizeFunctionForTopTier(TestArrayMap);
%OptimizeFunctionOnNextCall(TestArrayMap);
assertEquals(TestArrayMap([1, -2, 3, -4]), [1, 2, 3, 4]);
assertOptimized(TestArrayMap);
TestArrayMap(["abc", "xy"]);
......@@ -157,7 +157,7 @@ function TestArrayFilter(x) {
%PrepareFunctionForOptimization(TestArrayFilter);
assertEquals(TestArrayFilter([-2, 0, 3, -4]), [-2, 3, -4]);
assertEquals(TestArrayFilter([0, 1, 1, 0]), [1, 1]);
%OptimizeFunctionForTopTier(TestArrayFilter);
%OptimizeFunctionOnNextCall(TestArrayFilter);
assertEquals(TestArrayFilter([-2, 0, 3, -4]), [-2, 3, -4]);
assertOptimized(TestArrayFilter);
TestArrayFilter(["abc", "xy"]);
......@@ -172,7 +172,7 @@ function TestArrayFind(x) {
%PrepareFunctionForOptimization(TestArrayFind);
assertEquals(TestArrayFind([0, 0, -3, 12]), -3);
assertEquals(TestArrayFind([0, -18]), -18);
%OptimizeFunctionForTopTier(TestArrayFind);
%OptimizeFunctionOnNextCall(TestArrayFind);
assertEquals(TestArrayFind([0, 0, -3, 12]), -3);
assertOptimized(TestArrayFind);
TestArrayFind(["", "abc", "xy"]);
......@@ -187,7 +187,7 @@ function TestArrayFindIndex(x) {
%PrepareFunctionForOptimization(TestArrayFindIndex);
assertEquals(TestArrayFindIndex([0, 0, -3, 12]), 2);
assertEquals(TestArrayFindIndex([0, -18]), 1);
%OptimizeFunctionForTopTier(TestArrayFindIndex);
%OptimizeFunctionOnNextCall(TestArrayFindIndex);
assertEquals(TestArrayFindIndex([0, 0, -3, 12]), 2);
assertOptimized(TestArrayFindIndex);
TestArrayFindIndex(["", "abc", "xy"]);
......@@ -202,7 +202,7 @@ function TestArrayEvery(x) {
%PrepareFunctionForOptimization(TestArrayEvery);
assertEquals(TestArrayEvery([3, 0, -9]), false);
assertEquals(TestArrayEvery([2, 12, -1]), true);
%OptimizeFunctionForTopTier(TestArrayEvery);
%OptimizeFunctionOnNextCall(TestArrayEvery);
assertEquals(TestArrayEvery([3, 0, -9]), false);
assertOptimized(TestArrayEvery);
TestArrayEvery(["abc", "xy"]);
......@@ -217,7 +217,7 @@ function TestArraySome(x) {
%PrepareFunctionForOptimization(TestArraySome);
assertEquals(TestArraySome([3, 0, -9]), true);
assertEquals(TestArraySome([0, 0]), false);
%OptimizeFunctionForTopTier(TestArraySome);
%OptimizeFunctionOnNextCall(TestArraySome);
assertEquals(TestArraySome([3, 0, -9]), true);
assertOptimized(TestArraySome);
TestArraySome(["abc", "xy"]);
......@@ -233,7 +233,7 @@ function TestJSCallWithJSFunction(x) {
%PrepareFunctionForOptimization(TestJSCallWithJSFunction);
assertEquals(TestJSCallWithJSFunction(-14), 42);
assertEquals(TestJSCallWithJSFunction(14), -42);
%OptimizeFunctionForTopTier(TestJSCallWithJSFunction);
%OptimizeFunctionOnNextCall(TestJSCallWithJSFunction);
assertEquals(TestJSCallWithJSFunction(-14), 42);
assertOptimized(TestJSCallWithJSFunction);
TestJSCallWithJSFunction("abc");
......@@ -248,7 +248,7 @@ function TestJSCallWithJSBoundFunction(x) {
%PrepareFunctionForOptimization(TestJSCallWithJSBoundFunction);
assertEquals(TestJSCallWithJSBoundFunction(-14), 42);
assertEquals(TestJSCallWithJSBoundFunction(14), -42);
%OptimizeFunctionForTopTier(TestJSCallWithJSBoundFunction);
%OptimizeFunctionOnNextCall(TestJSCallWithJSBoundFunction);
assertEquals(TestJSCallWithJSBoundFunction(-14), 42);
assertOptimized(TestJSCallWithJSBoundFunction);
TestJSCallWithJSBoundFunction("abc");
......@@ -268,7 +268,7 @@ function TestReflectApply(x) {
%PrepareFunctionForOptimization(TestReflectApply);
assertEquals(TestReflectApply(-9), 9);
assertEquals(TestReflectApply(7), 7);
%OptimizeFunctionForTopTier(TestReflectApply);
%OptimizeFunctionOnNextCall(TestReflectApply);
assertEquals(TestReflectApply(-9), 9);
assertOptimized(TestReflectApply);
TestReflectApply("abc");
......@@ -288,7 +288,7 @@ function TestCallWithSpread(x) {
%PrepareFunctionForOptimization(TestCallWithSpread);
assertEquals(TestCallWithSpread(-13), 169);
assertEquals(TestCallWithSpread(7), 49);
%OptimizeFunctionForTopTier(TestCallWithSpread);
%OptimizeFunctionOnNextCall(TestCallWithSpread);
assertEquals(TestCallWithSpread(-13), 169);
assertOptimized(TestCallWithSpread);
TestCallWithSpread("abc");
......
......@@ -21,7 +21,7 @@
%PrepareFunctionForOptimization(foo);
assertInstanceof(foo(), Promise);
assertInstanceof(foo(), Promise);
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
assertInstanceof(foo(), Promise);
assertOptimized(foo);
......@@ -57,7 +57,7 @@
%PrepareFunctionForOptimization(foo);
assertInstanceof(foo(), Promise);
assertInstanceof(foo(), Promise);
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
assertInstanceof(foo(), Promise);
assertOptimized(foo);
......
......@@ -47,7 +47,7 @@ assertOptimized(bar);
// Instead we trigger optimization of foo, which will inline bar (this time
// based on the new PACKED_ELEMENTS map.
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
foo(a);
assertOptimized(foo);
%PrepareFunctionForOptimization(foo);
......@@ -63,6 +63,6 @@ assertOptimized(bar);
// Now ensure there is no deopt-loop. There used to be a deopt-loop because, as
// a result of over-eager checkpoint elimination, we used to deopt into foo
// (right before the call to bar) rather than into bar (right before the load).
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
foo(b);
assertOptimized(foo);
......@@ -33,7 +33,7 @@ foo(a);
foo(a);
// Trigger optimization of bar, based on PACKED_SMI_ELEMENTS feedback.
%OptimizeFunctionForTopTier(bar);
%OptimizeFunctionOnNextCall(bar);
bar(a);
assertOptimized(bar);
%PrepareFunctionForOptimization(bar);
......@@ -49,7 +49,7 @@ assertOptimized(bar);
// Instead we trigger optimization of foo, which will inline bar (this time
// based on the new PACKED_ELEMENTS map.
assertOptimized(bar);
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
assertOptimized(bar);
foo(a);
assertOptimized(bar);
......@@ -66,6 +66,6 @@ assertOptimized(bar);
// Now ensure there is no deopt-loop. There used to be a deopt-loop because, as
// a result of over-eager checkpoint elimination, we used to deopt into foo
// (right before the call to bar) rather than into bar (right before the load).
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
foo(b);
assertOptimized(foo);
......@@ -38,5 +38,5 @@ function foo() {
foo();
foo();
expect_interpreted = false;
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
foo();
......@@ -23,5 +23,5 @@ function bar() {
%PrepareFunctionForOptimization(apply);
assertTrue(bar());
assertTrue(bar());
%OptimizeFunctionForTopTier(bar);
%OptimizeFunctionOnNextCall(bar);
assertFalse(bar());
......@@ -23,5 +23,5 @@ function bar() {
%PrepareFunctionForOptimization(call);
assertTrue(bar());
assertTrue(bar());
%OptimizeFunctionForTopTier(bar);
%OptimizeFunctionOnNextCall(bar);
assertFalse(bar());
......@@ -39,5 +39,5 @@ assertTrue(main(true, true));
assertTrue(main(true, true));
assertTrue(main(false, true));
assertTrue(main(false, true));
%OptimizeFunctionForTopTier(main);
%OptimizeFunctionOnNextCall(main);
assertFalse(main(false));
......@@ -37,5 +37,5 @@ assertTrue(main(true, true));
assertTrue(main(true, true));
assertTrue(main(false, true));
assertTrue(main(false, true));
%OptimizeFunctionForTopTier(main);
%OptimizeFunctionOnNextCall(main);
assertFalse(main(false));
......@@ -23,5 +23,5 @@ bar({bla: 1});
bar({blu: 1});
bar({blo: 1});
foo(obj);
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
foo(obj);
......@@ -28,5 +28,5 @@ bar({bla: 1});
bar({blu: 1});
bar({blo: 1});
foo(obj);
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
foo(obj);
......@@ -55,5 +55,5 @@ var g = new G;
foo();
foo();
expect_interpreted = false;
%OptimizeFunctionForTopTier(foo);
%OptimizeFunctionOnNextCall(foo);
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