Commit 8cfbe0fc authored by Danylo Boiko's avatar Danylo Boiko Committed by V8 LUCI CQ

[turbofan] Turbofan's node bytecode origins

Bug: v8:7327
Change-Id: Ic805dc9bb1f653930d0bb34163d21aa34efc6a51
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3820069Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Commit-Queue: Danylo Boiko <danielboyko02@gmail.com>
Cr-Commit-Position: refs/heads/main@{#82498}
parent 1fe4edb2
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include "src/compiler/linkage.h" #include "src/compiler/linkage.h"
#include "src/compiler/node-matchers.h" #include "src/compiler/node-matchers.h"
#include "src/compiler/node-observer.h" #include "src/compiler/node-observer.h"
#include "src/compiler/node-origin-table.h"
#include "src/compiler/operator-properties.h" #include "src/compiler/operator-properties.h"
#include "src/compiler/simplified-operator.h" #include "src/compiler/simplified-operator.h"
#include "src/compiler/state-values-utils.h" #include "src/compiler/state-values-utils.h"
...@@ -39,7 +40,8 @@ class BytecodeGraphBuilder { ...@@ -39,7 +40,8 @@ class BytecodeGraphBuilder {
FeedbackCellRef const& feedback_cell, FeedbackCellRef const& feedback_cell,
BytecodeOffset osr_offset, JSGraph* jsgraph, BytecodeOffset osr_offset, JSGraph* jsgraph,
CallFrequency const& invocation_frequency, CallFrequency const& invocation_frequency,
SourcePositionTable* source_positions, int inlining_id, SourcePositionTable* source_positions,
NodeOriginTable* node_origins, int inlining_id,
CodeKind code_kind, BytecodeGraphBuilderFlags flags, CodeKind code_kind, BytecodeGraphBuilderFlags flags,
TickCounter* tick_counter, TickCounter* tick_counter,
ObserveNodeInfo const& observe_node_info); ObserveNodeInfo const& observe_node_info);
...@@ -53,6 +55,7 @@ class BytecodeGraphBuilder { ...@@ -53,6 +55,7 @@ class BytecodeGraphBuilder {
private: private:
class Environment; class Environment;
class OsrIteratorState; class OsrIteratorState;
class BytecodePositionDecorator;
struct SubEnvironment; struct SubEnvironment;
void RemoveMergeEnvironmentsBeforeOffset(int limit_offset); void RemoveMergeEnvironmentsBeforeOffset(int limit_offset);
...@@ -65,6 +68,9 @@ class BytecodeGraphBuilder { ...@@ -65,6 +68,9 @@ class BytecodeGraphBuilder {
void VisitSingleBytecode(); void VisitSingleBytecode();
void VisitBytecodes(); void VisitBytecodes();
void AddBytecodePositionDecorator();
void RemoveBytecodePositionDecorator();
// Get or create the node that represents the outer function closure. // Get or create the node that represents the outer function closure.
Node* GetFunctionClosure(); Node* GetFunctionClosure();
...@@ -353,9 +359,9 @@ class BytecodeGraphBuilder { ...@@ -353,9 +359,9 @@ class BytecodeGraphBuilder {
// Simulates entry and exit of exception handlers. // Simulates entry and exit of exception handlers.
void ExitThenEnterExceptionHandlers(int current_offset); void ExitThenEnterExceptionHandlers(int current_offset);
// Update the current position of the {SourcePositionTable} to that of the // Update the current position of {SourcePositionTable} and
// bytecode at {offset}, if any. // {NodeOriginTable} to that bytecode at {offset}, if any.
void UpdateSourcePosition(int offset); void UpdateSourceAndBytecodePosition(int offset);
// Growth increment for the temporary buffer used to construct input lists to // Growth increment for the temporary buffer used to construct input lists to
// new nodes. // new nodes.
...@@ -458,6 +464,7 @@ class BytecodeGraphBuilder { ...@@ -458,6 +464,7 @@ class BytecodeGraphBuilder {
interpreter::BytecodeArrayIterator bytecode_iterator_; interpreter::BytecodeArrayIterator bytecode_iterator_;
BytecodeAnalysis const bytecode_analysis_; BytecodeAnalysis const bytecode_analysis_;
Environment* environment_; Environment* environment_;
BytecodePositionDecorator* decorator_;
bool const osr_; bool const osr_;
int currently_peeled_loop_offset_; int currently_peeled_loop_offset_;
...@@ -504,6 +511,9 @@ class BytecodeGraphBuilder { ...@@ -504,6 +511,9 @@ class BytecodeGraphBuilder {
StateValuesCache state_values_cache_; StateValuesCache state_values_cache_;
// The node origins table, to store bytecode origins.
NodeOriginTable* const node_origins_;
// The source position table, to be populated. // The source position table, to be populated.
SourcePositionTable* const source_positions_; SourcePositionTable* const source_positions_;
...@@ -1014,15 +1024,30 @@ Node* BytecodeGraphBuilder::Environment::Checkpoint( ...@@ -1014,15 +1024,30 @@ Node* BytecodeGraphBuilder::Environment::Checkpoint(
return result; return result;
} }
class BytecodeGraphBuilder::BytecodePositionDecorator final :
public GraphDecorator {
public:
explicit BytecodePositionDecorator(NodeOriginTable* node_origins)
: node_origins_(node_origins) {}
void Decorate(Node* node) final {
node_origins_->SetNodeOrigin(node->id(), NodeOrigin::kJSBytecode,
node_origins_->GetCurrentBytecodePosition());
}
private:
NodeOriginTable* node_origins_;
};
BytecodeGraphBuilder::BytecodeGraphBuilder( BytecodeGraphBuilder::BytecodeGraphBuilder(
JSHeapBroker* broker, Zone* local_zone, JSHeapBroker* broker, Zone* local_zone,
NativeContextRef const& native_context, NativeContextRef const& native_context,
SharedFunctionInfoRef const& shared_info, SharedFunctionInfoRef const& shared_info,
FeedbackCellRef const& feedback_cell, BytecodeOffset osr_offset, FeedbackCellRef const& feedback_cell, BytecodeOffset osr_offset,
JSGraph* jsgraph, CallFrequency const& invocation_frequency, JSGraph* jsgraph, CallFrequency const& invocation_frequency,
SourcePositionTable* source_positions, int inlining_id, CodeKind code_kind, SourcePositionTable* source_positions, NodeOriginTable* node_origins,
BytecodeGraphBuilderFlags flags, TickCounter* tick_counter, int inlining_id, CodeKind code_kind, BytecodeGraphBuilderFlags flags,
ObserveNodeInfo const& observe_node_info) TickCounter* tick_counter, ObserveNodeInfo const& observe_node_info)
: broker_(broker), : broker_(broker),
local_isolate_(broker_->local_isolate() local_isolate_(broker_->local_isolate()
? broker_->local_isolate() ? broker_->local_isolate()
...@@ -1051,6 +1076,7 @@ BytecodeGraphBuilder::BytecodeGraphBuilder( ...@@ -1051,6 +1076,7 @@ BytecodeGraphBuilder::BytecodeGraphBuilder(
bytecode_array().object(), local_zone, osr_offset, bytecode_array().object(), local_zone, osr_offset,
flags & BytecodeGraphBuilderFlag::kAnalyzeEnvironmentLiveness), flags & BytecodeGraphBuilderFlag::kAnalyzeEnvironmentLiveness),
environment_(nullptr), environment_(nullptr),
decorator_(nullptr),
osr_(!osr_offset.IsNone()), osr_(!osr_offset.IsNone()),
currently_peeled_loop_offset_(-1), currently_peeled_loop_offset_(-1),
skip_first_stack_and_tierup_check_( skip_first_stack_and_tierup_check_(
...@@ -1068,6 +1094,7 @@ BytecodeGraphBuilder::BytecodeGraphBuilder( ...@@ -1068,6 +1094,7 @@ BytecodeGraphBuilder::BytecodeGraphBuilder(
needs_eager_checkpoint_(true), needs_eager_checkpoint_(true),
exit_controls_(local_zone), exit_controls_(local_zone),
state_values_cache_(jsgraph), state_values_cache_(jsgraph),
node_origins_(node_origins),
source_positions_(source_positions), source_positions_(source_positions),
start_position_(shared_info.StartPosition(), inlining_id), start_position_(shared_info.StartPosition(), inlining_id),
tick_counter_(tick_counter), tick_counter_(tick_counter),
...@@ -1132,7 +1159,9 @@ FeedbackSource BytecodeGraphBuilder::CreateFeedbackSource(FeedbackSlot slot) { ...@@ -1132,7 +1159,9 @@ FeedbackSource BytecodeGraphBuilder::CreateFeedbackSource(FeedbackSlot slot) {
void BytecodeGraphBuilder::CreateGraph() { void BytecodeGraphBuilder::CreateGraph() {
SourcePositionTable::Scope pos_scope(source_positions_, start_position_); SourcePositionTable::Scope pos_scope(source_positions_, start_position_);
if (node_origins_) {
AddBytecodePositionDecorator();
}
// Set up the basic structure of the graph. Outputs for {Start} are the formal // Set up the basic structure of the graph. Outputs for {Start} are the formal
// parameters (including the receiver) plus new target, number of arguments, // parameters (including the receiver) plus new target, number of arguments,
// context and closure. // context and closure.
...@@ -1157,6 +1186,9 @@ void BytecodeGraphBuilder::CreateGraph() { ...@@ -1157,6 +1186,9 @@ void BytecodeGraphBuilder::CreateGraph() {
Node** const inputs = &exit_controls_.front(); Node** const inputs = &exit_controls_.front();
Node* end = graph()->NewNode(common()->End(input_count), input_count, inputs); Node* end = graph()->NewNode(common()->End(input_count), input_count, inputs);
graph()->SetEnd(end); graph()->SetEnd(end);
if (node_origins_) {
RemoveBytecodePositionDecorator();
}
} }
void BytecodeGraphBuilder::PrepareEagerCheckpoint() { void BytecodeGraphBuilder::PrepareEagerCheckpoint() {
...@@ -1213,7 +1245,8 @@ void BytecodeGraphBuilder::PrepareFrameState( ...@@ -1213,7 +1245,8 @@ void BytecodeGraphBuilder::PrepareFrameState(
void BytecodeGraphBuilder::AdvanceIteratorsTo(int bytecode_offset) { void BytecodeGraphBuilder::AdvanceIteratorsTo(int bytecode_offset) {
for (; bytecode_iterator().current_offset() != bytecode_offset; for (; bytecode_iterator().current_offset() != bytecode_offset;
bytecode_iterator().Advance()) { bytecode_iterator().Advance()) {
UpdateSourcePosition(bytecode_iterator().current_offset()); int current_offset = bytecode_iterator().current_offset();
UpdateSourceAndBytecodePosition(current_offset);
} }
} }
...@@ -1416,7 +1449,7 @@ void BytecodeGraphBuilder::AdvanceToOsrEntryAndPeelLoops() { ...@@ -1416,7 +1449,7 @@ void BytecodeGraphBuilder::AdvanceToOsrEntryAndPeelLoops() {
void BytecodeGraphBuilder::VisitSingleBytecode() { void BytecodeGraphBuilder::VisitSingleBytecode() {
tick_counter_->TickAndMaybeEnterSafepoint(); tick_counter_->TickAndMaybeEnterSafepoint();
int current_offset = bytecode_iterator().current_offset(); int current_offset = bytecode_iterator().current_offset();
UpdateSourcePosition(current_offset); UpdateSourceAndBytecodePosition(current_offset);
ExitThenEnterExceptionHandlers(current_offset); ExitThenEnterExceptionHandlers(current_offset);
DCHECK_GE(exception_handlers_.empty() ? current_offset DCHECK_GE(exception_handlers_.empty() ? current_offset
: exception_handlers_.top().end_offset_, : exception_handlers_.top().end_offset_,
...@@ -1460,6 +1493,18 @@ void BytecodeGraphBuilder::VisitBytecodes() { ...@@ -1460,6 +1493,18 @@ void BytecodeGraphBuilder::VisitBytecodes() {
DCHECK(exception_handlers_.empty()); DCHECK(exception_handlers_.empty());
} }
void BytecodeGraphBuilder::AddBytecodePositionDecorator() {
DCHECK_NULL(decorator_);
decorator_ = graph_zone()->New<BytecodePositionDecorator>(node_origins_);
graph()->AddDecorator(decorator_);
}
void BytecodeGraphBuilder::RemoveBytecodePositionDecorator() {
DCHECK_NOT_NULL(decorator_);
graph()->RemoveDecorator(decorator_);
decorator_ = nullptr;
}
void BytecodeGraphBuilder::VisitLdaZero() { void BytecodeGraphBuilder::VisitLdaZero() {
Node* node = jsgraph()->ZeroConstant(); Node* node = jsgraph()->ZeroConstant();
environment()->BindAccumulator(node); environment()->BindAccumulator(node);
...@@ -4391,7 +4436,10 @@ Node* BytecodeGraphBuilder::MergeValue(Node* value, Node* other, ...@@ -4391,7 +4436,10 @@ Node* BytecodeGraphBuilder::MergeValue(Node* value, Node* other,
return value; return value;
} }
void BytecodeGraphBuilder::UpdateSourcePosition(int offset) { void BytecodeGraphBuilder::UpdateSourceAndBytecodePosition(int offset) {
if (node_origins_) {
node_origins_->SetCurrentBytecodePosition(offset);
}
if (source_position_iterator().done()) return; if (source_position_iterator().done()) return;
if (source_position_iterator().code_offset() == offset) { if (source_position_iterator().code_offset() == offset) {
source_positions_->SetCurrentPosition(SourcePosition( source_positions_->SetCurrentPosition(SourcePosition(
...@@ -4409,15 +4457,15 @@ void BuildGraphFromBytecode(JSHeapBroker* broker, Zone* local_zone, ...@@ -4409,15 +4457,15 @@ void BuildGraphFromBytecode(JSHeapBroker* broker, Zone* local_zone,
BytecodeOffset osr_offset, JSGraph* jsgraph, BytecodeOffset osr_offset, JSGraph* jsgraph,
CallFrequency const& invocation_frequency, CallFrequency const& invocation_frequency,
SourcePositionTable* source_positions, SourcePositionTable* source_positions,
int inlining_id, CodeKind code_kind, NodeOriginTable* node_origins, int inlining_id,
BytecodeGraphBuilderFlags flags, CodeKind code_kind, BytecodeGraphBuilderFlags flags,
TickCounter* tick_counter, TickCounter* tick_counter,
ObserveNodeInfo const& observe_node_info) { ObserveNodeInfo const& observe_node_info) {
BytecodeGraphBuilder builder( BytecodeGraphBuilder builder(
broker, local_zone, broker->target_native_context(), shared_info, broker, local_zone, broker->target_native_context(), shared_info,
feedback_cell, osr_offset, jsgraph, invocation_frequency, feedback_cell, osr_offset, jsgraph, invocation_frequency,
source_positions, inlining_id, code_kind, flags, tick_counter, source_positions, node_origins, inlining_id, code_kind, flags,
observe_node_info); tick_counter, observe_node_info);
builder.CreateGraph(); builder.CreateGraph();
} }
......
...@@ -26,6 +26,7 @@ namespace compiler { ...@@ -26,6 +26,7 @@ namespace compiler {
class JSGraph; class JSGraph;
class NodeObserver; class NodeObserver;
class SourcePositionTable; class SourcePositionTable;
class NodeOriginTable;
enum class BytecodeGraphBuilderFlag : uint8_t { enum class BytecodeGraphBuilderFlag : uint8_t {
kSkipFirstStackAndTierupCheck = 1 << 0, kSkipFirstStackAndTierupCheck = 1 << 0,
...@@ -45,8 +46,8 @@ void BuildGraphFromBytecode(JSHeapBroker* broker, Zone* local_zone, ...@@ -45,8 +46,8 @@ void BuildGraphFromBytecode(JSHeapBroker* broker, Zone* local_zone,
BytecodeOffset osr_offset, JSGraph* jsgraph, BytecodeOffset osr_offset, JSGraph* jsgraph,
CallFrequency const& invocation_frequency, CallFrequency const& invocation_frequency,
SourcePositionTable* source_positions, SourcePositionTable* source_positions,
int inlining_id, CodeKind code_kind, NodeOriginTable* node_origins, int inlining_id,
BytecodeGraphBuilderFlags flags, CodeKind code_kind, BytecodeGraphBuilderFlags flags,
TickCounter* tick_counter, TickCounter* tick_counter,
ObserveNodeInfo const& observe_node_info = {}); ObserveNodeInfo const& observe_node_info = {});
......
...@@ -18,9 +18,11 @@ class JSInliningHeuristic final : public AdvancedReducer { ...@@ -18,9 +18,11 @@ class JSInliningHeuristic final : public AdvancedReducer {
JSInliningHeuristic(Editor* editor, Zone* local_zone, JSInliningHeuristic(Editor* editor, Zone* local_zone,
OptimizedCompilationInfo* info, JSGraph* jsgraph, OptimizedCompilationInfo* info, JSGraph* jsgraph,
JSHeapBroker* broker, JSHeapBroker* broker,
SourcePositionTable* source_positions, Mode mode) SourcePositionTable* source_positions,
NodeOriginTable* node_origins, Mode mode)
: AdvancedReducer(editor), : AdvancedReducer(editor),
inliner_(editor, local_zone, info, jsgraph, broker, source_positions), inliner_(editor, local_zone, info, jsgraph, broker, source_positions,
node_origins),
candidates_(local_zone), candidates_(local_zone),
seen_(local_zone), seen_(local_zone),
source_positions_(source_positions), source_positions_(source_positions),
......
...@@ -579,8 +579,8 @@ Reduction JSInliner::ReduceJSCall(Node* node) { ...@@ -579,8 +579,8 @@ Reduction JSInliner::ReduceJSCall(Node* node) {
CallFrequency frequency = call.frequency(); CallFrequency frequency = call.frequency();
BuildGraphFromBytecode(broker(), zone(), *shared_info, feedback_cell, BuildGraphFromBytecode(broker(), zone(), *shared_info, feedback_cell,
BytecodeOffset::None(), jsgraph(), frequency, BytecodeOffset::None(), jsgraph(), frequency,
source_positions_, inlining_id, info_->code_kind(), source_positions_, node_origins_, inlining_id,
flags, &info_->tick_counter()); info_->code_kind(), flags, &info_->tick_counter());
} }
// Extract the inlinee start/end nodes. // Extract the inlinee start/end nodes.
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "src/compiler/graph-reducer.h" #include "src/compiler/graph-reducer.h"
#include "src/compiler/js-graph.h" #include "src/compiler/js-graph.h"
#include "src/compiler/node-origin-table.h"
namespace v8 { namespace v8 {
namespace internal { namespace internal {
...@@ -25,13 +26,15 @@ class JSInliner final : public AdvancedReducer { ...@@ -25,13 +26,15 @@ class JSInliner final : public AdvancedReducer {
public: public:
JSInliner(Editor* editor, Zone* local_zone, OptimizedCompilationInfo* info, JSInliner(Editor* editor, Zone* local_zone, OptimizedCompilationInfo* info,
JSGraph* jsgraph, JSHeapBroker* broker, JSGraph* jsgraph, JSHeapBroker* broker,
SourcePositionTable* source_positions) SourcePositionTable* source_positions,
NodeOriginTable* node_origins)
: AdvancedReducer(editor), : AdvancedReducer(editor),
local_zone_(local_zone), local_zone_(local_zone),
info_(info), info_(info),
jsgraph_(jsgraph), jsgraph_(jsgraph),
broker_(broker), broker_(broker),
source_positions_(source_positions) {} source_positions_(source_positions),
node_origins_(node_origins){}
const char* reducer_name() const override { return "JSInliner"; } const char* reducer_name() const override { return "JSInliner"; }
...@@ -61,6 +64,7 @@ class JSInliner final : public AdvancedReducer { ...@@ -61,6 +64,7 @@ class JSInliner final : public AdvancedReducer {
JSGraph* const jsgraph_; JSGraph* const jsgraph_;
JSHeapBroker* const broker_; JSHeapBroker* const broker_;
SourcePositionTable* const source_positions_; SourcePositionTable* const source_positions_;
NodeOriginTable* const node_origins_;
base::Optional<SharedFunctionInfoRef> DetermineCallTarget(Node* node); base::Optional<SharedFunctionInfoRef> DetermineCallTarget(Node* node);
FeedbackCellRef DetermineCallContext(Node* node, Node** context_out); FeedbackCellRef DetermineCallContext(Node* node, Node** context_out);
......
...@@ -17,6 +17,7 @@ void NodeOrigin::PrintJson(std::ostream& out) const { ...@@ -17,6 +17,7 @@ void NodeOrigin::PrintJson(std::ostream& out) const {
out << "\"nodeId\" : "; out << "\"nodeId\" : ";
break; break;
case kWasmBytecode: case kWasmBytecode:
case kJSBytecode:
out << "\"bytecodePosition\" : "; out << "\"bytecodePosition\" : ";
break; break;
} }
...@@ -42,6 +43,7 @@ NodeOriginTable::NodeOriginTable(Graph* graph) ...@@ -42,6 +43,7 @@ NodeOriginTable::NodeOriginTable(Graph* graph)
: graph_(graph), : graph_(graph),
decorator_(nullptr), decorator_(nullptr),
current_origin_(NodeOrigin::Unknown()), current_origin_(NodeOrigin::Unknown()),
current_bytecode_position_(0),
current_phase_name_("unknown"), current_phase_name_("unknown"),
table_(graph->zone()) {} table_(graph->zone()) {}
...@@ -70,6 +72,10 @@ void NodeOriginTable::SetNodeOrigin(Node* node, const NodeOrigin& no) { ...@@ -70,6 +72,10 @@ void NodeOriginTable::SetNodeOrigin(Node* node, const NodeOrigin& no) {
void NodeOriginTable::SetNodeOrigin(NodeId id, NodeId origin) { void NodeOriginTable::SetNodeOrigin(NodeId id, NodeId origin) {
table_.Set(id, NodeOrigin(current_phase_name_, "", origin)); table_.Set(id, NodeOrigin(current_phase_name_, "", origin));
} }
void NodeOriginTable::SetNodeOrigin(NodeId id, NodeOrigin::OriginKind kind,
NodeId origin) {
table_.Set(id, NodeOrigin(current_phase_name_, "", kind, origin));
}
void NodeOriginTable::PrintJson(std::ostream& os) const { void NodeOriginTable::PrintJson(std::ostream& os) const {
os << "{"; os << "{";
......
...@@ -16,7 +16,7 @@ namespace compiler { ...@@ -16,7 +16,7 @@ namespace compiler {
class NodeOrigin { class NodeOrigin {
public: public:
enum OriginKind { kWasmBytecode, kGraphNode }; enum OriginKind { kWasmBytecode, kGraphNode, kJSBytecode };
NodeOrigin(const char* phase_name, const char* reducer_name, NodeOrigin(const char* phase_name, const char* reducer_name,
NodeId created_from) NodeId created_from)
: phase_name_(phase_name), : phase_name_(phase_name),
...@@ -123,9 +123,16 @@ class V8_EXPORT_PRIVATE NodeOriginTable final ...@@ -123,9 +123,16 @@ class V8_EXPORT_PRIVATE NodeOriginTable final
NodeOrigin GetNodeOrigin(NodeId id) const; NodeOrigin GetNodeOrigin(NodeId id) const;
void SetNodeOrigin(Node* node, const NodeOrigin& no); void SetNodeOrigin(Node* node, const NodeOrigin& no);
void SetNodeOrigin(NodeId id, NodeId origin); void SetNodeOrigin(NodeId id, NodeId origin);
void SetNodeOrigin(NodeId id, NodeOrigin::OriginKind kind, NodeId origin);
void SetCurrentPosition(const NodeOrigin& no) { current_origin_ = no; } void SetCurrentPosition(const NodeOrigin& no) { current_origin_ = no; }
void SetCurrentBytecodePosition(int offset) {
current_bytecode_position_ = offset;
}
int GetCurrentBytecodePosition() { return current_bytecode_position_; }
void PrintJson(std::ostream& os) const; void PrintJson(std::ostream& os) const;
private: private:
...@@ -134,6 +141,7 @@ class V8_EXPORT_PRIVATE NodeOriginTable final ...@@ -134,6 +141,7 @@ class V8_EXPORT_PRIVATE NodeOriginTable final
Graph* const graph_; Graph* const graph_;
Decorator* decorator_; Decorator* decorator_;
NodeOrigin current_origin_; NodeOrigin current_origin_;
int current_bytecode_position_;
const char* current_phase_name_; const char* current_phase_name_;
static NodeOrigin UnknownNodeOrigin(Zone* zone) { static NodeOrigin UnknownNodeOrigin(Zone* zone) {
......
...@@ -1353,8 +1353,9 @@ struct GraphBuilderPhase { ...@@ -1353,8 +1353,9 @@ struct GraphBuilderPhase {
data->broker(), temp_zone, closure.shared(), data->broker(), temp_zone, closure.shared(),
closure.raw_feedback_cell(data->dependencies()), closure.raw_feedback_cell(data->dependencies()),
data->info()->osr_offset(), data->jsgraph(), frequency, data->info()->osr_offset(), data->jsgraph(), frequency,
data->source_positions(), SourcePosition::kNotInlined, data->source_positions(), data->node_origins(),
data->info()->code_kind(), flags, &data->info()->tick_counter(), SourcePosition::kNotInlined, data->info()->code_kind(),
flags, &data->info()->tick_counter(),
ObserveNodeInfo{data->observe_node_manager(), ObserveNodeInfo{data->observe_node_manager(),
data->info()->node_observer()}); data->info()->node_observer()});
} }
...@@ -1402,7 +1403,8 @@ struct InliningPhase { ...@@ -1402,7 +1403,8 @@ struct InliningPhase {
data->dependencies(), temp_zone, info->zone()); data->dependencies(), temp_zone, info->zone());
JSInliningHeuristic inlining( JSInliningHeuristic inlining(
&graph_reducer, temp_zone, data->info(), data->jsgraph(), &graph_reducer, temp_zone, data->info(), data->jsgraph(),
data->broker(), data->source_positions(), JSInliningHeuristic::kJSOnly); data->broker(), data->source_positions(), data->node_origins(),
JSInliningHeuristic::kJSOnly);
JSIntrinsicLowering intrinsic_lowering(&graph_reducer, data->jsgraph(), JSIntrinsicLowering intrinsic_lowering(&graph_reducer, data->jsgraph(),
data->broker()); data->broker());
...@@ -1443,6 +1445,7 @@ struct JSWasmInliningPhase { ...@@ -1443,6 +1445,7 @@ struct JSWasmInliningPhase {
JSInliningHeuristic inlining(&graph_reducer, temp_zone, data->info(), JSInliningHeuristic inlining(&graph_reducer, temp_zone, data->info(),
data->jsgraph(), data->broker(), data->jsgraph(), data->broker(),
data->source_positions(), data->source_positions(),
data->node_origins(),
JSInliningHeuristic::kWasmOnly); JSInliningHeuristic::kWasmOnly);
AddReducer(data, &graph_reducer, &dead_code_elimination); AddReducer(data, &graph_reducer, &dead_code_elimination);
AddReducer(data, &graph_reducer, &common_reducer); AddReducer(data, &graph_reducer, &common_reducer);
...@@ -3676,7 +3679,7 @@ bool PipelineImpl::SelectInstructions(Linkage* linkage) { ...@@ -3676,7 +3679,7 @@ bool PipelineImpl::SelectInstructions(Linkage* linkage) {
} else { } else {
source_position_output << "{}"; source_position_output << "{}";
} }
source_position_output << ",\n\"NodeOrigins\" : "; source_position_output << ",\n\"nodeOrigins\" : ";
data_->node_origins()->PrintJson(source_position_output); data_->node_origins()->PrintJson(source_position_output);
data_->set_source_position_output(source_position_output.str()); data_->set_source_position_output(source_position_output.str());
} }
......
...@@ -34,7 +34,7 @@ void JSONTurboshaftGraphWriter::PrintNodes() { ...@@ -34,7 +34,7 @@ void JSONTurboshaftGraphWriter::PrintNodes() {
OpIndex index = turboshaft_graph_.Index(op); OpIndex index = turboshaft_graph_.Index(op);
if (!first) os_ << ",\n"; if (!first) os_ << ",\n";
first = false; first = false;
os_ << "{\"id\":" << turboshaft_graph_.Index(op).id() << ","; os_ << "{\"id\":" << index.id() << ",";
os_ << "\"title\":\"" << OpcodeName(op.opcode) << "\","; os_ << "\"title\":\"" << OpcodeName(op.opcode) << "\",";
os_ << "\"block_id\":" << block.index().id() << ","; os_ << "\"block_id\":" << block.index().id() << ",";
os_ << "\"op_properties_type\":\"" << op.properties() << "\""; os_ << "\"op_properties_type\":\"" << op.properties() << "\"";
......
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