Commit d826adf6 authored by Pierre Langlois's avatar Pierre Langlois Committed by V8 LUCI CQ

[turbofan] Fix tracing when compiling JS.

The PipelineRunScope scope is live on every Run() phase and it isn't
allowed to nest. This means we cannot open a new PipelineRunScope during
TraceScheduleAndVerify() because it can be called in the middle of a
Run(), which we do during effect-control-linearization in the JS
pipeline.

We can fix this by directly using a RuntimeCallTimerScope and a tracing
event, instead of relying on PipelineRunScope to do that.

Change-Id: I3c17b2c0a58ff3cac0d1dcc796f54d29b3444468
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3132506
Auto-Submit: Pierre Langlois <pierre.langlois@arm.com>
Commit-Queue: Georg Neis <neis@chromium.org>
Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/main@{#76603}
parent b029ac21
...@@ -16,16 +16,12 @@ namespace v8 { ...@@ -16,16 +16,12 @@ namespace v8 {
namespace internal { namespace internal {
namespace compiler { namespace compiler {
namespace {
// We log detailed phase information about the pipeline // We log detailed phase information about the pipeline
// in both the v8.turbofan and the v8.wasm.turbofan categories. // in both the v8.turbofan and the v8.wasm.turbofan categories.
constexpr const char kTraceCategory[] = // -- const char PipelineStatistics::kTraceCategory[] =
TRACE_DISABLED_BY_DEFAULT("v8.turbofan") "," // -- TRACE_DISABLED_BY_DEFAULT("v8.turbofan") "," // --
TRACE_DISABLED_BY_DEFAULT("v8.wasm.turbofan"); TRACE_DISABLED_BY_DEFAULT("v8.wasm.turbofan");
} // namespace
void PipelineStatistics::CommonStats::Begin( void PipelineStatistics::CommonStats::Begin(
PipelineStatistics* pipeline_stats) { PipelineStatistics* pipeline_stats) {
DCHECK(!scope_); DCHECK(!scope_);
......
...@@ -29,6 +29,8 @@ class PipelineStatistics : public Malloced { ...@@ -29,6 +29,8 @@ class PipelineStatistics : public Malloced {
void BeginPhaseKind(const char* phase_kind_name); void BeginPhaseKind(const char* phase_kind_name);
void EndPhaseKind(); void EndPhaseKind();
static const char kTraceCategory[];
private: private:
size_t OuterZoneSize() { size_t OuterZoneSize() {
return static_cast<size_t>(outer_zone_->allocation_size()); return static_cast<size_t>(outer_zone_->allocation_size());
......
...@@ -946,13 +946,10 @@ void PrintCode(Isolate* isolate, Handle<Code> code, ...@@ -946,13 +946,10 @@ void PrintCode(Isolate* isolate, Handle<Code> code,
void TraceScheduleAndVerify(OptimizedCompilationInfo* info, PipelineData* data, void TraceScheduleAndVerify(OptimizedCompilationInfo* info, PipelineData* data,
Schedule* schedule, const char* phase_name) { Schedule* schedule, const char* phase_name) {
#ifdef V8_RUNTIME_CALL_STATS RCS_SCOPE(data->runtime_call_stats(),
PipelineRunScope scope(data, "V8.TraceScheduleAndVerify", RuntimeCallCounterId::kOptimizeTraceScheduleAndVerify,
RuntimeCallCounterId::kOptimizeTraceScheduleAndVerify, RuntimeCallStats::kThreadSpecific);
RuntimeCallStats::kThreadSpecific); TRACE_EVENT0(PipelineStatistics::kTraceCategory, "V8.TraceScheduleAndVerify");
#else
PipelineRunScope scope(data, "V8.TraceScheduleAndVerify");
#endif
if (info->trace_turbo_json()) { if (info->trace_turbo_json()) {
UnparkedScopeIfNeeded scope(data->broker()); UnparkedScopeIfNeeded scope(data->broker());
AllowHandleDereference allow_deref; AllowHandleDereference allow_deref;
......
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