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

Unified Diff: src/preparser.h

Issue 335293004: New try: Parser: Delay internalizing strings and values (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebased (trivial) Created 6 years, 6 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
« no previous file with comments | « src/parser.cc ('k') | src/prettyprinter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/preparser.h
diff --git a/src/preparser.h b/src/preparser.h
index f8e6203a547e05ad6825470cbeb911e3241803c9..753ff1bf3ee0a5b88a90f9d2d10a863f6a4831ec 100644
--- a/src/preparser.h
+++ b/src/preparser.h
@@ -150,7 +150,8 @@ class ParserBase : public Traits {
FunctionState** function_state_stack,
typename Traits::Type::Scope** scope_stack,
typename Traits::Type::Scope* scope,
- typename Traits::Type::Zone* zone = NULL);
+ typename Traits::Type::Zone* zone = NULL,
+ AstValueFactory* ast_value_factory = NULL);
~FunctionState();
int NextMaterializedLiteralIndex() {
@@ -395,7 +396,9 @@ 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,
+ reinterpret_cast<const char*>(NULL),
+ is_reference_error);
}
void ReportUnexpectedToken(Token::Value token);
@@ -782,9 +785,9 @@ class PreParserScope {
class PreParserFactory {
public:
- explicit PreParserFactory(void* extra_param) {}
- PreParserExpression NewLiteral(PreParserIdentifier identifier,
- int pos) {
+ explicit PreParserFactory(void* extra_param1, void* extra_param2) {}
+ PreParserExpression NewStringLiteral(PreParserIdentifier identifier,
+ int pos) {
return PreParserExpression::Default();
}
PreParserExpression NewNumberLiteral(double number,
@@ -1036,8 +1039,8 @@ class PreParserTraits {
// Producing data during the recursive descent.
PreParserIdentifier GetSymbol(Scanner* scanner);
- static PreParserIdentifier NextLiteralString(Scanner* scanner,
- PretenureFlag tenured) {
+
+ static PreParserIdentifier GetNextSymbol(Scanner* scanner) {
return PreParserIdentifier::Default();
}
@@ -1225,7 +1228,8 @@ ParserBase<Traits>::FunctionState::FunctionState(
FunctionState** function_state_stack,
typename Traits::Type::Scope** scope_stack,
typename Traits::Type::Scope* scope,
- typename Traits::Type::Zone* extra_param)
+ typename Traits::Type::Zone* extra_param,
+ AstValueFactory* ast_value_factory)
: next_materialized_literal_index_(JSFunction::kLiteralsPrefixSize),
next_handler_index_(0),
expected_property_count_(0),
@@ -1237,7 +1241,7 @@ ParserBase<Traits>::FunctionState::FunctionState(
outer_scope_(*scope_stack),
saved_ast_node_id_(0),
extra_param_(extra_param),
- factory_(extra_param) {
+ factory_(extra_param, ast_value_factory) {
*scope_stack_ = scope;
*function_state_stack = this;
Traits::SetUpFunctionState(this, extra_param);
@@ -1363,14 +1367,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();
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);
}
@@ -1615,7 +1619,7 @@ typename ParserBase<Traits>::ExpressionT ParserBase<Traits>::ParseObjectLiteral(
}
// Failed to parse as get/set property, so it's just a normal property
// (which might be called "get" or "set" or something else).
- key = factory()->NewLiteral(id, next_pos);
+ key = factory()->NewStringLiteral(id, next_pos);
break;
}
case Token::STRING: {
@@ -1627,7 +1631,7 @@ typename ParserBase<Traits>::ExpressionT ParserBase<Traits>::ParseObjectLiteral(
key = factory()->NewNumberLiteral(index, next_pos);
break;
}
- key = factory()->NewLiteral(string, next_pos);
+ key = factory()->NewStringLiteral(string, next_pos);
break;
}
case Token::NUMBER: {
@@ -1640,7 +1644,7 @@ typename ParserBase<Traits>::ExpressionT ParserBase<Traits>::ParseObjectLiteral(
if (Token::IsKeyword(next)) {
Consume(next);
IdentifierT string = this->GetSymbol(scanner_);
- key = factory()->NewLiteral(string, next_pos);
+ key = factory()->NewStringLiteral(string, next_pos);
} else {
Token::Value next = Next();
ReportUnexpectedToken(next);
@@ -2009,7 +2013,7 @@ ParserBase<Traits>::ParseLeftHandSideExpression(bool* ok) {
int pos = position();
IdentifierT name = ParseIdentifierName(CHECK_OK);
result = factory()->NewProperty(
- result, factory()->NewLiteral(name, pos), pos);
+ result, factory()->NewStringLiteral(name, pos), pos);
if (fni_ != NULL) this->PushLiteralName(fni_, name);
break;
}
@@ -2132,7 +2136,7 @@ ParserBase<Traits>::ParseMemberExpressionContinuation(ExpressionT expression,
int pos = position();
IdentifierT name = ParseIdentifierName(CHECK_OK);
expression = factory()->NewProperty(
- expression, factory()->NewLiteral(name, pos), pos);
+ expression, factory()->NewStringLiteral(name, pos), pos);
if (fni_ != NULL) {
this->PushLiteralName(fni_, name);
}
« no previous file with comments | « src/parser.cc ('k') | src/prettyprinter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698