Commit 2990658e authored by Ross McIlroy's avatar Ross McIlroy Committed by V8 LUCI CQ

[Tests] Add %OptimizeFunctionForTopTier test function

And use it to remove the set of TurboProp test skips.

BUG=v8:9684,v8:12013

Change-Id: I878e2b9c595449c954735290959d3b38eead5a5b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3043963
Commit-Queue: Ross McIlroy <rmcilroy@chromium.org>
Reviewed-by: 's avatarMythri Alle <mythria@chromium.org>
Cr-Commit-Position: refs/heads/master@{#75865}
parent c573dcc8
......@@ -42,6 +42,11 @@ V8_WARN_UNUSED_RESULT Object CrashUnlessFuzzing(Isolate* isolate) {
return ReadOnlyRoots(isolate).undefined_value();
}
V8_WARN_UNUSED_RESULT bool CrashUnlessFuzzingReturnFalse(Isolate* isolate) {
CHECK(FLAG_fuzzing);
return false;
}
// Returns |value| unless correctness-fuzzer-supressions is enabled,
// otherwise returns undefined_value.
V8_WARN_UNUSED_RESULT Object ReturnFuzzSafe(Object value, Isolate* isolate) {
......@@ -212,42 +217,35 @@ namespace {
enum class TierupKind { kTierupBytecode, kTierupBytecodeOrMidTier };
Object OptimizeFunctionOnNextCall(RuntimeArguments& args, Isolate* isolate,
TierupKind tierup_kind) {
if (args.length() != 1 && args.length() != 2) {
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);
bool CanOptimizeFunction(Handle<JSFunction> function, Isolate* isolate,
TierupKind tierup_kind,
IsCompiledScope* is_compiled_scope) {
// The following conditions were lifted (in part) from the DCHECK inside
// JSFunction::MarkForOptimization().
if (!function->shared().allows_lazy_compilation()) {
return CrashUnlessFuzzing(isolate);
return CrashUnlessFuzzingReturnFalse(isolate);
}
// If function isn't compiled, compile it now.
IsCompiledScope is_compiled_scope(
function->shared().is_compiled_scope(isolate));
if (!is_compiled_scope.is_compiled() &&
if (!is_compiled_scope->is_compiled() &&
!Compiler::Compile(isolate, function, Compiler::CLEAR_EXCEPTION,
&is_compiled_scope)) {
return CrashUnlessFuzzing(isolate);
is_compiled_scope)) {
return CrashUnlessFuzzingReturnFalse(isolate);
}
if (!FLAG_opt) return ReadOnlyRoots(isolate).undefined_value();
if (!FLAG_opt) return false;
if (function->shared().optimization_disabled() &&
function->shared().disable_optimization_reason() ==
BailoutReason::kNeverOptimize) {
return CrashUnlessFuzzing(isolate);
return CrashUnlessFuzzingReturnFalse(isolate);
}
#if V8_ENABLE_WEBASSEMBLY
if (function->shared().HasAsmWasmData()) return CrashUnlessFuzzing(isolate);
if (function->shared().HasAsmWasmData()) {
return CrashUnlessFuzzingReturnFalse(isolate);
}
#endif // V8_ENABLE_WEBASSEMBLY
if (FLAG_testing_d8_test_runner) {
......@@ -263,6 +261,26 @@ Object OptimizeFunctionOnNextCall(RuntimeArguments& args, Isolate* isolate,
if (FLAG_testing_d8_test_runner) {
PendingOptimizationTable::FunctionWasOptimized(isolate, function);
}
return false;
}
return true;
}
Object OptimizeFunctionOnNextCall(RuntimeArguments& args, Isolate* isolate,
TierupKind tierup_kind) {
if (args.length() != 1 && args.length() != 2) {
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, tierup_kind,
&is_compiled_scope)) {
return ReadOnlyRoots(isolate).undefined_value();
}
......@@ -420,6 +438,32 @@ 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 scope(isolate);
DCHECK(args.length() == 0 || args.length() == 1);
......
......@@ -531,6 +531,7 @@ namespace internal {
F(NotifyContextDisposed, 0, 1) \
F(OptimizeFunctionOnNextCall, -1, 1) \
F(TierupFunctionOnNextCall, -1, 1) \
F(OptimizeFunctionForTopTier, 1, 1) \
F(OptimizeOsr, -1, 1) \
F(NewRegExpWithBacktrackLimit, 3, 1) \
F(PrepareFunctionForOptimization, -1, 1) \
......
......@@ -14,7 +14,7 @@
%PrepareFunctionForOptimization(foo);
assertFalse(foo());
assertFalse(foo());
%OptimizeFunctionOnNextCall(foo);
%OptimizeFunctionForTopTier(foo);
assertFalse(foo());
})();
......@@ -28,7 +28,7 @@
%PrepareFunctionForOptimization(foo);
assertFalse(foo());
assertFalse(foo());
%OptimizeFunctionOnNextCall(foo);
%OptimizeFunctionForTopTier(foo);
assertFalse(foo());
})();
......@@ -42,7 +42,7 @@
%PrepareFunctionForOptimization(foo);
assertFalse(foo());
assertFalse(foo());
%OptimizeFunctionOnNextCall(foo);
%OptimizeFunctionForTopTier(foo);
assertFalse(foo());
})();
......@@ -56,7 +56,7 @@
%PrepareFunctionForOptimization(foo);
assertFalse(foo());
assertFalse(foo());
%OptimizeFunctionOnNextCall(foo);
%OptimizeFunctionForTopTier(foo);
assertFalse(foo());
})();
......@@ -70,7 +70,7 @@
%PrepareFunctionForOptimization(foo);
assertFalse(foo());
assertFalse(foo());
%OptimizeFunctionOnNextCall(foo);
%OptimizeFunctionForTopTier(foo);
assertFalse(foo());
})();
......@@ -86,7 +86,7 @@
assertFalse(foo(a));
assertTrue(foo(b));
assertFalse(foo(a));
%OptimizeFunctionOnNextCall(foo);
%OptimizeFunctionForTopTier(foo);
assertTrue(foo(b));
assertFalse(foo(a));
......@@ -107,7 +107,7 @@
assertFalse(foo(a));
assertTrue(foo(b));
assertFalse(foo(a));
%OptimizeFunctionOnNextCall(foo);
%OptimizeFunctionForTopTier(foo);
assertTrue(foo(b));
assertFalse(foo(a));
......@@ -128,7 +128,7 @@
assertFalse(foo(a));
assertTrue(foo(b));
assertFalse(foo(a));
%OptimizeFunctionOnNextCall(foo);
%OptimizeFunctionForTopTier(foo);
assertTrue(foo(b));
assertFalse(foo(a));
......@@ -149,7 +149,7 @@
assertFalse(foo(a));
assertTrue(foo(b));
assertFalse(foo(a));
%OptimizeFunctionOnNextCall(foo);
%OptimizeFunctionForTopTier(foo);
assertTrue(foo(b));
assertFalse(foo(a));
assertTrue(foo(null));
......@@ -173,7 +173,7 @@
assertFalse(foo(a));
assertTrue(foo(b));
assertFalse(foo(a));
%OptimizeFunctionOnNextCall(foo);
%OptimizeFunctionForTopTier(foo);
assertTrue(foo(b));
assertFalse(foo(a));
assertTrue(foo(null));
......
......@@ -34,7 +34,7 @@
assertTrue(sum_js_got_interpreted);
// The protector should be invalidated, which prevents inlining.
%OptimizeFunctionOnNextCall(foo);
%OptimizeFunctionForTopTier(foo);
assertEquals('AxB', foo('A', 'B'));
assertTrue(sum_js_got_interpreted);
assertOptimized(foo);
......
......@@ -34,7 +34,7 @@
assertEquals('AundefinedB', foo('A', 'B'));
assertTrue(sum_js_got_interpreted);
%OptimizeFunctionOnNextCall(foo);
%OptimizeFunctionForTopTier(foo);
assertEquals('AundefinedB', foo('A', 'B'));
assertFalse(sum_js_got_interpreted);
assertOptimized(foo);
......@@ -45,7 +45,7 @@
// Now the call will not be inlined.
%PrepareFunctionForOptimization(foo);
%OptimizeFunctionOnNextCall(foo);
%OptimizeFunctionForTopTier(foo);
assertEquals('AxB', foo('A', 'B'));
assertTrue(sum_js_got_interpreted);
assertOptimized(foo);
......
......@@ -38,7 +38,7 @@
assertTrue(sum_js_got_interpreted);
// Compile function foo; inlines 'sum_js' into 'foo'.
%OptimizeFunctionOnNextCall(foo);
%OptimizeFunctionForTopTier(foo);
assertEquals(78, foo(26, 6, 46, null));
assertOptimized(foo);
......
......@@ -45,8 +45,8 @@
assertTrue(log_got_interpreted);
// Compile foo.
%OptimizeFunctionOnNextCall(log);
%OptimizeFunctionOnNextCall(foo);
%OptimizeFunctionForTopTier(log);
%OptimizeFunctionForTopTier(foo);
assertEquals(42, foo());
// The call with spread should not have been inlined, because of the
// generator/iterator.
......
......@@ -45,8 +45,8 @@
assertTrue(log_got_interpreted);
// Compile foo.
%OptimizeFunctionOnNextCall(log);
%OptimizeFunctionOnNextCall(foo);
%OptimizeFunctionForTopTier(log);
%OptimizeFunctionForTopTier(foo);
assertEquals(42, foo());
// The call with spread should not have been inlined, because of the
// generator/iterator.
......
......@@ -37,8 +37,8 @@
assertTrue(log_got_interpreted);
// Compile foo.
%OptimizeFunctionOnNextCall(log);
%OptimizeFunctionOnNextCall(foo);
%OptimizeFunctionForTopTier(log);
%OptimizeFunctionForTopTier(foo);
assertEquals(1, foo());
// The call with spread should have been inlined.
assertFalse(log_got_interpreted);
......@@ -58,7 +58,7 @@
// Recompile 'foo'.
%PrepareFunctionForOptimization(foo);
%OptimizeFunctionOnNextCall(foo);
%OptimizeFunctionForTopTier(foo);
assertEquals(42, foo());
// The call with spread will not be inlined because we have redefined the
// array iterator.
......
......@@ -31,7 +31,7 @@ function boom() {
foo();
foo();
%OptimizeFunctionOnNextCall(foo);
%OptimizeFunctionForTopTier(foo);
foo();
})();
......@@ -62,6 +62,6 @@ function boom() {
foo();
foo();
%OptimizeFunctionOnNextCall(foo);
%OptimizeFunctionForTopTier(foo);
foo();
})();
......@@ -22,5 +22,5 @@ function foo() { return %TurbofanStaticAssert(bar(global)); }
bar({gaga() {}});
foo();
%OptimizeFunctionOnNextCall(foo);
%OptimizeFunctionForTopTier(foo);
foo();
......@@ -22,5 +22,5 @@ function foo(obj) { obj.gaga; %TurbofanStaticAssert(bar(obj)); }
bar({gaga() {}});
foo(global);
%OptimizeFunctionOnNextCall(foo);
%OptimizeFunctionForTopTier(foo);
foo(global);
......@@ -12,6 +12,6 @@ function foo(x) {
%PrepareFunctionForOptimization(foo);
foo(121);
foo(122);
%OptimizeFunctionOnNextCall(foo);
%OptimizeFunctionForTopTier(foo);
foo(123);
})();
......@@ -12,7 +12,7 @@
%PrepareFunctionForOptimization(foo);
assertEquals(1, foo());
assertEquals(1, foo());
%OptimizeFunctionOnNextCall(foo);
%OptimizeFunctionForTopTier(foo);
assertEquals(1, foo());
assertOptimized(foo);
a.length = 1;
......@@ -28,7 +28,7 @@
%PrepareFunctionForOptimization(foo);
assertEquals(1, foo());
assertEquals(1, foo());
%OptimizeFunctionOnNextCall(foo);
%OptimizeFunctionForTopTier(foo);
assertEquals(1, foo());
assertOptimized(foo);
a[0] = 42;
......@@ -44,7 +44,7 @@
%PrepareFunctionForOptimization(foo);
assertEquals(1, foo());
assertEquals(1, foo());
%OptimizeFunctionOnNextCall(foo);
%OptimizeFunctionForTopTier(foo);
assertEquals(1, foo());
assertOptimized(foo);
a[0] = 42;
......@@ -58,7 +58,7 @@
%PrepareFunctionForOptimization(foo);
assertEquals(1, foo());
assertEquals(1, foo());
%OptimizeFunctionOnNextCall(foo);
%OptimizeFunctionForTopTier(foo);
assertEquals(1, foo());
assertOptimized(foo);
a[0] = 42;
......@@ -72,7 +72,7 @@
%PrepareFunctionForOptimization(foo);
assertEquals(1, foo());
assertEquals(1, foo());
%OptimizeFunctionOnNextCall(foo);
%OptimizeFunctionForTopTier(foo);
assertEquals(1, foo());
assertOptimized(foo);
a[0] = 42;
......@@ -87,7 +87,7 @@
%PrepareFunctionForOptimization(foo);
assertEquals(1, foo());
assertEquals(1, foo());
%OptimizeFunctionOnNextCall(foo);
%OptimizeFunctionForTopTier(foo);
assertEquals(1, foo());
assertOptimized(foo);
a[0] = 42;
......@@ -101,7 +101,7 @@
%PrepareFunctionForOptimization(foo);
assertEquals(1, foo());
assertEquals(1, foo());
%OptimizeFunctionOnNextCall(foo);
%OptimizeFunctionForTopTier(foo);
assertEquals(1, foo());
assertOptimized(foo);
a[0] = 42;
......@@ -115,7 +115,7 @@
%PrepareFunctionForOptimization(foo);
assertEquals(1, foo());
assertEquals(1, foo());
%OptimizeFunctionOnNextCall(foo);
%OptimizeFunctionForTopTier(foo);
assertEquals(1, foo());
assertOptimized(foo);
a[0] = 42;
......
......@@ -30,5 +30,5 @@ bar({aaaa:1});
bar({aaaaa:1});
foo();
foo();
%OptimizeFunctionOnNextCall(foo);
%OptimizeFunctionForTopTier(foo);
foo();
......@@ -26,5 +26,5 @@ bar({aaaa:1});
bar({aaaaa:1});
foo();
foo();
%OptimizeFunctionOnNextCall(foo);
%OptimizeFunctionForTopTier(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();
%OptimizeFunctionOnNextCall(foo);
%OptimizeFunctionForTopTier(foo);
foo();
......@@ -18,5 +18,5 @@ function foo(cond, v1, v2) {
%PrepareFunctionForOptimization(foo);
foo(1, 10, 20); foo(2, 30, 40);
%OptimizeFunctionOnNextCall(foo);
%OptimizeFunctionForTopTier(foo);
foo(1, 10, 20); foo(2, 30, 40);
......@@ -13,5 +13,5 @@ function foo() { return %IsBeingInterpreted(); }
assertTrue(bar());
assertTrue(bar());
%OptimizeFunctionOnNextCall(bar);
%OptimizeFunctionForTopTier(bar);
assertFalse(bar());
......@@ -13,5 +13,5 @@ function foo() { return %IsBeingInterpreted(); }
assertTrue(bar());
assertTrue(bar());
%OptimizeFunctionOnNextCall(bar);
%OptimizeFunctionForTopTier(bar);
assertTrue(bar());
......@@ -37,5 +37,5 @@ function main() {
main();
main();
%OptimizeFunctionOnNextCall(main);
%OptimizeFunctionForTopTier(main);
main();
......@@ -29,5 +29,5 @@ bar({aaaa:1});
bar({aaaaa:1});
foo();
foo();
%OptimizeFunctionOnNextCall(foo);
%OptimizeFunctionForTopTier(foo);
foo();
......@@ -30,7 +30,7 @@
%PrepareFunctionForOptimization(lit_const_smi);
lit_const_smi(); lit_const_smi();
%OptimizeFunctionOnNextCall(lit_const_smi); lit_const_smi();
%OptimizeFunctionForTopTier(lit_const_smi); lit_const_smi();
function lit_const_object() {
......@@ -46,7 +46,7 @@
%PrepareFunctionForOptimization(lit_const_object);
lit_const_object(); lit_const_object();
%OptimizeFunctionOnNextCall(lit_const_object); lit_const_object();
%OptimizeFunctionForTopTier(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);
%OptimizeFunctionOnNextCall(lit_computed_smi); lit_computed_smi(3);
%OptimizeFunctionForTopTier(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);
// %OptimizeFunctionOnNextCall(lit_computed_smi); lit_computed_smi(3.3);
// %OptimizeFunctionForTopTier(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});
%OptimizeFunctionOnNextCall(lit_param_object); lit_param_object({x: 3});
%OptimizeFunctionForTopTier(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);
%OptimizeFunctionOnNextCall(nested_lit_param); nested_lit_param(3);
%OptimizeFunctionForTopTier(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);
// %OptimizeFunctionOnNextCall(nested_lit_param); nested_lit_param(3.3);
// %OptimizeFunctionForTopTier(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});
%OptimizeFunctionOnNextCall(nested_lit_param_object);
%OptimizeFunctionForTopTier(nested_lit_param_object);
nested_lit_param_object({x: 3});
......@@ -138,16 +138,16 @@
%PrepareFunctionForOptimization(inst_param);
inst_param(1); inst_param(2);
%OptimizeFunctionOnNextCall(inst_param); inst_param(3);
%OptimizeFunctionForTopTier(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);
// %OptimizeFunctionOnNextCall(inst_param); inst_param(3.3);
// %OptimizeFunctionForTopTier(inst_param); inst_param(3.3);
%PrepareFunctionForOptimization(inst_param);
inst_param({x: 1}); inst_param({x: 2});
%OptimizeFunctionOnNextCall(inst_param); inst_param({x: 3});
%OptimizeFunctionForTopTier(inst_param); inst_param({x: 3});
function inst_computed(k) {
......@@ -168,9 +168,9 @@
%PrepareFunctionForOptimization(inst_computed);
inst_computed(1); inst_computed(2);
%OptimizeFunctionOnNextCall(inst_computed); inst_computed(3);
%OptimizeFunctionForTopTier(inst_computed); inst_computed(3);
%PrepareFunctionForOptimization(inst_computed);
inst_computed(1.1); inst_computed(2.2);
%OptimizeFunctionOnNextCall(inst_computed); inst_computed(3.3);
%OptimizeFunctionForTopTier(inst_computed); inst_computed(3.3);
})();
......@@ -22,7 +22,7 @@ function TestFunctionPrototypeApply(x) {
%PrepareFunctionForOptimization(TestFunctionPrototypeApply);
assertEquals(TestFunctionPrototypeApply(-13), 13);
assertEquals(TestFunctionPrototypeApply(42), 42);
%OptimizeFunctionOnNextCall(TestFunctionPrototypeApply);
%OptimizeFunctionForTopTier(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));
%OptimizeFunctionOnNextCall(TestFunctionPrototypeApplyReceiver);
%OptimizeFunctionForTopTier(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));
%OptimizeFunctionOnNextCall(test);
%OptimizeFunctionForTopTier(test);
assertEquals(-13, test(-13, 42));
assertOptimized(test);
%PrepareFunctionForOptimization(test);
F = Math.max;
assertEquals(42, test(-13, 42));
assertUnoptimized(test);
%OptimizeFunctionOnNextCall(test);
%OptimizeFunctionForTopTier(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);
%OptimizeFunctionOnNextCall(TestFunctionPrototypeCall);
%OptimizeFunctionForTopTier(TestFunctionPrototypeCall);
TestFunctionPrototypeCall(12);
assertOptimized(TestFunctionPrototypeCall);
TestFunctionPrototypeCall("abc");
......@@ -97,7 +97,7 @@ function TestArrayForEach(x) {
%PrepareFunctionForOptimization(TestArrayForEach);
TestArrayForEach([1, 3, -4]);
TestArrayForEach([-9, 9, 0]);
%OptimizeFunctionOnNextCall(TestArrayForEach);
%OptimizeFunctionForTopTier(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);
%OptimizeFunctionOnNextCall(TestArrayReduce);
%OptimizeFunctionForTopTier(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);
%OptimizeFunctionOnNextCall(TestArrayReduceRight);
%OptimizeFunctionForTopTier(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]);
%OptimizeFunctionOnNextCall(TestArrayMap);
%OptimizeFunctionForTopTier(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]);
%OptimizeFunctionOnNextCall(TestArrayFilter);
%OptimizeFunctionForTopTier(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);
%OptimizeFunctionOnNextCall(TestArrayFind);
%OptimizeFunctionForTopTier(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);
%OptimizeFunctionOnNextCall(TestArrayFindIndex);
%OptimizeFunctionForTopTier(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);
%OptimizeFunctionOnNextCall(TestArrayEvery);
%OptimizeFunctionForTopTier(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);
%OptimizeFunctionOnNextCall(TestArraySome);
%OptimizeFunctionForTopTier(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);
%OptimizeFunctionOnNextCall(TestJSCallWithJSFunction);
%OptimizeFunctionForTopTier(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);
%OptimizeFunctionOnNextCall(TestJSCallWithJSBoundFunction);
%OptimizeFunctionForTopTier(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);
%OptimizeFunctionOnNextCall(TestReflectApply);
%OptimizeFunctionForTopTier(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);
%OptimizeFunctionOnNextCall(TestCallWithSpread);
%OptimizeFunctionForTopTier(TestCallWithSpread);
assertEquals(TestCallWithSpread(-13), 169);
assertOptimized(TestCallWithSpread);
TestCallWithSpread("abc");
......
......@@ -21,7 +21,7 @@
%PrepareFunctionForOptimization(foo);
assertInstanceof(foo(), Promise);
assertInstanceof(foo(), Promise);
%OptimizeFunctionOnNextCall(foo);
%OptimizeFunctionForTopTier(foo);
assertInstanceof(foo(), Promise);
assertOptimized(foo);
......@@ -57,7 +57,7 @@
%PrepareFunctionForOptimization(foo);
assertInstanceof(foo(), Promise);
assertInstanceof(foo(), Promise);
%OptimizeFunctionOnNextCall(foo);
%OptimizeFunctionForTopTier(foo);
assertInstanceof(foo(), Promise);
assertOptimized(foo);
......
......@@ -45,7 +45,7 @@ assertOptimized(bar);
// Instead we trigger optimization of foo, which will inline bar (this time
// based on the new PACKED_ELEMENTS map.
%OptimizeFunctionOnNextCall(foo);
%OptimizeFunctionForTopTier(foo);
foo(a);
assertOptimized(foo);
%PrepareFunctionForOptimization(foo);
......@@ -61,6 +61,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).
%OptimizeFunctionOnNextCall(foo);
%OptimizeFunctionForTopTier(foo);
foo(b);
assertOptimized(foo);
......@@ -33,7 +33,7 @@ foo(a);
foo(a);
// Trigger optimization of bar, based on PACKED_SMI_ELEMENTS feedback.
%OptimizeFunctionOnNextCall(bar);
%OptimizeFunctionForTopTier(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);
%OptimizeFunctionOnNextCall(foo);
%OptimizeFunctionForTopTier(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).
%OptimizeFunctionOnNextCall(foo);
%OptimizeFunctionForTopTier(foo);
foo(b);
assertOptimized(foo);
......@@ -37,6 +37,6 @@ function foo() {
foo();
foo();
%OptimizeFunctionOnNextCall(foo);
expect_interpreted = false;
%OptimizeFunctionForTopTier(foo);
foo();
......@@ -23,5 +23,5 @@ function bar() {
%PrepareFunctionForOptimization(apply);
assertTrue(bar());
assertTrue(bar());
%OptimizeFunctionOnNextCall(bar);
%OptimizeFunctionForTopTier(bar);
assertFalse(bar());
......@@ -23,5 +23,5 @@ function bar() {
%PrepareFunctionForOptimization(call);
assertTrue(bar());
assertTrue(bar());
%OptimizeFunctionOnNextCall(bar);
%OptimizeFunctionForTopTier(bar);
assertFalse(bar());
......@@ -39,5 +39,5 @@ assertTrue(main(true, true));
assertTrue(main(true, true));
assertTrue(main(false, true));
assertTrue(main(false, true));
%OptimizeFunctionOnNextCall(main);
%OptimizeFunctionForTopTier(main);
assertFalse(main(false));
......@@ -37,5 +37,5 @@ assertTrue(main(true, true));
assertTrue(main(true, true));
assertTrue(main(false, true));
assertTrue(main(false, true));
%OptimizeFunctionOnNextCall(main);
%OptimizeFunctionForTopTier(main);
assertFalse(main(false));
......@@ -23,5 +23,5 @@ bar({bla: 1});
bar({blu: 1});
bar({blo: 1});
foo(obj);
%OptimizeFunctionOnNextCall(foo);
%OptimizeFunctionForTopTier(foo);
foo(obj);
......@@ -28,5 +28,5 @@ bar({bla: 1});
bar({blu: 1});
bar({blo: 1});
foo(obj);
%OptimizeFunctionOnNextCall(foo);
%OptimizeFunctionForTopTier(foo);
foo(obj);
......@@ -54,6 +54,6 @@ var g = new G;
foo();
foo();
%OptimizeFunctionOnNextCall(foo);
expect_interpreted = false;
%OptimizeFunctionForTopTier(foo);
foo();
......@@ -1278,45 +1278,6 @@
'regress/regress-crbug-1104608': [SKIP],
}],
##############################################################################
['variant == turboprop or variant == turboprop_as_toptier or variant == future or deopt_fuzzer or (tsan and not concurrent_marking)', {
# # Deopts differently than TurboFan.
'compiler/regress-9945-*': [SKIP],
# Static asserts for optimizations don't hold due to removed optimization
# phases.
'compiler/concurrent-inlining-1': [SKIP],
'compiler/concurrent-inlining-2': [SKIP],
'compiler/constant-fold-add-static': [SKIP],
'compiler/diamond-followedby-branch': [SKIP],
'compiler/is-being-interpreted-*': [SKIP],
'compiler/load-elimination-const-field': [SKIP],
'compiler/serializer-accessors': [SKIP],
'compiler/serializer-apply': [SKIP],
'compiler/serializer-call': [SKIP],
'compiler/serializer-dead-after-jump': [SKIP],
'compiler/serializer-dead-after-return': [SKIP],
'compiler/serializer-feedback-propagation-*': [SKIP],
'compiler/serializer-transition-propagation': [SKIP],
# Some tests rely on TurboFan inlining heuristics.
'compiler/call-with-arraylike-or-spread*': [SKIP],
'compiler/opt-higher-order-functions': [SKIP],
# Tests failing for the lack of function context specialization in Turboprop.
'compiler/abstract-equal-receiver': [SKIP],
'compiler/constant-fold-cow-array': [SKIP],
'compiler/promise-resolve-stable-maps': [SKIP],
# Tests failing due to reduced constant propagation in Turboprop.
'compiler/js-create-arguments': [SKIP],
'compiler/catch-block-load': [SKIP],
'compiler/construct-bound-function': [SKIP],
'compiler/construct-object': [SKIP],
'compiler/construct-receiver': [SKIP],
'compiler/js-create': [SKIP],
}], # variant == turboprop or variant = turboprop_as_toptier
##############################################################################
['variant == top_level_await', {
# specifically expects to fail on top level await.
......
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