Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(930)

Unified Diff: src/compiler.cc

Issue 2494993002: [compiler] correctly attribute compile event for inner function. (Closed)
Patch Set: . Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler.cc
diff --git a/src/compiler.cc b/src/compiler.cc
index 7cfea6d8665193b579d607dbce8583afe8fa5d27..ef74578ad1ec1edcbccd0984bf969d87f8837b65 100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -1586,34 +1586,36 @@ Handle<SharedFunctionInfo> Compiler::GetSharedFunctionInfo(
if (outer_info->will_serialize()) info.PrepareForSerializing();
if (outer_info->is_debug()) info.MarkAsDebug();
- // Generate code
- TimerEventScope<TimerEventCompileCode> timer(isolate);
- RuntimeCallTimerScope runtimeTimer(isolate, &RuntimeCallStats::CompileCode);
- TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.CompileCode");
-
- if (result->is_compiled()) {
- // If this inner function is already compiled, we don't need to compile
- // again. When compiling for debug, we are not interested in having debug
- // break slots in inner functions, neither for setting break points nor
- // for revealing inner functions.
- // This is especially important for generators. We must not replace the
- // code for generators, as there may be suspended generator objects.
- return result;
- } else if (!literal->ShouldEagerCompile()) {
- info.SetCode(isolate->builtins()->CompileLazy());
- Scope* outer_scope = literal->scope()->GetOuterScopeWithContext();
- if (outer_scope) {
- result->set_outer_scope_info(*outer_scope->scope_info());
- }
- } 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);
+ // If this inner function is already compiled, we don't need to compile
+ // again. When compiling for debug, we are not interested in having debug
+ // break slots in inner functions, neither for setting break points nor
+ // for revealing inner functions.
+ // This is especially important for generators. We must not replace the
+ // code for generators, as there may be suspended generator objects.
+ if (!result->is_compiled()) {
+ if (!literal->ShouldEagerCompile()) {
+ info.SetCode(isolate->builtins()->CompileLazy());
+ Scope* outer_scope = literal->scope()->GetOuterScopeWithContext();
+ if (outer_scope) {
+ result->set_outer_scope_info(*outer_scope->scope_info());
+ }
+ } else {
+ // Generate code
+ TimerEventScope<TimerEventCompileCode> timer(isolate);
+ RuntimeCallTimerScope runtimeTimer(isolate,
+ &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 {
- return Handle<SharedFunctionInfo>::null();
}
if (maybe_existing.is_null()) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698