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/objects-inl.h

Issue 11638037: Remove most uses of StringInputBuffer (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: last patch set had upload error Created 8 years 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
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index 7772cfefe2d17a53da79042a890f88ab59c89449..0ff5fc2e725d3a070d923270aec0e6a1af270206 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -2845,21 +2845,37 @@ 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)
- : is_one_byte_(false),
- buffer8_(NULL),
- end_(NULL),
- op_(op) {
- op->Reset();
+StringCharacterStream::StringCharacterStream(String* string,
+ ConsStringIteratorOp* op)
+ : op_(op) {
Yang 2012/12/21 09:21:48 Please initialize is_one_byte_, some compilers whi
+ Reset(string);
+}
+
+
+StringCharacterStream::StringCharacterStream(String* string,
+ unsigned offset,
+ ConsStringIteratorOp* op)
Yang 2012/12/21 09:21:48 Wouldn't it be cleaner to put offset as last and o
+ : op_(op) {
+ 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);
}

Powered by Google App Engine
This is Rietveld 408576698