Chromium Code Reviews| Index: src/compiler.cc |
| diff --git a/src/compiler.cc b/src/compiler.cc |
| index 1ccf5c2a394cb125b09e9c20549dab38d2b662b1..5b3603d83da880ae7b9ccd5e82e60168bc0e433c 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_was_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_was_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,44 @@ MaybeHandle<Code> GetLazyCode(Handle<JSFunction> function) { |
| return cached_code; |
| } |
| - if (function->shared()->was_marked_for_optimization()) { |
| - DCHECK(FLAG_optimize_shared_functions); |
| + if (function->shared()->was_marked_for_tier_up()) { |
| + DCHECK(FLAG_tier_up_shared_functions); |
| + DCHECK(function->shared()->is_compiled()); |
|
Michael Starzinger
2016/10/27 09:29:59
Can you elaborate why this DCHECK was added? I can
Michael Starzinger
2016/10/27 09:32:21
Actually, I think with code flushing this is not g
Leszek Swirski
2016/10/27 09:40:20
It's here because I put the default case as unreac
|
| - function->shared()->set_was_marked_for_optimization(false); |
| + function->shared()->set_was_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(); |
| } |
| } |