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

Unified Diff: src/parsing/scanner.cc

Issue 2044233004: Speed up adding literal chars when the buffer is known to be one-byte (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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/parsing/scanner.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parsing/scanner.cc
diff --git a/src/parsing/scanner.cc b/src/parsing/scanner.cc
index 6a9b32e63461f3b12e334546d8b94db6c48d49d7..03522767cd90e3b2391769f565a997168e04eb35 100644
--- a/src/parsing/scanner.cc
+++ b/src/parsing/scanner.cc
@@ -839,9 +839,6 @@ uc32 Scanner::ScanOctalEscape(uc32 c, int length) {
}
-const int kMaxAscii = 127;
-
-
Token::Value Scanner::ScanString() {
uc32 quote = c0_;
Advance<false, false>(); // consume quote
@@ -858,7 +855,7 @@ Token::Value Scanner::ScanString() {
Advance<false, false>();
return Token::STRING;
}
- uc32 c = c0_;
+ char c = static_cast<char>(c0_);
if (c == '\\') break;
Advance<false, false>();
AddLiteralChar(c);
@@ -1283,7 +1280,7 @@ Token::Value Scanner::ScanIdentifierOrKeyword() {
LiteralScope literal(this);
if (IsInRange(c0_, 'a', 'z')) {
do {
- uc32 first_char = c0_;
+ char first_char = static_cast<char>(c0_);
Advance<false, false>();
AddLiteralChar(first_char);
} while (IsInRange(c0_, 'a', 'z'));
@@ -1291,11 +1288,11 @@ Token::Value Scanner::ScanIdentifierOrKeyword() {
if (IsDecimalDigit(c0_) || IsInRange(c0_, 'A', 'Z') || c0_ == '_' ||
c0_ == '$') {
// Identifier starting with lowercase.
- uc32 first_char = c0_;
+ char first_char = static_cast<char>(c0_);
Advance<false, false>();
AddLiteralChar(first_char);
while (IsAsciiIdentifier(c0_)) {
- uc32 first_char = c0_;
+ char first_char = static_cast<char>(c0_);
Advance<false, false>();
AddLiteralChar(first_char);
}
@@ -1313,7 +1310,7 @@ Token::Value Scanner::ScanIdentifierOrKeyword() {
HandleLeadSurrogate();
} else if (IsInRange(c0_, 'A', 'Z') || c0_ == '_' || c0_ == '$') {
do {
- uc32 first_char = c0_;
+ char first_char = static_cast<char>(c0_);
Advance<false, false>();
AddLiteralChar(first_char);
} while (IsAsciiIdentifier(c0_));
« no previous file with comments | « src/parsing/scanner.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698