OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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_INTERPRETER_SOURCE_POSITION_TABLE_H_ | 5 #ifndef V8_INTERPRETER_SOURCE_POSITION_TABLE_H_ |
6 #define V8_INTERPRETER_SOURCE_POSITION_TABLE_H_ | 6 #define V8_INTERPRETER_SOURCE_POSITION_TABLE_H_ |
7 | 7 |
8 #include "src/assert-scope.h" | 8 #include "src/assert-scope.h" |
9 #include "src/handles.h" | 9 #include "src/handles.h" |
10 #include "src/zone.h" | 10 #include "src/zone.h" |
11 #include "src/zone-containers.h" | 11 #include "src/zone-containers.h" |
12 | 12 |
13 namespace v8 { | 13 namespace v8 { |
14 namespace internal { | 14 namespace internal { |
15 | 15 |
16 class BytecodeArray; | 16 class BytecodeArray; |
17 class FixedArray; | 17 class FixedArray; |
18 class Isolate; | 18 class Isolate; |
19 | 19 |
20 namespace interpreter { | 20 namespace interpreter { |
21 | 21 |
22 class SourcePositionTableBuilder { | 22 class SourcePositionTableBuilder { |
23 public: | 23 public: |
24 explicit SourcePositionTableBuilder(Isolate* isolate, Zone* zone) | 24 explicit SourcePositionTableBuilder(Isolate* isolate, Zone* zone) |
25 : isolate_(isolate), entries_(zone) {} | 25 : isolate_(isolate), entries_(zone) {} |
26 | 26 |
27 void AddStatementPosition(int bytecode_offset, int source_position); | 27 void AddStatementPosition(size_t bytecode_offset, int source_position); |
28 void AddExpressionPosition(int bytecode_offset, int source_position); | 28 void AddExpressionPosition(size_t bytecode_offset, int source_position); |
| 29 void RevertPosition(size_t bytecode_offset); |
29 Handle<FixedArray> ToFixedArray(); | 30 Handle<FixedArray> ToFixedArray(); |
30 | 31 |
31 private: | 32 private: |
32 struct Entry { | 33 struct Entry { |
33 int bytecode_offset; | 34 int bytecode_offset; |
34 uint32_t source_position_and_type; | 35 uint32_t source_position_and_type; |
35 }; | 36 }; |
36 | 37 |
37 void AssertMonotonic(int bytecode_offset) { | 38 void AssertMonotonic(int bytecode_offset) { |
38 DCHECK(entries_.size() == 0 || | 39 DCHECK(entries_.size() == 0 || |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 int bytecode_offset_; | 74 int bytecode_offset_; |
74 int source_position_; | 75 int source_position_; |
75 DisallowHeapAllocation no_gc; | 76 DisallowHeapAllocation no_gc; |
76 }; | 77 }; |
77 | 78 |
78 } // namespace interpreter | 79 } // namespace interpreter |
79 } // namespace internal | 80 } // namespace internal |
80 } // namespace v8 | 81 } // namespace v8 |
81 | 82 |
82 #endif // V8_INTERPRETER_SOURCE_POSITION_TABLE_H_ | 83 #endif // V8_INTERPRETER_SOURCE_POSITION_TABLE_H_ |
OLD | NEW |