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

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

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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/interpreter/source-position-table.h ('k') | test/mjsunit/ignition/elided-instruction.js » ('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 5d30f51be7ff032111dd893d2e27f3463a1a0956..221d8a52ed8d5f621b5c11b1adc27d3047fd840d 100644
--- a/src/interpreter/source-position-table.cc
+++ b/src/interpreter/source-position-table.cc
@@ -115,10 +115,11 @@ void DecodeEntry(ByteArray* bytes, int* index, PositionTableEntry* entry) {
} // namespace
-void SourcePositionTableBuilder::AddStatementPosition(size_t bytecode_offset,
- int source_position) {
+void SourcePositionTableBuilder::AddStatementPosition(
+ size_t bytecode_offset, int source_position,
+ SourcePositionTableBuilder::OnDuplicateCodeOffset on_duplicate) {
int offset = static_cast<int>(bytecode_offset);
- AddEntry({offset, source_position, true});
+ AddEntry({offset, source_position, true}, on_duplicate);
LOG_CODE_EVENT(isolate_, CodeLinePosInfoAddStatementPositionEvent(
jit_handler_data_, offset, source_position));
LOG_CODE_EVENT(isolate_, CodeLinePosInfoAddPositionEvent(
@@ -133,24 +134,34 @@ void SourcePositionTableBuilder::AddExpressionPosition(size_t bytecode_offset,
jit_handler_data_, offset, source_position));
}
-void SourcePositionTableBuilder::AddEntry(const PositionTableEntry& entry) {
+void SourcePositionTableBuilder::AddEntry(
+ const PositionTableEntry& entry,
+ SourcePositionTableBuilder::OnDuplicateCodeOffset on_duplicate) {
// Don't encode a new entry if this bytecode already has a source position
// assigned.
- if (bytes_.size() > 0 && previous_.bytecode_offset == entry.bytecode_offset) {
+ if (candidate_.bytecode_offset == entry.bytecode_offset) {
+ if (on_duplicate == OVERWRITE_DUPLICATE) candidate_ = entry;
return;
}
- PositionTableEntry tmp(entry);
+ CommitEntry();
+ candidate_ = entry;
+}
+
+void SourcePositionTableBuilder::CommitEntry() {
+ if (candidate_.bytecode_offset == kUninitializedCandidateOffset) return;
+ PositionTableEntry tmp(candidate_);
SubtractFromEntry(tmp, previous_);
EncodeEntry(bytes_, tmp);
- previous_ = entry;
+ previous_ = candidate_;
#ifdef ENABLE_SLOW_DCHECKS
- raw_entries_.push_back(entry);
+ raw_entries_.push_back(candidate_);
#endif
}
Handle<ByteArray> SourcePositionTableBuilder::ToSourcePositionTable() {
+ CommitEntry();
if (bytes_.empty()) return isolate_->factory()->empty_byte_array();
Handle<ByteArray> table = isolate_->factory()->NewByteArray(
« no previous file with comments | « src/interpreter/source-position-table.h ('k') | test/mjsunit/ignition/elided-instruction.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698