Revision: 17454
Author:   [email protected]
Date:     Mon Nov  4 09:24:21 2013 UTC
Log:      Experimental parser: push the data only once.

BUG=
[email protected]

Review URL: https://codereview.chromium.org/57743002
http://code.google.com/p/v8/source/detail?r=17454

Modified:
 /branches/experimental/parser/src/lexer/experimental-scanner.cc
 /branches/experimental/parser/src/lexer/experimental-scanner.h

=======================================
--- /branches/experimental/parser/src/lexer/experimental-scanner.cc Thu Oct 24 11:00:07 2013 UTC +++ /branches/experimental/parser/src/lexer/experimental-scanner.cc Mon Nov 4 09:24:21 2013 UTC
@@ -68,6 +68,7 @@
     : 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 @@
   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_));
=======================================
--- /branches/experimental/parser/src/lexer/experimental-scanner.h Thu Oct 24 11:00:07 2013 UTC +++ /branches/experimental/parser/src/lexer/experimental-scanner.h Mon Nov 4 09:24:21 2013 UTC
@@ -79,6 +79,7 @@
   FILE* file_;
   PushScanner* scanner_;
   bool read_all_at_once_;
+  bool already_pushed_;
   const v8::internal::byte* source_;
   int length_;
 };

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to