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" |
(...skipping 17 matching lines...) Expand all Loading... |
28 void AddExpressionPosition(size_t bytecode_offset, int source_position); | 28 void AddExpressionPosition(size_t bytecode_offset, int source_position); |
29 void RevertPosition(size_t bytecode_offset); | 29 void RevertPosition(size_t bytecode_offset); |
30 Handle<FixedArray> ToFixedArray(); | 30 Handle<FixedArray> ToFixedArray(); |
31 | 31 |
32 private: | 32 private: |
33 struct Entry { | 33 struct Entry { |
34 int bytecode_offset; | 34 int bytecode_offset; |
35 uint32_t source_position_and_type; | 35 uint32_t source_position_and_type; |
36 }; | 36 }; |
37 | 37 |
38 void AssertMonotonic(int bytecode_offset) { | 38 bool CodeOffsetHasPosition(int bytecode_offset) { |
39 DCHECK(entries_.size() == 0 || | 39 // Return whether bytecode offset already has a position assigned. |
40 entries_.back().bytecode_offset < bytecode_offset); | 40 return entries_.size() > 0 && |
| 41 entries_.back().bytecode_offset == bytecode_offset; |
41 } | 42 } |
42 | 43 |
43 Isolate* isolate_; | 44 Isolate* isolate_; |
44 ZoneVector<Entry> entries_; | 45 ZoneVector<Entry> entries_; |
45 }; | 46 }; |
46 | 47 |
47 class SourcePositionTableIterator { | 48 class SourcePositionTableIterator { |
48 public: | 49 public: |
49 explicit SourcePositionTableIterator(BytecodeArray* bytecode_array); | 50 explicit SourcePositionTableIterator(BytecodeArray* bytecode_array); |
50 | 51 |
(...skipping 21 matching lines...) Expand all Loading... |
72 int bytecode_offset_; | 73 int bytecode_offset_; |
73 int source_position_; | 74 int source_position_; |
74 DisallowHeapAllocation no_gc; | 75 DisallowHeapAllocation no_gc; |
75 }; | 76 }; |
76 | 77 |
77 } // namespace interpreter | 78 } // namespace interpreter |
78 } // namespace internal | 79 } // namespace internal |
79 } // namespace v8 | 80 } // namespace v8 |
80 | 81 |
81 #endif // V8_INTERPRETER_SOURCE_POSITION_TABLE_H_ | 82 #endif // V8_INTERPRETER_SOURCE_POSITION_TABLE_H_ |
OLD | NEW |