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

Unified Diff: src/preparser.h

Issue 974783003: Speed up parsing of smis (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Ignore partially parsed octal-seeming decimal numbers Created 5 years, 10 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/scanner.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 64f456b2d7d808cb10a56986ad667f7c0f53892c..4a35cd59f52dfa71426abc71f58937ce3d783f86 100644
--- a/src/preparser.h
+++ b/src/preparser.h
@@ -1688,6 +1688,7 @@ void ParserBase<Traits>::ReportUnexpectedToken(Token::Value token) {
switch (token) {
case Token::EOS:
return ReportMessageAt(source_location, "unexpected_eos");
+ case Token::SMI:
case Token::NUMBER:
return ReportMessageAt(source_location, "unexpected_token_number");
case Token::STRING:
@@ -1874,6 +1875,7 @@ ParserBase<Traits>::ParsePrimaryExpression(bool* ok) {
case Token::NULL_LITERAL:
case Token::TRUE_LITERAL:
case Token::FALSE_LITERAL:
+ case Token::SMI:
case Token::NUMBER:
Next();
result =
@@ -2055,6 +2057,11 @@ typename ParserBase<Traits>::ExpressionT ParserBase<Traits>::ParsePropertyName(
*name = this->GetSymbol(scanner());
break;
+ case Token::SMI:
+ Consume(Token::SMI);
+ *name = this->GetNumberAsSymbol(scanner());
+ break;
+
case Token::NUMBER:
Consume(Token::NUMBER);
*name = this->GetNumberAsSymbol(scanner());
@@ -3069,7 +3076,7 @@ void ParserBase<Traits>::ObjectLiteralChecker::CheckProperty(
DCHECK(!is_static);
DCHECK(!is_generator || type == kMethodProperty);
- if (property == Token::NUMBER) return;
+ if (property == Token::SMI || property == Token::NUMBER) return;
if (type == kValueProperty && IsProto()) {
if (has_seen_proto_) {
@@ -3089,7 +3096,7 @@ void ParserBase<Traits>::ClassLiteralChecker::CheckProperty(
bool* ok) {
DCHECK(type == kMethodProperty || type == kAccessorProperty);
- if (property == Token::NUMBER) return;
+ if (property == Token::SMI || property == Token::NUMBER) return;
if (is_static) {
if (IsPrototype()) {
« no previous file with comments | « src/parser.cc ('k') | src/scanner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698