Commit c6e0c8e2 authored by rmcilroy's avatar rmcilroy Committed by Commit bot

[Interpereter] Avoid Canonicalizing Handles created during bytecode finalization

Should fix a performance regression introduced by introducing
a CanonicalHandleScope for bytecode compilation. Also fix a
missing CanonicalHandleScope in GetSharedFunctionInfo.

BUG=chromium:634953

Review-Url: https://codereview.chromium.org/2226923002
Cr-Commit-Position: refs/heads/master@{#38583}
parent 08f7c10e
......@@ -1809,6 +1809,13 @@ Handle<SharedFunctionInfo> Compiler::GetSharedFunctionInfo(
RuntimeCallTimerScope runtimeTimer(isolate, &RuntimeCallStats::CompileCode);
TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED(
isolate, &tracing::TraceEventStatsTable::CompileCode);
// Create a canonical handle scope if compiling ignition bytecode. This is
// required by the constant array builder to de-duplicate common objects
// without dereferencing handles.
std::unique_ptr<CanonicalHandleScope> canonical;
if (FLAG_ignition) canonical.reset(new CanonicalHandleScope(info.isolate()));
if (lazy) {
info.SetCode(isolate->builtins()->CompileLazy());
} else if (Renumber(info.parse_info()) && GenerateUnoptimizedCode(&info)) {
......
......@@ -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() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment