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

Unified Diff: src/lexer/experimental-scanner.cc

Issue 57743002: Experimental parser: push the data only once. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 7 years, 1 month 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/lexer/experimental-scanner.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/lexer/experimental-scanner.cc
diff --git a/src/lexer/experimental-scanner.cc b/src/lexer/experimental-scanner.cc
index d110f5eb2f58dc0aed5e3fb4e7c8801340a45dd7..4c71b2a372eb9b6d451a7676fc102f1f9382b20d 100644
--- a/src/lexer/experimental-scanner.cc
+++ b/src/lexer/experimental-scanner.cc
@@ -68,6 +68,7 @@ ExperimentalScanner::ExperimentalScanner(const char* fname,
: current_(0),
fetched_(0),
read_all_at_once_(read_all_at_once),
+ already_pushed_(false),
source_(0),
length_(0) {
file_ = fopen(fname, "rb");
@@ -91,7 +92,12 @@ void ExperimentalScanner::FillTokens() {
current_ = 0;
fetched_ = 0;
if (read_all_at_once_) {
- scanner_->push(source_, length_ + 1);
+ if (!already_pushed_) {
+ scanner_->push(source_, length_ + 1);
+ already_pushed_ = true;
+ } else {
+ scanner_->push(0, 0);
+ }
} else {
uint8_t chars[BUFFER_SIZE];
int n = static_cast<int>(fread(&chars, 1, BUFFER_SIZE, file_));
« no previous file with comments | « src/lexer/experimental-scanner.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698