Commit 052ba98d authored by bmeurer's avatar bmeurer Committed by Commit bot

[compiler] Properly canonicalize handles even with concurrent recompilation.

For concurrent recompilation we created the CompilationHandleScope after
the CanonicalHandleScope, which basically disabled the canonicalization
because the deferred handle creation doesn't pay attention to the
canonicalization mode then. This meant that we did not canonicalize
handles properly as soon as concurrent recompilation was enabled.

R=jarin@chromium.org
BUG=v8:5267

Review-Url: https://codereview.chromium.org/2276953004
Cr-Commit-Position: refs/heads/master@{#38882}
parent a124bf77
......@@ -658,6 +658,9 @@ bool GetOptimizedCodeNow(CompilationJob* job) {
CompilationInfo* info = job->info();
Isolate* isolate = info->isolate();
// All handles below this point will be canonicalized.
CanonicalHandleScope canonical(isolate);
// Parsing is not required when optimizing from existing bytecode.
if (!info->is_optimizing_from_bytecode()) {
if (!Compiler::ParseAndAnalyze(info->parse_info())) return false;
......@@ -666,6 +669,10 @@ bool GetOptimizedCodeNow(CompilationJob* job) {
JSFunction::EnsureLiterals(info->closure());
// Reopen handles in the new CompilationHandleScope.
info->ReopenHandlesInNewHandleScope();
info->parse_info()->ReopenHandlesInNewHandleScope();
TimerEventScope<TimerEventRecompileSynchronous> timer(isolate);
RuntimeCallTimerScope runtimeTimer(isolate,
&RuntimeCallStats::RecompileSynchronous);
......@@ -713,9 +720,11 @@ bool GetOptimizedCodeLater(CompilationJob* job) {
return false;
}
// All handles below this point will be allocated in a deferred handle scope
// that is detached and handed off to the background thread when we return.
// All handles below this point will be canonicalized and allocated in a
// deferred handle scope that is detached and handed off to the background
// thread when we return.
CompilationHandleScope handle_scope(info);
CanonicalHandleScope canonical(isolate);
// Parsing is not required when optimizing from existing bytecode.
if (!info->is_optimizing_from_bytecode()) {
......@@ -808,7 +817,6 @@ MaybeHandle<Code> GetOptimizedCode(Handle<JSFunction> function,
return MaybeHandle<Code>();
}
CanonicalHandleScope canonical(isolate);
TimerEventScope<TimerEventOptimizeCode> optimize_code_timer(isolate);
RuntimeCallTimerScope runtimeTimer(isolate, &RuntimeCallStats::OptimizeCode);
TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED(
......
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