| Index: src/compiler/pipeline.cc
|
| diff --git a/src/compiler/pipeline.cc b/src/compiler/pipeline.cc
|
| index fad9e489b7562dbf5a58bd1461cc597b3435a4b5..60ce5fa27965b57673d2859e536b99877045e26f 100644
|
| --- a/src/compiler/pipeline.cc
|
| +++ b/src/compiler/pipeline.cc
|
| @@ -103,7 +103,6 @@ class PipelineData {
|
| register_allocation_data_(nullptr) {
|
| PhaseScope scope(pipeline_statistics, "init pipeline data");
|
| graph_ = new (graph_zone_) Graph(graph_zone_);
|
| - source_positions_.Reset(new SourcePositionTable(graph_));
|
| simplified_ = new (graph_zone_) SimplifiedOperatorBuilder(graph_zone_);
|
| machine_ = new (graph_zone_) MachineOperatorBuilder(
|
| graph_zone_, MachineType::PointerRepresentation(),
|
| @@ -127,7 +126,6 @@ class PipelineData {
|
| graph_zone_scope_(zone_pool_),
|
| graph_zone_(nullptr),
|
| graph_(graph),
|
| - source_positions_(new SourcePositionTable(graph_)),
|
| loop_assignment_(nullptr),
|
| simplified_(nullptr),
|
| machine_(nullptr),
|
| @@ -194,7 +192,12 @@ class PipelineData {
|
|
|
| Zone* graph_zone() const { return graph_zone_; }
|
| Graph* graph() const { return graph_; }
|
| - SourcePositionTable* source_positions() const {
|
| + SourcePositionTable* source_positions() {
|
| + // First check whether the CompilationInfo provides the table
|
| + if (auto* table = info()->GetSourcePositionTable()) return table;
|
| + // Lazy initialization
|
| + if (source_positions_.is_empty())
|
| + source_positions_.Reset(new SourcePositionTable(graph()));
|
| return source_positions_.get();
|
| }
|
| MachineOperatorBuilder* machine() const { return machine_; }
|
| @@ -400,15 +403,15 @@ class AstGraphBuilderWithPositions final : public AstGraphBuilder {
|
| start_position_(info->shared_info()->start_position()) {}
|
|
|
| bool CreateGraph(bool stack_check) {
|
| - SourcePositionTable::Scope pos_scope(source_positions_, start_position_);
|
| + SourcePositionScope pos_scope(source_positions_, start_position_);
|
| return AstGraphBuilder::CreateGraph(stack_check);
|
| }
|
|
|
| -#define DEF_VISIT(type) \
|
| - void Visit##type(type* node) override { \
|
| - SourcePositionTable::Scope pos(source_positions_, \
|
| - SourcePosition(node->position())); \
|
| - AstGraphBuilder::Visit##type(node); \
|
| +#define DEF_VISIT(type) \
|
| + void Visit##type(type* node) override { \
|
| + SourcePositionScope pos(source_positions_, \
|
| + SourcePosition(node->position())); \
|
| + AstGraphBuilder::Visit##type(node); \
|
| }
|
| AST_NODE_LIST(DEF_VISIT)
|
| #undef DEF_VISIT
|
| @@ -427,7 +430,7 @@ class SourcePositionWrapper final : public Reducer {
|
|
|
| Reduction Reduce(Node* node) final {
|
| SourcePosition const pos = table_->GetSourcePosition(node);
|
| - SourcePositionTable::Scope position(table_, pos);
|
| + SourcePositionScope position(table_, pos);
|
| return reducer_->Reduce(node);
|
| }
|
|
|
|
|