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

Unified Diff: src/interpreter/source-position-table.cc

Issue 1682853004: [interpreter, debugger] implement bytecode break location iterator. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix build Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/interpreter/source-position-table.h ('k') | src/objects-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/interpreter/source-position-table.cc
diff --git a/src/interpreter/source-position-table.cc b/src/interpreter/source-position-table.cc
index 2a8800548bd76bd499de5a5c591e3433ed02687b..0b7c44e2d984a50eb8169af7daba6ce8af096854 100644
--- a/src/interpreter/source-position-table.cc
+++ b/src/interpreter/source-position-table.cc
@@ -18,7 +18,9 @@ class SourcePositionField : public BitField<int, 1, 30> {};
void SourcePositionTableBuilder::AddStatementPosition(size_t bytecode_offset,
int source_position) {
int offset = static_cast<int>(bytecode_offset);
- AssertMonotonic(offset);
+ // If a position has already been assigned to this bytecode offset,
+ // do not reassign a new statement position.
+ if (CodeOffsetHasPosition(offset)) return;
uint32_t encoded = IsStatementField::encode(true) |
SourcePositionField::encode(source_position);
entries_.push_back({offset, encoded});
@@ -27,7 +29,9 @@ void SourcePositionTableBuilder::AddStatementPosition(size_t bytecode_offset,
void SourcePositionTableBuilder::AddExpressionPosition(size_t bytecode_offset,
int source_position) {
int offset = static_cast<int>(bytecode_offset);
- AssertMonotonic(offset);
+ // If a position has already been assigned to this bytecode offset,
+ // do not reassign a new statement position.
+ if (CodeOffsetHasPosition(offset)) return;
uint32_t encoded = IsStatementField::encode(false) |
SourcePositionField::encode(source_position);
entries_.push_back({offset, encoded});
@@ -38,9 +42,7 @@ void SourcePositionTableBuilder::RevertPosition(size_t bytecode_offset) {
// If we already added a source position table entry, but the bytecode array
// builder ended up not outputting a bytecode for the corresponding bytecode
// offset, we have to remove that entry.
- if (entries_.size() > 0 && entries_.back().bytecode_offset == offset) {
- entries_.pop_back();
- }
+ if (CodeOffsetHasPosition(offset)) entries_.pop_back();
}
Handle<FixedArray> SourcePositionTableBuilder::ToFixedArray() {
« no previous file with comments | « src/interpreter/source-position-table.h ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698