| 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_SOURCE_POSITION_TABLE_H_ | 5 #ifndef V8_SOURCE_POSITION_TABLE_H_ |
| 6 #define V8_SOURCE_POSITION_TABLE_H_ | 6 #define V8_SOURCE_POSITION_TABLE_H_ |
| 7 | 7 |
| 8 #include "src/assert-scope.h" | 8 #include "src/assert-scope.h" |
| 9 #include "src/checks.h" | 9 #include "src/checks.h" |
| 10 #include "src/handles.h" | 10 #include "src/handles.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 PositionTableEntry(int offset, int source, bool statement) | 25 PositionTableEntry(int offset, int source, bool statement) |
| 26 : code_offset(offset), source_position(source), is_statement(statement) {} | 26 : code_offset(offset), source_position(source), is_statement(statement) {} |
| 27 | 27 |
| 28 int code_offset; | 28 int code_offset; |
| 29 int source_position; | 29 int source_position; |
| 30 bool is_statement; | 30 bool is_statement; |
| 31 }; | 31 }; |
| 32 | 32 |
| 33 class SourcePositionTableBuilder { | 33 class SourcePositionTableBuilder { |
| 34 public: | 34 public: |
| 35 SourcePositionTableBuilder(Isolate* isolate, Zone* zone); | 35 enum RecordingMode { OMIT_SOURCE_POSITIONS, RECORD_SOURCE_POSITIONS }; |
| 36 |
| 37 SourcePositionTableBuilder(Isolate* isolate, Zone* zone, |
| 38 RecordingMode mode = RECORD_SOURCE_POSITIONS); |
| 36 | 39 |
| 37 void EndJitLogging(AbstractCode* code); | 40 void EndJitLogging(AbstractCode* code); |
| 38 | 41 |
| 39 void AddPosition(size_t code_offset, int source_position, bool is_statement); | 42 void AddPosition(size_t code_offset, int source_position, bool is_statement); |
| 40 Handle<ByteArray> ToSourcePositionTable(); | 43 Handle<ByteArray> ToSourcePositionTable(); |
| 41 | 44 |
| 42 private: | 45 private: |
| 43 void AddEntry(const PositionTableEntry& entry); | 46 void AddEntry(const PositionTableEntry& entry); |
| 44 | 47 |
| 48 inline bool Omit() const { return mode_ == OMIT_SOURCE_POSITIONS; } |
| 49 |
| 45 Isolate* isolate_; | 50 Isolate* isolate_; |
| 51 RecordingMode mode_; |
| 46 ZoneVector<byte> bytes_; | 52 ZoneVector<byte> bytes_; |
| 47 #ifdef ENABLE_SLOW_DCHECKS | 53 #ifdef ENABLE_SLOW_DCHECKS |
| 48 ZoneVector<PositionTableEntry> raw_entries_; | 54 ZoneVector<PositionTableEntry> raw_entries_; |
| 49 #endif | 55 #endif |
| 50 PositionTableEntry previous_; // Previously written entry, to compute delta. | 56 PositionTableEntry previous_; // Previously written entry, to compute delta. |
| 51 // Currently jit_handler_data_ is used to store JITHandler-specific data | 57 // Currently jit_handler_data_ is used to store JITHandler-specific data |
| 52 // over the lifetime of a SourcePositionTableBuilder. | 58 // over the lifetime of a SourcePositionTableBuilder. |
| 53 void* jit_handler_data_; | 59 void* jit_handler_data_; |
| 54 }; | 60 }; |
| 55 | 61 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 79 ByteArray* table_; | 85 ByteArray* table_; |
| 80 int index_; | 86 int index_; |
| 81 PositionTableEntry current_; | 87 PositionTableEntry current_; |
| 82 DisallowHeapAllocation no_gc; | 88 DisallowHeapAllocation no_gc; |
| 83 }; | 89 }; |
| 84 | 90 |
| 85 } // namespace internal | 91 } // namespace internal |
| 86 } // namespace v8 | 92 } // namespace v8 |
| 87 | 93 |
| 88 #endif // V8_SOURCE_POSITION_TABLE_H_ | 94 #endif // V8_SOURCE_POSITION_TABLE_H_ |
| OLD | NEW |