Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1337)

Side by Side Diff: src/interpreter/source-position-table.h

Issue 1801473003: [ignition, debugger] correctly set position for return with elided bytecode. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: do not use --ignition flag Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/interpreter/bytecode-array-builder.cc ('k') | src/interpreter/source-position-table.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/checks.h" 9 #include "src/checks.h"
10 #include "src/handles.h" 10 #include "src/handles.h"
(...skipping 18 matching lines...) Expand all
29 source_position(source), 29 source_position(source),
30 is_statement(statement) {} 30 is_statement(statement) {}
31 31
32 int bytecode_offset; 32 int bytecode_offset;
33 int source_position; 33 int source_position;
34 bool is_statement; 34 bool is_statement;
35 }; 35 };
36 36
37 class SourcePositionTableBuilder : public PositionsRecorder { 37 class SourcePositionTableBuilder : public PositionsRecorder {
38 public: 38 public:
39 enum OnDuplicateCodeOffset {
40 DISCARD_DUPLICATE,
41 OVERWRITE_DUPLICATE,
42 };
43
39 explicit SourcePositionTableBuilder(Isolate* isolate, Zone* zone) 44 explicit SourcePositionTableBuilder(Isolate* isolate, Zone* zone)
40 : isolate_(isolate), 45 : isolate_(isolate),
41 bytes_(zone), 46 bytes_(zone),
42 #ifdef ENABLE_SLOW_DCHECKS 47 #ifdef ENABLE_SLOW_DCHECKS
43 raw_entries_(zone), 48 raw_entries_(zone),
44 #endif 49 #endif
45 previous_() { 50 candidate_(kUninitializedCandidateOffset, 0, false) {
46 } 51 }
47 52
48 void AddStatementPosition(size_t bytecode_offset, int source_position); 53 void AddStatementPosition(
54 size_t bytecode_offset, int source_position,
55 OnDuplicateCodeOffset on_duplicate = DISCARD_DUPLICATE);
49 void AddExpressionPosition(size_t bytecode_offset, int source_position); 56 void AddExpressionPosition(size_t bytecode_offset, int source_position);
50 Handle<ByteArray> ToSourcePositionTable(); 57 Handle<ByteArray> ToSourcePositionTable();
51 58
52 private: 59 private:
53 void AddEntry(const PositionTableEntry& entry); 60 static const int kUninitializedCandidateOffset = -1;
61
62 void AddEntry(const PositionTableEntry& entry,
63 OnDuplicateCodeOffset on_duplicate = DISCARD_DUPLICATE);
64 void CommitEntry();
54 65
55 Isolate* isolate_; 66 Isolate* isolate_;
56 ZoneVector<byte> bytes_; 67 ZoneVector<byte> bytes_;
57 #ifdef ENABLE_SLOW_DCHECKS 68 #ifdef ENABLE_SLOW_DCHECKS
58 ZoneVector<PositionTableEntry> raw_entries_; 69 ZoneVector<PositionTableEntry> raw_entries_;
59 #endif 70 #endif
60 PositionTableEntry previous_; 71 PositionTableEntry candidate_; // Next entry to be written, if initialized.
72 PositionTableEntry previous_; // Previously written entry, to compute delta.
61 }; 73 };
62 74
63 class SourcePositionTableIterator { 75 class SourcePositionTableIterator {
64 public: 76 public:
65 explicit SourcePositionTableIterator(ByteArray* byte_array); 77 explicit SourcePositionTableIterator(ByteArray* byte_array);
66 78
67 void Advance(); 79 void Advance();
68 80
69 int bytecode_offset() const { 81 int bytecode_offset() const {
70 DCHECK(!done()); 82 DCHECK(!done());
(...skipping 16 matching lines...) Expand all
87 int index_; 99 int index_;
88 PositionTableEntry current_; 100 PositionTableEntry current_;
89 DisallowHeapAllocation no_gc; 101 DisallowHeapAllocation no_gc;
90 }; 102 };
91 103
92 } // namespace interpreter 104 } // namespace interpreter
93 } // namespace internal 105 } // namespace internal
94 } // namespace v8 106 } // namespace v8
95 107
96 #endif // V8_INTERPRETER_SOURCE_POSITION_TABLE_H_ 108 #endif // V8_INTERPRETER_SOURCE_POSITION_TABLE_H_
OLDNEW
« no previous file with comments | « src/interpreter/bytecode-array-builder.cc ('k') | src/interpreter/source-position-table.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698