Reviewers: marja,
Message:
Committed patchset #1 manually as r20027 (presubmit successful).
Description:
Experimental parser: fix two byte to one byte allocation
[email protected]
BUG=
Committed: https://code.google.com/p/v8/source/detail?r=20027
Please review this at https://codereview.chromium.org/202953004/
SVN Base: https://v8.googlecode.com/svn/branches/experimental/parser
Affected files (+7, -2 lines):
M src/lexer/lexer.h
M src/lexer/lexer.cc
Index: src/lexer/lexer.cc
diff --git a/src/lexer/lexer.cc b/src/lexer/lexer.cc
index
4c565a060a8f72a88d3398bc575709a642534f4a..c8c43b9f0d9717444f5af5dcddeab10827fd3393
100644
--- a/src/lexer/lexer.cc
+++ b/src/lexer/lexer.cc
@@ -708,7 +708,7 @@ Handle<String> Lexer<Char>::AllocateInternalizedString(
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 @@ Handle<String>
Lexer<Char>::AllocateNextLiteralString(Isolate* isolate,
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) :
Index: src/lexer/lexer.h
diff --git a/src/lexer/lexer.h b/src/lexer/lexer.h
index
ebc2b77355d8d15f72b38b89384f9113faeee8cd..6b6e99a86d9a5a96a93d3ca8804149b1ee323b86
100644
--- a/src/lexer/lexer.h
+++ b/src/lexer/lexer.h
@@ -351,6 +351,11 @@ class Lexer : public LexerBase {
(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.