| Index: src/compiler.cc
|
| diff --git a/src/compiler.cc b/src/compiler.cc
|
| index 1ccf5c2a394cb125b09e9c20549dab38d2b662b1..7480a0b35a3348edf1ccbbfea256bc5b6b660d1c 100644
|
| --- a/src/compiler.cc
|
| +++ b/src/compiler.cc
|
| @@ -634,6 +634,9 @@ MaybeHandle<Code> GetOptimizedCode(Handle<JSFunction> function,
|
| DCHECK_IMPLIES(ignition_osr, !osr_ast_id.IsNone());
|
| DCHECK_IMPLIES(ignition_osr, FLAG_ignition_osr);
|
|
|
| + // Shared function no longer needs to be tiered up
|
| + shared->set_marked_for_tier_up(false);
|
| +
|
| // Flag combination --ignition-osr --no-turbo-from-bytecode is unsupported.
|
| if (ignition_osr && !FLAG_turbo_from_bytecode) return MaybeHandle<Code>();
|
|
|
| @@ -870,6 +873,9 @@ MaybeHandle<Code> GetBaselineCode(Handle<JSFunction> function) {
|
| ParseInfo parse_info(&zone, handle(function->shared()));
|
| CompilationInfo info(&parse_info, function);
|
|
|
| + // Function no longer needs to be tiered up
|
| + function->shared()->set_marked_for_tier_up(false);
|
| +
|
| // Reset profiler ticks, function is no longer considered hot.
|
| if (function->shared()->HasBytecodeArray()) {
|
| function->shared()->set_profiler_ticks(0);
|
| @@ -977,21 +983,43 @@ MaybeHandle<Code> GetLazyCode(Handle<JSFunction> function) {
|
| return cached_code;
|
| }
|
|
|
| - if (function->shared()->was_marked_for_optimization()) {
|
| - DCHECK(FLAG_optimize_shared_functions);
|
| + if (function->shared()->marked_for_tier_up()) {
|
| + DCHECK(FLAG_mark_shared_functions_for_tier_up);
|
|
|
| - function->shared()->set_was_marked_for_optimization(false);
|
| + function->shared()->set_marked_for_tier_up(false);
|
|
|
| - if (FLAG_trace_opt) {
|
| - PrintF("[optimizing function ");
|
| - function->PrintName();
|
| - PrintF(" eagerly because shared function was previously marked]\n");
|
| - }
|
| + switch (Compiler::NextCompilationTier(*function)) {
|
| + case Compiler::BASELINE: {
|
| + if (FLAG_trace_opt) {
|
| + PrintF("[recompiling function ");
|
| + function->ShortPrint();
|
| + PrintF(
|
| + " to baseline eagerly (shared function marked for tier up)]\n");
|
| + }
|
|
|
| - Handle<Code> opt_code;
|
| - if (GetOptimizedCode(function, Compiler::NOT_CONCURRENT)
|
| - .ToHandle(&opt_code)) {
|
| - return opt_code;
|
| + Handle<Code> code;
|
| + if (!GetBaselineCode(function).ToHandle(&code)) {
|
| + return code;
|
| + }
|
| + break;
|
| + }
|
| + case Compiler::OPTIMIZED: {
|
| + if (FLAG_trace_opt) {
|
| + PrintF("[optimizing method ");
|
| + function->ShortPrint();
|
| + PrintF(" eagerly (shared function marked for tier up)]\n");
|
| + }
|
| +
|
| + Handle<Code> code;
|
| + // TODO(leszeks): Look into performing this compilation concurrently.
|
| + if (!GetOptimizedCode(function, Compiler::NOT_CONCURRENT)
|
| + .ToHandle(&code)) {
|
| + return code;
|
| + }
|
| + break;
|
| + }
|
| + default:
|
| + UNREACHABLE();
|
| }
|
| }
|
|
|
|
|