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

Unified Diff: src/compiler.cc

Issue 1196223002: Do not look for existing shared function info when compiling a new script. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 months 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 | « src/compiler.h ('k') | src/objects.cc » ('j') | 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 7441f19e5a0467720ba2ff1141443e900979749a..5f3a55325bce243a3fa0e0ac5e47cf33aff3f123 100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -1075,6 +1075,8 @@ static Handle<SharedFunctionInfo> CompileToplevel(CompilationInfo* info) {
}
}
+ info->MarkAsNewScript();
+
FunctionLiteral* lit = info->function();
LiveEditFunctionTracker live_edit_tracker(isolate, lit);
@@ -1335,8 +1337,13 @@ Handle<SharedFunctionInfo> Compiler::GetSharedFunctionInfo(
FunctionLiteral* literal, Handle<Script> script,
CompilationInfo* outer_info) {
// Precondition: code has been parsed and scopes have been analyzed.
- MaybeHandle<SharedFunctionInfo> maybe_existing =
- script->FindSharedFunctionInfo(literal);
+ MaybeHandle<SharedFunctionInfo> maybe_existing;
+ if (outer_info->is_new_script()) {
+ // There is no existing shared function info when compiling a new script.
+ DCHECK(script->FindSharedFunctionInfo(literal).is_null());
+ } else {
+ maybe_existing = script->FindSharedFunctionInfo(literal);
+ }
// We found an existing shared function info. If it's already compiled,
// don't worry about compiling it, and simply return it. If it's not yet
// compiled, continue to decide whether to eagerly compile.
@@ -1352,6 +1359,7 @@ Handle<SharedFunctionInfo> Compiler::GetSharedFunctionInfo(
parse_info.set_scope(literal->scope());
parse_info.set_language_mode(literal->scope()->language_mode());
if (outer_info->will_serialize()) info.PrepareForSerializing();
+ if (outer_info->is_new_script()) info.MarkAsNewScript();
Isolate* isolate = info.isolate();
Factory* factory = isolate->factory();
« no previous file with comments | « src/compiler.h ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698