Reviewers: marja,
Message:
Committed patchset #1 manually as r19951 (presubmit successful).
Description:
Experimental parser: fix build after merge
[email protected]
BUG=
Committed: https://code.google.com/p/v8/source/detail?r=19951
Please review this at https://codereview.chromium.org/196473026/
SVN Base: https://v8.googlecode.com/svn/branches/experimental/parser
Affected files (+18, -16 lines):
M src/lexer/lexer-shell.cc
M src/lexer/lexer.cc
Index: src/lexer/lexer-shell.cc
diff --git a/src/lexer/lexer-shell.cc b/src/lexer/lexer-shell.cc
index
17d7276a16780283b9ce612522262d556c4b0d77..1eb906a3d06fd237442c1895401685aa66abdc47
100644
--- a/src/lexer/lexer-shell.cc
+++ b/src/lexer/lexer-shell.cc
@@ -218,19 +218,23 @@ class TokenWithLocation {
// The location of the latest octal position when the token was seen.
int octal_beg;
int octal_end;
- TokenWithLocation(Token::Value token, Scanner* scanner) : value(token) {
+ TokenWithLocation(Token::Value token,
+ Scanner* scanner,
+ Handle<String> literal_string)
+ : value(token) {
beg = scanner->location().beg_pos;
end = scanner->location().end_pos;
octal_beg = scanner->octal_position().beg_pos;
octal_end = scanner->octal_position().end_pos;
is_one_byte = false;
literal_length = 0;
- if (HasLiteral(token)) {
- is_one_byte = scanner->is_literal_ascii();
- if (scanner->is_literal_ascii()) {
- Copy(scanner->literal_ascii_string(), &literal, &literal_length);
+ if (!literal_string.is_null()) {
+ DisallowHeapAllocation no_alloc;
+ String::FlatContent content = literal_string->GetFlatContent();
+ if (content.IsAscii()) {
+ Copy(content.ToOneByteVector(), &literal, &literal_length);
} else {
- Copy(scanner->literal_utf16_string(), &literal, &literal_length);
+ Copy(content.ToUC16Vector(), &literal, &literal_length);
}
}
}
@@ -298,14 +302,12 @@ static TimeDelta RunLexer(const uint16_t* source,
Token::Value token;
do {
token = scanner.Next();
+ Handle<String> literal;
+ if (HasLiteral(token)) {
+ literal = scanner.AllocateInternalizedString(isolate);
+ }
if (settings.print_tokens) {
- tokens.push_back(new TokenWithLocation(token, &scanner));
- } else if (HasLiteral(token)) {
- if (scanner.is_literal_ascii()) {
- scanner.literal_ascii_string();
- } else {
- scanner.literal_utf16_string();
- }
+ tokens.push_back(new TokenWithLocation(token, &scanner, literal));
}
if (token == Token::ILLEGAL && settings.break_after_illegal) break;
} while (token != Token::EOS);
Index: src/lexer/lexer.cc
diff --git a/src/lexer/lexer.cc b/src/lexer/lexer.cc
index
fe6df5998c567f81ef77c4d1bb406cd977cc527d..0a8744276cd8f2b7e8c5b1d3ccf2ecedfa85bb29
100644
--- a/src/lexer/lexer.cc
+++ b/src/lexer/lexer.cc
@@ -511,7 +511,7 @@ void
LexerBase::LiteralDesc::SetTwoByteString(Vector<const uint16_t> string) {
void LexerBase::LiteralDesc::SetStringFromLiteralBuffer() {
- is_one_byte_ = buffer.is_ascii();
+ is_one_byte_ = buffer.is_one_byte();
is_in_buffer_ = true;
length = buffer.length();
if (is_one_byte_) {
@@ -519,9 +519,9 @@ void
LexerBase::LiteralDesc::SetStringFromLiteralBuffer() {
one_byte_string_.Dispose();
}
is_one_byte_string_owned_ = false;
- one_byte_string_ = Vector<const uint8_t>::cast(buffer.ascii_literal());
+ one_byte_string_ = buffer.one_byte_literal();
} else {
- two_byte_string_ = buffer.utf16_literal();
+ two_byte_string_ = buffer.two_byte_literal();
}
}
--
--
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.