Chromium Code Reviews| Index: src/compiler.cc |
| diff --git a/src/compiler.cc b/src/compiler.cc |
| index 8eb6ff577308015c0ec7ee0e7984d04d4e43ac81..dc02d51e43820c6a73046c9f82817b6591e9e0a3 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,19 @@ bool Compiler::CompileForLiveEdit(Handle<Script> script) { |
| parse_info.set_global(); |
| info.MarkAsDebug(); |
| // TODO(635): support extensions. |
| - if (CompileToplevel(&info).is_null()) { |
| - return false; |
| + 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) { |
| + // Check postconditions on success. |
| + DCHECK(!isolate->has_pending_exception()); |
|
Yang
2016/05/12 07:43:14
We could just rephrase this as DCHECK(!compilation
jgruber1
2016/05/12 08:26:46
Rewrote this part to again exit early on compilati
|
| } |
| - // 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 |