Index: src/interpreter/bytecode-generator.cc |
diff --git a/src/interpreter/bytecode-generator.cc b/src/interpreter/bytecode-generator.cc |
index 1637fbb777a36a23e184d7ae74123cb1cbc6abc4..552d214de50fdebecbade382a158838d4cb656b8 100644 |
--- a/src/interpreter/bytecode-generator.cc |
+++ b/src/interpreter/bytecode-generator.cc |
@@ -627,12 +627,16 @@ BytecodeGenerator::BytecodeGenerator(CompilationInfo* info) |
} |
Handle<BytecodeArray> BytecodeGenerator::MakeBytecode() { |
+ // Create an inner HandleScope to avoid unnecessarily canonicalizing handles |
+ // created as part of bytecode finalization. |
+ HandleScope scope(isolate()); |
+ |
GenerateBytecode(); |
FinalizeBytecode(); |
if (HasStackOverflow()) return Handle<BytecodeArray>(); |
- return builder()->ToBytecodeArray(); |
+ return scope.CloseAndEscape(builder()->ToBytecodeArray()); |
} |
void BytecodeGenerator::FinalizeBytecode() { |