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

Unified Diff: src/scanner.cc

Issue 6460038: Version 3.1.3.... (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: Created 9 years, 10 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/runtime.cc ('k') | src/uri.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/scanner.cc
===================================================================
--- src/scanner.cc (revision 6703)
+++ src/scanner.cc (working copy)
@@ -76,7 +76,8 @@
buffer_end_ = buffer_ + kBufferSize;
buffer_cursor_ = buffer_end_;
}
- ASSERT(pushback_limit_ > buffer_);
+ // Ensure that there is room for at least one pushback.
+ ASSERT(buffer_cursor_ > buffer_);
ASSERT(pos_ > 0);
buffer_[--buffer_cursor_ - buffer_] = character;
if (buffer_cursor_ == buffer_) {
@@ -89,15 +90,17 @@
bool BufferedUC16CharacterStream::ReadBlock() {
+ buffer_cursor_ = buffer_;
if (pushback_limit_ != NULL) {
- buffer_cursor_ = buffer_;
+ // Leave pushback mode.
buffer_end_ = pushback_limit_;
pushback_limit_ = NULL;
- ASSERT(buffer_cursor_ != buffer_end_);
- return true;
+ // If there were any valid characters left at the
+ // start of the buffer, use those.
+ if (buffer_cursor_ < buffer_end_) return true;
+ // Otherwise read a new block.
}
unsigned length = FillBuffer(pos_, kBufferSize);
- buffer_cursor_ = buffer_;
buffer_end_ = buffer_ + length;
return length > 0;
}
« no previous file with comments | « src/runtime.cc ('k') | src/uri.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698