[scanner] Extend fast-smi parsing to the entire range minus Smi::kMinValue
BUG= Review URL: https://codereview.chromium.org/998893002 Cr-Commit-Position: refs/heads/master@{#27129}
This commit is contained in:
parent
aab76eff43
commit
e77d0abd4a
@ -1000,7 +1000,7 @@ Token::Value Scanner::ScanNumber(bool seen_period) {
|
|||||||
// Parse decimal digits and allow trailing fractional part.
|
// Parse decimal digits and allow trailing fractional part.
|
||||||
if (kind == DECIMAL) {
|
if (kind == DECIMAL) {
|
||||||
if (at_start) {
|
if (at_start) {
|
||||||
int value = 0;
|
uint64_t value = 0;
|
||||||
while (IsDecimalDigit(c0_)) {
|
while (IsDecimalDigit(c0_)) {
|
||||||
value = 10 * value + (c0_ - '0');
|
value = 10 * value + (c0_ - '0');
|
||||||
|
|
||||||
@ -1009,9 +1009,9 @@ Token::Value Scanner::ScanNumber(bool seen_period) {
|
|||||||
AddLiteralChar(first_char);
|
AddLiteralChar(first_char);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (next_.literal_chars->one_byte_literal().length() < 10 &&
|
if (next_.literal_chars->one_byte_literal().length() <= 10 &&
|
||||||
c0_ != '.' && c0_ != 'e' && c0_ != 'E') {
|
value <= Smi::kMaxValue && c0_ != '.' && c0_ != 'e' && c0_ != 'E') {
|
||||||
smi_value_ = value;
|
smi_value_ = static_cast<int>(value);
|
||||||
literal.Complete();
|
literal.Complete();
|
||||||
HandleLeadSurrogate();
|
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) {
|
int Scanner::FindSymbol(DuplicateFinder* finder, int value) {
|
||||||
if (is_literal_one_byte()) {
|
if (is_literal_one_byte()) {
|
||||||
return finder->AddOneByteSymbol(literal_one_byte_string(), value);
|
return finder->AddOneByteSymbol(literal_one_byte_string(), value);
|
||||||
|
@ -427,7 +427,6 @@ class Scanner {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int FindNumber(DuplicateFinder* finder, int value);
|
|
||||||
int FindSymbol(DuplicateFinder* finder, int value);
|
int FindSymbol(DuplicateFinder* finder, int value);
|
||||||
|
|
||||||
UnicodeCache* unicode_cache() { return unicode_cache_; }
|
UnicodeCache* unicode_cache() { return unicode_cache_; }
|
||||||
|
Loading…
Reference in New Issue
Block a user