OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/compiler/graph-inl.h" | 5 #include "src/compiler/graph-inl.h" |
6 #include "src/compiler/lowering-builder.h" | 6 #include "src/compiler/lowering-builder.h" |
7 #include "src/compiler/node-aux-data-inl.h" | 7 #include "src/compiler/node-aux-data-inl.h" |
8 #include "src/compiler/node-properties-inl.h" | 8 #include "src/compiler/node-properties-inl.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
11 namespace internal { | 11 namespace internal { |
12 namespace compiler { | 12 namespace compiler { |
13 | 13 |
14 class LoweringBuilder::NodeVisitor : public NullNodeVisitor { | 14 class LoweringBuilder::NodeVisitor : public NullNodeVisitor { |
15 public: | 15 public: |
16 explicit NodeVisitor(LoweringBuilder* lowering) : lowering_(lowering) {} | 16 explicit NodeVisitor(LoweringBuilder* lowering) : lowering_(lowering) {} |
17 | 17 |
18 GenericGraphVisit::Control Post(Node* node) { | 18 GenericGraphVisit::Control Post(Node* node) { |
19 SourcePositionTable::Scope pos(lowering_->source_positions_, node); | 19 if (lowering_->source_positions_ != NULL) { |
20 lowering_->Lower(node); | 20 SourcePositionTable::Scope pos(lowering_->source_positions_, node); |
| 21 lowering_->Lower(node); |
| 22 } else { |
| 23 lowering_->Lower(node); |
| 24 } |
21 return GenericGraphVisit::CONTINUE; | 25 return GenericGraphVisit::CONTINUE; |
22 } | 26 } |
23 | 27 |
24 private: | 28 private: |
25 LoweringBuilder* lowering_; | 29 LoweringBuilder* lowering_; |
26 }; | 30 }; |
27 | 31 |
28 | 32 |
29 LoweringBuilder::LoweringBuilder(Graph* graph, | 33 LoweringBuilder::LoweringBuilder(Graph* graph, |
30 SourcePositionTable* source_positions) | 34 SourcePositionTable* source_positions) |
31 : graph_(graph), source_positions_(source_positions) {} | 35 : graph_(graph), source_positions_(source_positions) {} |
32 | 36 |
33 | 37 |
34 void LoweringBuilder::LowerAllNodes() { | 38 void LoweringBuilder::LowerAllNodes() { |
35 NodeVisitor visitor(this); | 39 NodeVisitor visitor(this); |
36 graph()->VisitNodeInputsFromEnd(&visitor); | 40 graph()->VisitNodeInputsFromEnd(&visitor); |
37 } | 41 } |
38 | 42 |
39 } // namespace compiler | 43 } // namespace compiler |
40 } // namespace internal | 44 } // namespace internal |
41 } // namespace v8 | 45 } // namespace v8 |
OLD | NEW |