Don't create a handle scope when finalizing the bytecode

During finalization, we create SharedFunctionInfos which in turn
will create ScopeInfos for the Scopes in the AST. The Scopes then
cache a handle to the ScopeInfos. However, once the scope is closed,
all those handles get zapped, and it's no longer possible to access
the scopes (even though we actually still need the AST).

R=rmcilroy@chromium.org
BUG=

Review-Url: https://codereview.chromium.org/2278933002
Cr-Commit-Position: refs/heads/master@{#38898}
This commit is contained in:
jochen 2016-08-25 04:15:36 -07:00 committed by Commit bot
parent c2d2d4d1ce
commit 6c744a9715

View File

@ -686,12 +686,9 @@ BytecodeGenerator::BytecodeGenerator(CompilationInfo* info)
}
Handle<BytecodeArray> BytecodeGenerator::FinalizeBytecode(Isolate* isolate) {
// Create an inner HandleScope to avoid unnecessarily canonicalizing handles
// created as part of bytecode finalization.
HandleScope scope(isolate);
AllocateDeferredConstants();
if (HasStackOverflow()) return Handle<BytecodeArray>();
return scope.CloseAndEscape(builder()->ToBytecodeArray(isolate));
return builder()->ToBytecodeArray(isolate);
}
void BytecodeGenerator::AllocateDeferredConstants() {