| 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 16 matching lines...) Expand all Loading... |
| 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 enum RecordingMode { OMIT_SOURCE_POSITIONS, RECORD_SOURCE_POSITIONS }; | 35 enum RecordingMode { OMIT_SOURCE_POSITIONS, RECORD_SOURCE_POSITIONS }; |
| 36 | 36 |
| 37 SourcePositionTableBuilder(Isolate* isolate, Zone* zone, | 37 SourcePositionTableBuilder(Zone* zone, |
| 38 RecordingMode mode = RECORD_SOURCE_POSITIONS); | 38 RecordingMode mode = RECORD_SOURCE_POSITIONS); |
| 39 | 39 |
| 40 void EndJitLogging(AbstractCode* code); | 40 void AddPosition(size_t code_offset, int source_position, bool is_statement); |
| 41 | 41 |
| 42 void AddPosition(size_t code_offset, int source_position, bool is_statement); | 42 Handle<ByteArray> ToSourcePositionTable(Isolate* isolate, |
| 43 Handle<ByteArray> ToSourcePositionTable(); | 43 Handle<AbstractCode> code); |
| 44 | 44 |
| 45 private: | 45 private: |
| 46 void AddEntry(const PositionTableEntry& entry); | 46 void AddEntry(const PositionTableEntry& entry); |
| 47 | 47 |
| 48 inline bool Omit() const { return mode_ == OMIT_SOURCE_POSITIONS; } | 48 inline bool Omit() const { return mode_ == OMIT_SOURCE_POSITIONS; } |
| 49 | 49 |
| 50 Isolate* isolate_; | |
| 51 RecordingMode mode_; | 50 RecordingMode mode_; |
| 52 ZoneVector<byte> bytes_; | 51 ZoneVector<byte> bytes_; |
| 53 #ifdef ENABLE_SLOW_DCHECKS | 52 #ifdef ENABLE_SLOW_DCHECKS |
| 54 ZoneVector<PositionTableEntry> raw_entries_; | 53 ZoneVector<PositionTableEntry> raw_entries_; |
| 55 #endif | 54 #endif |
| 56 PositionTableEntry previous_; // Previously written entry, to compute delta. | 55 PositionTableEntry previous_; // Previously written entry, to compute delta. |
| 57 // Currently jit_handler_data_ is used to store JITHandler-specific data | |
| 58 // over the lifetime of a SourcePositionTableBuilder. | |
| 59 void* jit_handler_data_; | |
| 60 }; | 56 }; |
| 61 | 57 |
| 62 class SourcePositionTableIterator { | 58 class SourcePositionTableIterator { |
| 63 public: | 59 public: |
| 64 explicit SourcePositionTableIterator(ByteArray* byte_array); | 60 explicit SourcePositionTableIterator(ByteArray* byte_array); |
| 65 | 61 |
| 66 void Advance(); | 62 void Advance(); |
| 67 | 63 |
| 68 int code_offset() const { | 64 int code_offset() const { |
| 69 DCHECK(!done()); | 65 DCHECK(!done()); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 85 ByteArray* table_; | 81 ByteArray* table_; |
| 86 int index_; | 82 int index_; |
| 87 PositionTableEntry current_; | 83 PositionTableEntry current_; |
| 88 DisallowHeapAllocation no_gc; | 84 DisallowHeapAllocation no_gc; |
| 89 }; | 85 }; |
| 90 | 86 |
| 91 } // namespace internal | 87 } // namespace internal |
| 92 } // namespace v8 | 88 } // namespace v8 |
| 93 | 89 |
| 94 #endif // V8_SOURCE_POSITION_TABLE_H_ | 90 #endif // V8_SOURCE_POSITION_TABLE_H_ |
| OLD | NEW |