Index: src/interpreter/source-position-table.cc |
diff --git a/src/interpreter/source-position-table.cc b/src/interpreter/source-position-table.cc |
index f408f159db3bef2df859043eab3b41cd7c0da6b6..30507fdd90cbadcf4c5525089225f101e8dc0206 100644 |
--- a/src/interpreter/source-position-table.cc |
+++ b/src/interpreter/source-position-table.cc |
@@ -15,20 +15,30 @@ namespace interpreter { |
class IsStatementField : public BitField<bool, 0, 1> {}; |
class SourcePositionField : public BitField<int, 1, 30> {}; |
-void SourcePositionTableBuilder::AddStatementPosition(int bytecode_offset, |
+void SourcePositionTableBuilder::AddStatementPosition(size_t bytecode_offset, |
int source_position) { |
- AssertMonotonic(bytecode_offset); |
+ int offset = static_cast<int>(bytecode_offset); |
+ AssertMonotonic(offset); |
uint32_t encoded = IsStatementField::encode(true) | |
SourcePositionField::encode(source_position); |
- entries_.push_back({bytecode_offset, encoded}); |
+ entries_.push_back({offset, encoded}); |
} |
-void SourcePositionTableBuilder::AddExpressionPosition(int bytecode_offset, |
+void SourcePositionTableBuilder::AddExpressionPosition(size_t bytecode_offset, |
int source_position) { |
- AssertMonotonic(bytecode_offset); |
+ int offset = static_cast<int>(bytecode_offset); |
+ AssertMonotonic(offset); |
uint32_t encoded = IsStatementField::encode(false) | |
SourcePositionField::encode(source_position); |
- entries_.push_back({bytecode_offset, encoded}); |
+ entries_.push_back({offset, encoded}); |
+} |
+ |
+void SourcePositionTableBuilder::RevertPosition(size_t bytecode_offset) { |
+ int offset = static_cast<int>(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_.back().bytecode_offset == offset) entries_.pop_back(); |
rmcilroy
2016/02/05 10:05:54
Should this be a while loop (e.g., could we try to
Yang
2016/02/05 12:21:31
No. AssertMonotonic already makes sure that we do
rmcilroy
2016/02/05 12:24:31
Ahh, I was confused since Monotonic usually means
|
} |
Handle<FixedArray> SourcePositionTableBuilder::ToFixedArray() { |