[compiler] correctly attribute compile event for inner function.
Review-Url: https://codereview.chromium.org/2494993002 Cr-Commit-Position: refs/heads/master@{#40938}
This commit is contained in:
parent
6ddcbb1a9a
commit
c76059cac4
@ -1586,34 +1586,36 @@ Handle<SharedFunctionInfo> Compiler::GetSharedFunctionInfo(
|
|||||||
if (outer_info->will_serialize()) info.PrepareForSerializing();
|
if (outer_info->will_serialize()) info.PrepareForSerializing();
|
||||||
if (outer_info->is_debug()) info.MarkAsDebug();
|
if (outer_info->is_debug()) info.MarkAsDebug();
|
||||||
|
|
||||||
// Generate code
|
// If this inner function is already compiled, we don't need to compile
|
||||||
TimerEventScope<TimerEventCompileCode> timer(isolate);
|
// again. When compiling for debug, we are not interested in having debug
|
||||||
RuntimeCallTimerScope runtimeTimer(isolate, &RuntimeCallStats::CompileCode);
|
// break slots in inner functions, neither for setting break points nor
|
||||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.CompileCode");
|
// for revealing inner functions.
|
||||||
|
// This is especially important for generators. We must not replace the
|
||||||
if (result->is_compiled()) {
|
// code for generators, as there may be suspended generator objects.
|
||||||
// If this inner function is already compiled, we don't need to compile
|
if (!result->is_compiled()) {
|
||||||
// again. When compiling for debug, we are not interested in having debug
|
if (!literal->ShouldEagerCompile()) {
|
||||||
// break slots in inner functions, neither for setting break points nor
|
info.SetCode(isolate->builtins()->CompileLazy());
|
||||||
// for revealing inner functions.
|
Scope* outer_scope = literal->scope()->GetOuterScopeWithContext();
|
||||||
// This is especially important for generators. We must not replace the
|
if (outer_scope) {
|
||||||
// code for generators, as there may be suspended generator objects.
|
result->set_outer_scope_info(*outer_scope->scope_info());
|
||||||
return result;
|
}
|
||||||
} else if (!literal->ShouldEagerCompile()) {
|
} else {
|
||||||
info.SetCode(isolate->builtins()->CompileLazy());
|
// Generate code
|
||||||
Scope* outer_scope = literal->scope()->GetOuterScopeWithContext();
|
TimerEventScope<TimerEventCompileCode> timer(isolate);
|
||||||
if (outer_scope) {
|
RuntimeCallTimerScope runtimeTimer(isolate,
|
||||||
result->set_outer_scope_info(*outer_scope->scope_info());
|
&RuntimeCallStats::CompileCode);
|
||||||
|
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.CompileCode");
|
||||||
|
if (Renumber(info.parse_info()) && GenerateUnoptimizedCode(&info)) {
|
||||||
|
// Code generation will ensure that the feedback vector is present and
|
||||||
|
// appropriately sized.
|
||||||
|
DCHECK(!info.code().is_null());
|
||||||
|
if (literal->should_be_used_once_hint()) {
|
||||||
|
info.code()->MarkToBeExecutedOnce(isolate);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return Handle<SharedFunctionInfo>::null();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (Renumber(info.parse_info()) && GenerateUnoptimizedCode(&info)) {
|
|
||||||
// Code generation will ensure that the feedback vector is present and
|
|
||||||
// appropriately sized.
|
|
||||||
DCHECK(!info.code().is_null());
|
|
||||||
if (literal->should_be_used_once_hint()) {
|
|
||||||
info.code()->MarkToBeExecutedOnce(isolate);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return Handle<SharedFunctionInfo>::null();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (maybe_existing.is_null()) {
|
if (maybe_existing.is_null()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user