[tracing] Correct "V8.OptimizeCode" scope.

The "V8.OptimizeCode" trace event (in "disabled-by-default-v8.compile"
category) didn't include the setup of the OptimizedCompilationJob, which
is quite expensive already and should be accounted for properly.

Bug: v8:8598
Change-Id: Ieec139c8d555d02edfbc52e904ee214d1007afbd
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1533871
Reviewed-by: Peter Marshall <petermarshall@chromium.org>
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#60413}
This commit is contained in:
Benedikt Meurer 2019-03-21 20:52:56 +01:00 committed by Commit Bot
parent 8d605323e5
commit 41a4651af6

View File

@ -781,6 +781,11 @@ MaybeHandle<Code> GetOptimizedCode(Handle<JSFunction> function,
function->feedback_vector()->set_profiler_ticks(0);
VMState<COMPILER> state(isolate);
TimerEventScope<TimerEventOptimizeCode> optimize_code_timer(isolate);
RuntimeCallTimerScope runtimeTimer(isolate,
RuntimeCallCounterId::kOptimizeCode);
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.OptimizeCode");
DCHECK(!isolate->has_pending_exception());
PostponeInterruptsScope postpone(isolate);
bool has_script = shared->script()->IsScript();
@ -806,11 +811,6 @@ MaybeHandle<Code> GetOptimizedCode(Handle<JSFunction> function,
return MaybeHandle<Code>();
}
TimerEventScope<TimerEventOptimizeCode> optimize_code_timer(isolate);
RuntimeCallTimerScope runtimeTimer(isolate,
RuntimeCallCounterId::kOptimizeCode);
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.OptimizeCode");
// In case of concurrent recompilation, 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.