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 #ifndef V8_COMPILER_SOURCE_POSITION_H_ | 5 #ifndef V8_COMPILER_SOURCE_POSITION_H_ |
6 #define V8_COMPILER_SOURCE_POSITION_H_ | 6 #define V8_COMPILER_SOURCE_POSITION_H_ |
7 | 7 |
8 #include "src/assembler.h" | 8 #include "src/assembler.h" |
9 #include "src/compiler/node-aux-data.h" | 9 #include "src/compiler/node-aux-data.h" |
10 | 10 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 void Init(SourcePosition position) { | 59 void Init(SourcePosition position) { |
60 if (position.IsKnown()) source_positions_->current_position_ = position; | 60 if (position.IsKnown()) source_positions_->current_position_ = position; |
61 } | 61 } |
62 | 62 |
63 SourcePositionTable* const source_positions_; | 63 SourcePositionTable* const source_positions_; |
64 SourcePosition const prev_position_; | 64 SourcePosition const prev_position_; |
65 DISALLOW_COPY_AND_ASSIGN(Scope); | 65 DISALLOW_COPY_AND_ASSIGN(Scope); |
66 }; | 66 }; |
67 | 67 |
68 explicit SourcePositionTable(Graph* graph); | 68 explicit SourcePositionTable(Graph* graph); |
69 ~SourcePositionTable() { | |
70 if (decorator_) RemoveDecorator(); | |
71 } | |
72 | 69 |
73 void AddDecorator(); | 70 void AddDecorator(); |
74 void RemoveDecorator(); | 71 void RemoveDecorator(); |
75 | 72 |
76 SourcePosition GetSourcePosition(Node* node) const; | 73 SourcePosition GetSourcePosition(Node* node) const; |
77 | 74 |
78 void Print(std::ostream& os) const; | 75 void Print(std::ostream& os) const; |
79 | 76 |
80 private: | 77 private: |
81 class Decorator; | 78 class Decorator; |
82 | 79 |
83 Graph* const graph_; | 80 Graph* const graph_; |
84 Decorator* decorator_; | 81 Decorator* decorator_; |
85 SourcePosition current_position_; | 82 SourcePosition current_position_; |
86 NodeAuxData<SourcePosition> table_; | 83 NodeAuxData<SourcePosition> table_; |
87 | 84 |
88 DISALLOW_COPY_AND_ASSIGN(SourcePositionTable); | 85 DISALLOW_COPY_AND_ASSIGN(SourcePositionTable); |
89 }; | 86 }; |
90 | 87 |
91 } // namespace compiler | 88 } // namespace compiler |
92 } // namespace internal | 89 } // namespace internal |
93 } // namespace v8 | 90 } // namespace v8 |
94 | 91 |
95 #endif // V8_COMPILER_SOURCE_POSITION_H_ | 92 #endif // V8_COMPILER_SOURCE_POSITION_H_ |
OLD | NEW |