[turbofan] JSHeapBroker logging respects --trace-turbo-filter
As a component of the wider Turbofan logging scheme, it makes sense for JSHeapBroker logging to come through flags specified in the OptimizedCompilationInfo class, which uses --trace-turbo-filter to control which functions are logged. Bug: v8:7790 Change-Id: I3b068d8be78867ab0bd9607dda9eca4123b9d7b1 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1655297 Reviewed-by: Maya Lekova <mslekova@chromium.org> Commit-Queue: Michael Stanton <mvstanton@chromium.org> Cr-Commit-Position: refs/heads/master@{#62111}
This commit is contained in:
parent
510f4f2c12
commit
648ff5627e
@ -240,6 +240,7 @@ void OptimizedCompilationInfo::SetTracingFlags(bool passes_filter) {
|
|||||||
if (FLAG_trace_turbo) SetFlag(kTraceTurboJson);
|
if (FLAG_trace_turbo) SetFlag(kTraceTurboJson);
|
||||||
if (FLAG_trace_turbo_graph) SetFlag(kTraceTurboGraph);
|
if (FLAG_trace_turbo_graph) SetFlag(kTraceTurboGraph);
|
||||||
if (FLAG_trace_turbo_scheduled) SetFlag(kTraceTurboScheduled);
|
if (FLAG_trace_turbo_scheduled) SetFlag(kTraceTurboScheduled);
|
||||||
|
if (FLAG_trace_heap_broker) SetFlag(kTraceHeapBroker);
|
||||||
}
|
}
|
||||||
|
|
||||||
OptimizedCompilationInfo::InlinedFunctionHolder::InlinedFunctionHolder(
|
OptimizedCompilationInfo::InlinedFunctionHolder::InlinedFunctionHolder(
|
||||||
|
@ -60,9 +60,10 @@ class V8_EXPORT_PRIVATE OptimizedCompilationInfo final {
|
|||||||
kTraceTurboJson = 1 << 14,
|
kTraceTurboJson = 1 << 14,
|
||||||
kTraceTurboGraph = 1 << 15,
|
kTraceTurboGraph = 1 << 15,
|
||||||
kTraceTurboScheduled = 1 << 16,
|
kTraceTurboScheduled = 1 << 16,
|
||||||
kWasmRuntimeExceptionSupport = 1 << 17,
|
kTraceHeapBroker = 1 << 17,
|
||||||
kTurboControlFlowAwareAllocation = 1 << 18,
|
kWasmRuntimeExceptionSupport = 1 << 18,
|
||||||
kTurboPreprocessRanges = 1 << 19
|
kTurboControlFlowAwareAllocation = 1 << 19,
|
||||||
|
kTurboPreprocessRanges = 1 << 20
|
||||||
};
|
};
|
||||||
|
|
||||||
// Construct a compilation info for optimized compilation.
|
// Construct a compilation info for optimized compilation.
|
||||||
@ -193,6 +194,8 @@ class V8_EXPORT_PRIVATE OptimizedCompilationInfo final {
|
|||||||
return GetFlag(kTraceTurboScheduled);
|
return GetFlag(kTraceTurboScheduled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool trace_heap_broker_enabled() const { return GetFlag(kTraceHeapBroker); }
|
||||||
|
|
||||||
// Code getters and setters.
|
// Code getters and setters.
|
||||||
|
|
||||||
void SetCode(Handle<Code> code) { code_ = code; }
|
void SetCode(Handle<Code> code) { code_ = code; }
|
||||||
|
@ -1861,14 +1861,16 @@ ObjectRef ContextRef::get(int index) const {
|
|||||||
return ObjectRef(broker(), data()->AsContext()->GetSlot(index));
|
return ObjectRef(broker(), data()->AsContext()->GetSlot(index));
|
||||||
}
|
}
|
||||||
|
|
||||||
JSHeapBroker::JSHeapBroker(Isolate* isolate, Zone* broker_zone)
|
JSHeapBroker::JSHeapBroker(Isolate* isolate, Zone* broker_zone,
|
||||||
|
bool tracing_enabled)
|
||||||
: isolate_(isolate),
|
: isolate_(isolate),
|
||||||
broker_zone_(broker_zone),
|
broker_zone_(broker_zone),
|
||||||
current_zone_(broker_zone),
|
current_zone_(broker_zone),
|
||||||
refs_(new (zone())
|
refs_(new (zone())
|
||||||
RefsMap(kMinimalRefsBucketCount, AddressMatcher(), zone())),
|
RefsMap(kMinimalRefsBucketCount, AddressMatcher(), zone())),
|
||||||
array_and_object_prototypes_(zone()),
|
array_and_object_prototypes_(zone()),
|
||||||
feedback_(zone()) {
|
feedback_(zone()),
|
||||||
|
tracing_enabled_(tracing_enabled) {
|
||||||
// Note that this initialization of the refs_ pointer with the minimal
|
// Note that this initialization of the refs_ pointer with the minimal
|
||||||
// initial capacity is redundant in the normal use case (concurrent
|
// initial capacity is redundant in the normal use case (concurrent
|
||||||
// compilation enabled, standard objects to be serialized), as the map
|
// compilation enabled, standard objects to be serialized), as the map
|
||||||
|
@ -820,26 +820,28 @@ struct FeedbackSource {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#define TRACE_BROKER(broker, x) \
|
#define TRACE_BROKER(broker, x) \
|
||||||
do { \
|
do { \
|
||||||
if (FLAG_trace_heap_broker_verbose) broker->Trace() << x << '\n'; \
|
if (broker->tracing_enabled() && FLAG_trace_heap_broker_verbose) \
|
||||||
|
broker->Trace() << x << '\n'; \
|
||||||
} while (false)
|
} while (false)
|
||||||
|
|
||||||
#define TRACE_BROKER_MISSING(broker, x) \
|
#define TRACE_BROKER_MISSING(broker, x) \
|
||||||
do { \
|
do { \
|
||||||
if (FLAG_trace_heap_broker) \
|
if (broker->tracing_enabled()) \
|
||||||
broker->Trace() << __FUNCTION__ << ": missing " << x << '\n'; \
|
broker->Trace() << __FUNCTION__ << ": missing " << x << '\n'; \
|
||||||
} while (false)
|
} while (false)
|
||||||
|
|
||||||
class V8_EXPORT_PRIVATE JSHeapBroker {
|
class V8_EXPORT_PRIVATE JSHeapBroker {
|
||||||
public:
|
public:
|
||||||
JSHeapBroker(Isolate* isolate, Zone* broker_zone);
|
JSHeapBroker(Isolate* isolate, Zone* broker_zone, bool tracing_enabled);
|
||||||
|
|
||||||
void SetNativeContextRef();
|
void SetNativeContextRef();
|
||||||
void SerializeStandardObjects();
|
void SerializeStandardObjects();
|
||||||
|
|
||||||
Isolate* isolate() const { return isolate_; }
|
Isolate* isolate() const { return isolate_; }
|
||||||
Zone* zone() const { return current_zone_; }
|
Zone* zone() const { return current_zone_; }
|
||||||
|
bool tracing_enabled() const { return tracing_enabled_; }
|
||||||
NativeContextRef native_context() const { return native_context_.value(); }
|
NativeContextRef native_context() const { return native_context_.value(); }
|
||||||
PerIsolateCompilerCache* compiler_cache() const { return compiler_cache_; }
|
PerIsolateCompilerCache* compiler_cache() const { return compiler_cache_; }
|
||||||
|
|
||||||
@ -907,6 +909,7 @@ class V8_EXPORT_PRIVATE JSHeapBroker {
|
|||||||
ZoneUnorderedMap<FeedbackSource, ProcessedFeedback const*,
|
ZoneUnorderedMap<FeedbackSource, ProcessedFeedback const*,
|
||||||
FeedbackSource::Hash, FeedbackSource::Equal>
|
FeedbackSource::Hash, FeedbackSource::Equal>
|
||||||
feedback_;
|
feedback_;
|
||||||
|
bool tracing_enabled_;
|
||||||
|
|
||||||
static const size_t kMinimalRefsBucketCount = 8; // must be power of 2
|
static const size_t kMinimalRefsBucketCount = 8; // must be power of 2
|
||||||
static const size_t kInitialRefsBucketCount = 1024; // must be power of 2
|
static const size_t kInitialRefsBucketCount = 1024; // must be power of 2
|
||||||
|
@ -115,7 +115,8 @@ class PipelineData {
|
|||||||
instruction_zone_(instruction_zone_scope_.zone()),
|
instruction_zone_(instruction_zone_scope_.zone()),
|
||||||
codegen_zone_scope_(zone_stats_, ZONE_NAME),
|
codegen_zone_scope_(zone_stats_, ZONE_NAME),
|
||||||
codegen_zone_(codegen_zone_scope_.zone()),
|
codegen_zone_(codegen_zone_scope_.zone()),
|
||||||
broker_(new JSHeapBroker(isolate_, info_->zone())),
|
broker_(new JSHeapBroker(isolate_, info_->zone(),
|
||||||
|
info_->trace_heap_broker_enabled())),
|
||||||
register_allocation_zone_scope_(zone_stats_, ZONE_NAME),
|
register_allocation_zone_scope_(zone_stats_, ZONE_NAME),
|
||||||
register_allocation_zone_(register_allocation_zone_scope_.zone()),
|
register_allocation_zone_(register_allocation_zone_scope_.zone()),
|
||||||
assembler_options_(AssemblerOptions::Default(isolate)) {
|
assembler_options_(AssemblerOptions::Default(isolate)) {
|
||||||
|
@ -31,7 +31,7 @@ class ContextSpecializationTester : public HandleAndZoneScope {
|
|||||||
jsgraph_(main_isolate(), graph(), common(), &javascript_, &simplified_,
|
jsgraph_(main_isolate(), graph(), common(), &javascript_, &simplified_,
|
||||||
&machine_),
|
&machine_),
|
||||||
reducer_(main_zone(), graph()),
|
reducer_(main_zone(), graph()),
|
||||||
js_heap_broker_(main_isolate(), main_zone()),
|
js_heap_broker_(main_isolate(), main_zone(), FLAG_trace_heap_broker),
|
||||||
spec_(&reducer_, jsgraph(), &js_heap_broker_, context,
|
spec_(&reducer_, jsgraph(), &js_heap_broker_, context,
|
||||||
MaybeHandle<JSFunction>()) {}
|
MaybeHandle<JSFunction>()) {}
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ class JSTypedLoweringTester : public HandleAndZoneScope {
|
|||||||
explicit JSTypedLoweringTester(int num_parameters = 0)
|
explicit JSTypedLoweringTester(int num_parameters = 0)
|
||||||
: isolate(main_isolate()),
|
: isolate(main_isolate()),
|
||||||
canonical(isolate),
|
canonical(isolate),
|
||||||
js_heap_broker(isolate, main_zone()),
|
js_heap_broker(isolate, main_zone(), FLAG_trace_heap_broker),
|
||||||
binop(nullptr),
|
binop(nullptr),
|
||||||
unop(nullptr),
|
unop(nullptr),
|
||||||
javascript(main_zone()),
|
javascript(main_zone()),
|
||||||
|
@ -40,7 +40,9 @@ namespace compiler {
|
|||||||
class Types {
|
class Types {
|
||||||
public:
|
public:
|
||||||
Types(Zone* zone, Isolate* isolate, v8::base::RandomNumberGenerator* rng)
|
Types(Zone* zone, Isolate* isolate, v8::base::RandomNumberGenerator* rng)
|
||||||
: zone_(zone), js_heap_broker_(isolate, zone), rng_(rng) {
|
: zone_(zone),
|
||||||
|
js_heap_broker_(isolate, zone, FLAG_trace_heap_broker),
|
||||||
|
rng_(rng) {
|
||||||
#define DECLARE_TYPE(name, value) \
|
#define DECLARE_TYPE(name, value) \
|
||||||
name = Type::name(); \
|
name = Type::name(); \
|
||||||
types.push_back(name);
|
types.push_back(name);
|
||||||
|
@ -29,7 +29,7 @@ class CommonOperatorReducerTest : public GraphTest {
|
|||||||
Reduction Reduce(
|
Reduction Reduce(
|
||||||
AdvancedReducer::Editor* editor, Node* node,
|
AdvancedReducer::Editor* editor, Node* node,
|
||||||
MachineOperatorBuilder::Flags flags = MachineOperatorBuilder::kNoFlags) {
|
MachineOperatorBuilder::Flags flags = MachineOperatorBuilder::kNoFlags) {
|
||||||
JSHeapBroker broker(isolate(), zone());
|
JSHeapBroker broker(isolate(), zone(), FLAG_trace_heap_broker);
|
||||||
MachineOperatorBuilder machine(zone(), MachineType::PointerRepresentation(),
|
MachineOperatorBuilder machine(zone(), MachineType::PointerRepresentation(),
|
||||||
flags);
|
flags);
|
||||||
CommonOperatorReducer reducer(editor, graph(), &broker, common(), &machine,
|
CommonOperatorReducer reducer(editor, graph(), &broker, common(), &machine,
|
||||||
|
@ -63,7 +63,7 @@ class ConstantFoldingReducerTest : public TypedGraphTest {
|
|||||||
public:
|
public:
|
||||||
ConstantFoldingReducerTest()
|
ConstantFoldingReducerTest()
|
||||||
: TypedGraphTest(3),
|
: TypedGraphTest(3),
|
||||||
broker_(isolate(), zone()),
|
broker_(isolate(), zone(), FLAG_trace_heap_broker),
|
||||||
simplified_(zone()),
|
simplified_(zone()),
|
||||||
deps_(&broker_, zone()) {}
|
deps_(&broker_, zone()) {}
|
||||||
~ConstantFoldingReducerTest() override = default;
|
~ConstantFoldingReducerTest() override = default;
|
||||||
|
@ -18,7 +18,7 @@ GraphTest::GraphTest(int num_parameters)
|
|||||||
: canonical_(isolate()),
|
: canonical_(isolate()),
|
||||||
common_(zone()),
|
common_(zone()),
|
||||||
graph_(zone()),
|
graph_(zone()),
|
||||||
broker_(isolate(), zone()),
|
broker_(isolate(), zone(), FLAG_trace_heap_broker),
|
||||||
source_positions_(&graph_),
|
source_positions_(&graph_),
|
||||||
node_origins_(&graph_) {
|
node_origins_(&graph_) {
|
||||||
graph()->SetStart(graph()->NewNode(common()->Start(num_parameters)));
|
graph()->SetStart(graph()->NewNode(common()->Start(num_parameters)));
|
||||||
|
@ -29,7 +29,7 @@ class SimplifiedOperatorReducerTest : public GraphTest {
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
Reduction Reduce(Node* node) {
|
Reduction Reduce(Node* node) {
|
||||||
JSHeapBroker broker(isolate(), zone());
|
JSHeapBroker broker(isolate(), zone(), FLAG_trace_heap_broker);
|
||||||
MachineOperatorBuilder machine(zone());
|
MachineOperatorBuilder machine(zone());
|
||||||
JSOperatorBuilder javascript(zone());
|
JSOperatorBuilder javascript(zone());
|
||||||
JSGraph jsgraph(isolate(), graph(), common(), &javascript, simplified(),
|
JSGraph jsgraph(isolate(), graph(), common(), &javascript, simplified(),
|
||||||
|
@ -22,7 +22,7 @@ class TyperTest : public TypedGraphTest {
|
|||||||
public:
|
public:
|
||||||
TyperTest()
|
TyperTest()
|
||||||
: TypedGraphTest(3),
|
: TypedGraphTest(3),
|
||||||
broker_(isolate(), zone()),
|
broker_(isolate(), zone(), FLAG_trace_heap_broker),
|
||||||
operation_typer_(&broker_, zone()),
|
operation_typer_(&broker_, zone()),
|
||||||
types_(zone(), isolate(), random_number_generator()),
|
types_(zone(), isolate(), random_number_generator()),
|
||||||
javascript_(zone()),
|
javascript_(zone()),
|
||||||
|
Loading…
Reference in New Issue
Block a user