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

Unified Diff: src/preparser.h

Issue 231073002: WIP: Parser: delay string internalization. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebased Created 6 years, 7 months 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
Index: src/preparser.h
diff --git a/src/preparser.h b/src/preparser.h
index 9dee863d591191a40de0a78d7d191347f9bc3966..0850fe607b54429a0fe84afff758a9636d235d6b 100644
--- a/src/preparser.h
+++ b/src/preparser.h
@@ -327,7 +327,7 @@ class ParserBase : public Traits {
Scanner::Location octal = scanner()->octal_position();
if (octal.IsValid() && beg_pos <= octal.beg_pos &&
octal.end_pos <= end_pos) {
- ReportMessageAt(octal, "strict_octal_literal");
+ this->ReportMessageAt(octal, "strict_octal_literal");
scanner()->clear_octal_position();
*ok = false;
}
@@ -356,7 +356,8 @@ class ParserBase : public Traits {
void ReportMessageAt(Scanner::Location location, const char* message,
bool is_reference_error = false) {
- Traits::ReportMessageAt(location, message, NULL, is_reference_error);
+ Traits::ReportMessageAt(location, message, (const char*)NULL,
+ is_reference_error);
}
void ReportUnexpectedToken(Token::Value token);
@@ -368,9 +369,7 @@ class ParserBase : public Traits {
// allow_eval_or_arguments is kAllowEvalOrArguments, we allow "eval" or
// "arguments" as identifier even in strict mode (this is needed in cases like
// "var foo = eval;").
- IdentifierT ParseIdentifier(
- AllowEvalOrArgumentsAsIdentifier,
- bool* ok);
+ IdentifierT ParseIdentifier(AllowEvalOrArgumentsAsIdentifier, bool* ok);
// Parses an identifier or a strict mode future reserved word, and indicate
// whether it is strict mode future reserved.
IdentifierT ParseIdentifierOrStrictReservedWord(
@@ -997,8 +996,8 @@ class PreParserTraits {
// Producing data during the recursive descent.
PreParserIdentifier GetSymbol(Scanner* scanner);
- static PreParserIdentifier NextLiteralString(Scanner* scanner,
- PretenureFlag tenured) {
+
+ PreParserIdentifier GetNextSymbol(Scanner* scanner) {
return PreParserIdentifier::Default();
}
@@ -1218,18 +1217,19 @@ void ParserBase<Traits>::ReportUnexpectedToken(Token::Value token) {
// Four of the tokens are treated specially
switch (token) {
case Token::EOS:
- return ReportMessageAt(source_location, "unexpected_eos");
+ return this->ReportMessageAt(source_location, "unexpected_eos");
case Token::NUMBER:
- return ReportMessageAt(source_location, "unexpected_token_number");
+ return this->ReportMessageAt(source_location, "unexpected_token_number");
case Token::STRING:
- return ReportMessageAt(source_location, "unexpected_token_string");
+ return this->ReportMessageAt(source_location, "unexpected_token_string");
case Token::IDENTIFIER:
- return ReportMessageAt(source_location, "unexpected_token_identifier");
+ return this->ReportMessageAt(source_location,
+ "unexpected_token_identifier");
case Token::FUTURE_RESERVED_WORD:
- return ReportMessageAt(source_location, "unexpected_reserved");
+ return this->ReportMessageAt(source_location, "unexpected_reserved");
case Token::YIELD:
case Token::FUTURE_STRICT_RESERVED_WORD:
- return ReportMessageAt(source_location, strict_mode() == SLOPPY
+ return this->ReportMessageAt(source_location, strict_mode() == SLOPPY
? "unexpected_token_identifier" : "unexpected_strict_reserved");
default:
const char* name = Token::String(token);
@@ -1248,7 +1248,8 @@ typename ParserBase<Traits>::IdentifierT ParserBase<Traits>::ParseIdentifier(
if (next == Token::IDENTIFIER) {
IdentifierT name = this->GetSymbol(scanner());
if (allow_eval_or_arguments == kDontAllowEvalOrArguments &&
- strict_mode() == STRICT && this->IsEvalOrArguments(name)) {
+ strict_mode() == STRICT &&
+ this->IsEvalOrArguments(name)) {
ReportMessageAt(scanner()->location(), "strict_eval_arguments");
*ok = false;
}
@@ -1300,8 +1301,7 @@ ParserBase<Traits>::ParseIdentifierName(bool* ok) {
template <class Traits>
typename ParserBase<Traits>::IdentifierT
-ParserBase<Traits>::ParseIdentifierNameOrGetOrSet(bool* is_get,
- bool* is_set,
+ParserBase<Traits>::ParseIdentifierNameOrGetOrSet(bool* is_get, bool* is_set,
bool* ok) {
IdentifierT result = ParseIdentifierName(ok);
if (!*ok) return Traits::EmptyIdentifier();
@@ -1323,14 +1323,14 @@ typename ParserBase<Traits>::ExpressionT ParserBase<Traits>::ParseRegExpLiteral(
int literal_index = function_state_->NextMaterializedLiteralIndex();
- IdentifierT js_pattern = this->NextLiteralString(scanner(), TENURED);
+ IdentifierT js_pattern = this->GetNextSymbol(scanner());
if (!scanner()->ScanRegExpFlags()) {
Next();
- ReportMessageAt(scanner()->location(), "invalid_regexp_flags");
+ this->ReportMessage("invalid_regexp_flags");
*ok = false;
return Traits::EmptyExpression();
}
- IdentifierT js_flags = this->NextLiteralString(scanner(), TENURED);
+ IdentifierT js_flags = this->GetNextSymbol(scanner());
Next();
return factory()->NewRegExpLiteral(js_pattern, js_flags, literal_index, pos);
}
@@ -2113,7 +2113,7 @@ ParserBase<Traits>::CheckAndRewriteReferenceExpression(
Scanner::Location location, const char* message, bool* ok) {
if (strict_mode() == STRICT && this->IsIdentifier(expression) &&
this->IsEvalOrArguments(this->AsIdentifier(expression))) {
- this->ReportMessageAt(location, "strict_eval_arguments", false);
+ this->ReportMessageAt(location, "strict_eval_arguments");
*ok = false;
return this->EmptyExpression();
} else if (expression->IsValidReferenceExpression()) {

Powered by Google App Engine
This is Rietveld 408576698