| 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 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 | 32 |
| 33 inline bool operator==(const SourcePosition& lhs, const SourcePosition& rhs) { | 33 inline bool operator==(const SourcePosition& lhs, const SourcePosition& rhs) { |
| 34 return lhs.raw() == rhs.raw(); | 34 return lhs.raw() == rhs.raw(); |
| 35 } | 35 } |
| 36 | 36 |
| 37 inline bool operator!=(const SourcePosition& lhs, const SourcePosition& rhs) { | 37 inline bool operator!=(const SourcePosition& lhs, const SourcePosition& rhs) { |
| 38 return !(lhs == rhs); | 38 return !(lhs == rhs); |
| 39 } | 39 } |
| 40 | 40 |
| 41 | 41 class SourcePositionTable final : public ZoneObject { |
| 42 class SourcePositionTable final { | |
| 43 public: | 42 public: |
| 44 class Scope final { | 43 class Scope final { |
| 45 public: | 44 public: |
| 46 Scope(SourcePositionTable* source_positions, SourcePosition position) | 45 Scope(SourcePositionTable* source_positions, SourcePosition position) |
| 47 : source_positions_(source_positions), | 46 : source_positions_(source_positions), |
| 48 prev_position_(source_positions->current_position_) { | 47 prev_position_(source_positions->current_position_) { |
| 49 Init(position); | 48 Init(position); |
| 50 } | 49 } |
| 51 Scope(SourcePositionTable* source_positions, Node* node) | 50 Scope(SourcePositionTable* source_positions, Node* node) |
| 52 : source_positions_(source_positions), | 51 : source_positions_(source_positions), |
| (...skipping 11 matching lines...) Expand all Loading... |
| 64 SourcePosition const prev_position_; | 63 SourcePosition const prev_position_; |
| 65 DISALLOW_COPY_AND_ASSIGN(Scope); | 64 DISALLOW_COPY_AND_ASSIGN(Scope); |
| 66 }; | 65 }; |
| 67 | 66 |
| 68 explicit SourcePositionTable(Graph* graph); | 67 explicit SourcePositionTable(Graph* graph); |
| 69 | 68 |
| 70 void AddDecorator(); | 69 void AddDecorator(); |
| 71 void RemoveDecorator(); | 70 void RemoveDecorator(); |
| 72 | 71 |
| 73 SourcePosition GetSourcePosition(Node* node) const; | 72 SourcePosition GetSourcePosition(Node* node) const; |
| 73 void SetSourcePosition(Node* node, SourcePosition position); |
| 74 | 74 |
| 75 void Print(std::ostream& os) const; | 75 void Print(std::ostream& os) const; |
| 76 | 76 |
| 77 private: | 77 private: |
| 78 class Decorator; | 78 class Decorator; |
| 79 | 79 |
| 80 Graph* const graph_; | 80 Graph* const graph_; |
| 81 Decorator* decorator_; | 81 Decorator* decorator_; |
| 82 SourcePosition current_position_; | 82 SourcePosition current_position_; |
| 83 NodeAuxData<SourcePosition> table_; | 83 NodeAuxData<SourcePosition> table_; |
| 84 | 84 |
| 85 DISALLOW_COPY_AND_ASSIGN(SourcePositionTable); | 85 DISALLOW_COPY_AND_ASSIGN(SourcePositionTable); |
| 86 }; | 86 }; |
| 87 | 87 |
| 88 } // namespace compiler | 88 } // namespace compiler |
| 89 } // namespace internal | 89 } // namespace internal |
| 90 } // namespace v8 | 90 } // namespace v8 |
| 91 | 91 |
| 92 #endif // V8_COMPILER_SOURCE_POSITION_H_ | 92 #endif // V8_COMPILER_SOURCE_POSITION_H_ |
| OLD | NEW |