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

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

Issue 2860843003: Introduce a handlified version of source position iterator. (Closed)
Patch Set: Created 3 years, 7 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/source-position-table.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/source-position-table.cc
diff --git a/src/source-position-table.cc b/src/source-position-table.cc
index 35d8e7c2f6806fbf00ae7e934e354c982c35bb82..4babd4c0eb3cd65d32c2787a675f76ffca3a83c4 100644
--- a/src/source-position-table.cc
+++ b/src/source-position-table.cc
@@ -168,18 +168,27 @@ Handle<ByteArray> SourcePositionTableBuilder::ToSourcePositionTable(
}
SourcePositionTableIterator::SourcePositionTableIterator(ByteArray* byte_array)
- : table_(byte_array), index_(0), current_() {
+ : raw_table_(byte_array) {
Advance();
}
+SourcePositionTableIterator::SourcePositionTableIterator(
+ Handle<ByteArray> byte_array)
+ : table_(byte_array) {
+ Advance();
+ // We can enable allocation because we keep the table in a handle.
+ no_gc.Release();
+}
+
void SourcePositionTableIterator::Advance() {
+ ByteArray* table = raw_table_ ? raw_table_ : *table_;
DCHECK(!done());
- DCHECK(index_ >= 0 && index_ <= table_->length());
- if (index_ >= table_->length()) {
+ DCHECK(index_ >= 0 && index_ <= table->length());
+ if (index_ >= table->length()) {
index_ = kDone;
} else {
PositionTableEntry tmp;
- DecodeEntry(table_, &index_, &tmp);
+ DecodeEntry(table, &index_, &tmp);
AddAndSetEntry(current_, tmp);
}
}
« no previous file with comments | « src/source-position-table.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698