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 1969293003: [debugger] Prevent shared function info duplicates (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix logic & other tweaks Created 4 years, 7 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 | « 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 8eb6ff577308015c0ec7ee0e7984d04d4e43ac81..0d5534927a826c961cf52e89adfd7b023843ae01 100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -1242,6 +1242,12 @@ bool Compiler::CompileForLiveEdit(Handle<Script> script) {
Isolate* isolate = script->GetIsolate();
DCHECK(AllowCompilation::IsAllowed(isolate));
+ // In order to ensure that live edit function info collection finds the newly
+ // generated shared function infos, clear the script's list temporarily
+ // and restore it at the end of this method.
+ Handle<Object> old_function_infos(script->shared_function_infos(), isolate);
+ script->set_shared_function_infos(Smi::FromInt(0));
+
// Start a compilation.
Zone zone(isolate->allocator());
ParseInfo parse_info(&zone, script);
@@ -1249,13 +1255,21 @@ bool Compiler::CompileForLiveEdit(Handle<Script> script) {
parse_info.set_global();
info.MarkAsDebug();
// TODO(635): support extensions.
- if (CompileToplevel(&info).is_null()) {
+ const bool compilation_succeeded = !CompileToplevel(&info).is_null();
+
+ // Restore the original function info list in order to remain side-effect
+ // free as much as possible, since some code expects the old shared function
+ // infos to stick around.
+ script->set_shared_function_infos(*old_function_infos);
+
+ if (!compilation_succeeded) {
return false;
}
// Check postconditions on success.
DCHECK(!isolate->has_pending_exception());
- return true;
+
+ return compilation_succeeded;
}
// TODO(turbofan): In the future, unoptimized code with deopt support could
« 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