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

Unified Diff: src/objects-inl.h

Issue 11727003: Reland r13275 and 13276 (Remove most uses of StringInputBuffer). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 12 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/objects.cc ('k') | src/runtime.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index 7772cfefe2d17a53da79042a890f88ab59c89449..89623bd02c131e0a8f0e14baf1df739e8c9c9fdc 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -2845,21 +2845,31 @@ String* ConsStringIteratorOp::ContinueOperation(int32_t* type_out,
uint16_t StringCharacterStream::GetNext() {
- ASSERT((buffer8_ == NULL && end_ == NULL) || buffer8_ < end_);
+ ASSERT(buffer8_ != NULL && end_ != NULL);
+ // Advance cursor if needed.
+ // TODO(dcarney): Ensure uses of the api call HasMore first and avoid this.
+ if (buffer8_ == end_) HasMore();
+ ASSERT(buffer8_ < end_);
return is_one_byte_ ? *buffer8_++ : *buffer16_++;
}
-StringCharacterStream::StringCharacterStream(
- String* string, unsigned offset, ConsStringIteratorOp* op)
+StringCharacterStream::StringCharacterStream(String* string,
+ ConsStringIteratorOp* op,
+ unsigned offset)
: is_one_byte_(false),
- buffer8_(NULL),
- end_(NULL),
op_(op) {
- op->Reset();
+ Reset(string, offset);
+}
+
+
+void StringCharacterStream::Reset(String* string, unsigned offset) {
+ op_->Reset();
+ buffer8_ = NULL;
+ end_ = NULL;
int32_t type = string->map()->instance_type();
unsigned length = string->length();
- String::Visit(string, offset, *this, *op, type, length);
+ String::Visit(string, offset, *this, *op_, type, length);
}
« no previous file with comments | « src/objects.cc ('k') | src/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698