Revision: 20027
Author:   [email protected]
Date:     Tue Mar 18 12:24:17 2014 UTC
Log:      Experimental parser: fix two byte to one byte allocation

[email protected]

BUG=

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

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

=======================================
--- /branches/experimental/parser/src/lexer/lexer.cc Mon Mar 17 15:57:19 2014 UTC +++ /branches/experimental/parser/src/lexer/lexer.cc Tue Mar 18 12:24:17 2014 UTC
@@ -708,7 +708,7 @@
   LiteralDesc* literal = current_literal_;
   const TokenDesc& token = current_;
   // TODO(dcarney): handle utf8 directly.
-  if (source_handle_.is_null()  || MustBeInBuffer(token)) {
+  if (source_handle_.is_null()  || MustBeInBufferForAllocation(token)) {
     EnsureLiteralIsValid(token, literal);
     return literal->is_one_byte() ?
         factory->InternalizeOneByteString(literal->one_byte_string()) :
@@ -733,7 +733,7 @@
   LiteralDesc* literal = next_literal_;
   const TokenDesc& token = next_;
   // TODO(dcarney): handle utf8 directly.
-  if (source_handle_.is_null()  || MustBeInBuffer(token)) {
+  if (source_handle_.is_null()  || MustBeInBufferForAllocation(token)) {
     EnsureLiteralIsValid(token, literal);
     return literal->is_one_byte() ?
factory->NewStringFromOneByte(literal->one_byte_string(), tenured) :
=======================================
--- /branches/experimental/parser/src/lexer/lexer.h Mon Mar 17 11:36:36 2014 UTC +++ /branches/experimental/parser/src/lexer/lexer.h Tue Mar 18 12:24:17 2014 UTC
@@ -350,6 +350,11 @@
     return token.has_escapes ||
         (sizeof(Char) == 1 && !token.is_in_primary_range);
   }
+
+  static inline bool MustBeInBufferForAllocation(const TokenDesc& token) {
+    return MustBeInBuffer(token) ||
+        (sizeof(Char) == 2 && token.is_in_primary_range);
+  }

  protected:
   virtual void Scan();

--
--
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/d/optout.

Reply via email to