Index: src/interpreter/source-position-table.h |
diff --git a/src/interpreter/source-position-table.h b/src/interpreter/source-position-table.h |
index 9a80ead570eedfc02d9af7a6b56b064f80bb2d4e..0eb885241bcc2ca5d79a84edd8fa54986e1a7b4c 100644 |
--- a/src/interpreter/source-position-table.h |
+++ b/src/interpreter/source-position-table.h |
@@ -36,28 +36,40 @@ struct PositionTableEntry { |
class SourcePositionTableBuilder : public PositionsRecorder { |
public: |
+ enum OnDuplicateCodeOffset { |
+ DISCARD_DUPLICATE, |
+ OVERWRITE_DUPLICATE, |
+ }; |
+ |
explicit SourcePositionTableBuilder(Isolate* isolate, Zone* zone) |
: isolate_(isolate), |
bytes_(zone), |
#ifdef ENABLE_SLOW_DCHECKS |
raw_entries_(zone), |
#endif |
- previous_() { |
+ candidate_(kUninitializedCandidateOffset, 0, false) { |
} |
- void AddStatementPosition(size_t bytecode_offset, int source_position); |
+ void AddStatementPosition( |
+ size_t bytecode_offset, int source_position, |
+ OnDuplicateCodeOffset on_duplicate = DISCARD_DUPLICATE); |
void AddExpressionPosition(size_t bytecode_offset, int source_position); |
Handle<ByteArray> ToSourcePositionTable(); |
private: |
- void AddEntry(const PositionTableEntry& entry); |
+ static const int kUninitializedCandidateOffset = -1; |
+ |
+ void AddEntry(const PositionTableEntry& entry, |
+ OnDuplicateCodeOffset on_duplicate = DISCARD_DUPLICATE); |
+ void CommitEntry(); |
Isolate* isolate_; |
ZoneVector<byte> bytes_; |
#ifdef ENABLE_SLOW_DCHECKS |
ZoneVector<PositionTableEntry> raw_entries_; |
#endif |
- PositionTableEntry previous_; |
+ PositionTableEntry candidate_; // Next entry to be written, if initialized. |
+ PositionTableEntry previous_; // Previously written entry, to compute delta. |
}; |
class SourcePositionTableIterator { |