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

Unified Diff: src/scanner.cc

Issue 998893002: [scanner] Extend fast-smi parsing to the entire range minus Smi::kMinValue (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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/scanner.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/scanner.cc
diff --git a/src/scanner.cc b/src/scanner.cc
index 9e90868131cc7469b6d88d79e2d409e561915dce..f727a6fed2f5a842cf1b0b4b077187f4bf6d0fda 100644
--- a/src/scanner.cc
+++ b/src/scanner.cc
@@ -1000,7 +1000,7 @@ Token::Value Scanner::ScanNumber(bool seen_period) {
// Parse decimal digits and allow trailing fractional part.
if (kind == DECIMAL) {
if (at_start) {
- int value = 0;
+ uint64_t value = 0;
while (IsDecimalDigit(c0_)) {
value = 10 * value + (c0_ - '0');
@@ -1009,9 +1009,9 @@ Token::Value Scanner::ScanNumber(bool seen_period) {
AddLiteralChar(first_char);
}
- if (next_.literal_chars->one_byte_literal().length() < 10 &&
- c0_ != '.' && c0_ != 'e' && c0_ != 'E') {
- smi_value_ = value;
+ if (next_.literal_chars->one_byte_literal().length() <= 10 &&
+ value <= Smi::kMaxValue && c0_ != '.' && c0_ != 'e' && c0_ != 'E') {
+ smi_value_ = static_cast<int>(value);
literal.Complete();
HandleLeadSurrogate();
@@ -1428,11 +1428,6 @@ double Scanner::DoubleValue() {
}
-int Scanner::FindNumber(DuplicateFinder* finder, int value) {
- return finder->AddNumber(literal_one_byte_string(), value);
-}
-
-
int Scanner::FindSymbol(DuplicateFinder* finder, int value) {
if (is_literal_one_byte()) {
return finder->AddOneByteSymbol(literal_one_byte_string(), value);
« no previous file with comments | « src/scanner.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698