5 #ifndef V8_SOURCE_POSITION_TABLE_H_ 6 #define V8_SOURCE_POSITION_TABLE_H_ 8 #include "src/assert-scope.h" 9 #include "src/checks.h" 10 #include "src/globals.h" 11 #include "src/source-position.h" 12 #include "src/zone/zone-containers.h" 25 : code_offset(0), source_position(0), is_statement(
false) {}
27 : code_offset(offset), source_position(source), is_statement(statement) {}
36 enum RecordingMode { OMIT_SOURCE_POSITIONS, RECORD_SOURCE_POSITIONS };
39 RecordingMode mode = RECORD_SOURCE_POSITIONS);
41 void AddPosition(
size_t code_offset,
SourcePosition source_position,
50 inline bool Omit()
const {
return mode_ == OMIT_SOURCE_POSITIONS; }
53 std::vector<byte> bytes_;
54 #ifdef ENABLE_SLOW_DCHECKS 55 std::vector<PositionTableEntry> raw_entries_;
86 int code_offset()
const {
88 return current_.code_offset;
92 return SourcePosition::FromRaw(current_.source_position);
94 bool is_statement()
const {
96 return current_.is_statement;
98 bool done()
const {
return index_ == kDone; }
100 IndexAndPosition GetState()
const {
return {index_, current_}; }
102 void RestoreState(
const IndexAndPosition& saved_state) {
103 index_ = saved_state.index_;
104 current_ = saved_state.position_;
108 static const int kDone = -1;
110 Vector<const byte> raw_table_;
111 Handle<ByteArray> table_;
113 PositionTableEntry current_;
114 DISALLOW_HEAP_ALLOCATION(no_gc);
120 #endif // V8_SOURCE_POSITION_TABLE_H_