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

Unified Diff: src/parsing/scanner.cc

Issue 1970333004: Revert of add UseCounters for NonOctalDecimalIntegerLiteral in strict mode (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 7 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 718dbab73c8054ceff6b8f93e3d72348188d1128..faec88b8a4bfb5ff37bf8dad58fefc32cd8ff03f 100644
--- a/src/parsing/scanner.cc
+++ b/src/parsing/scanner.cc
@@ -40,7 +40,6 @@
: unicode_cache_(unicode_cache),
bookmark_c0_(kNoBookmark),
octal_pos_(Location::invalid()),
- decimal_with_leading_zero_pos_(Location::invalid()),
found_html_comment_(false),
allow_harmony_exponentiation_operator_(false) {
bookmark_current_.literal_chars = &bookmark_current_literal_;
@@ -976,18 +975,10 @@
Token::Value Scanner::ScanNumber(bool seen_period) {
DCHECK(IsDecimalDigit(c0_)); // the first digit of the number or the fraction
- enum {
- DECIMAL,
- DECIMAL_WITH_LEADING_ZERO,
- HEX,
- OCTAL,
- IMPLICIT_OCTAL,
- BINARY
- } kind = DECIMAL;
+ enum { DECIMAL, HEX, OCTAL, IMPLICIT_OCTAL, BINARY } kind = DECIMAL;
LiteralScope literal(this);
bool at_start = !seen_period;
- int start_pos; // For reporting octal positions.
if (seen_period) {
// we have already seen a decimal point of the float
AddLiteralChar('.');
@@ -996,7 +987,7 @@
} else {
// if the first character is '0' we must check for octals and hex
if (c0_ == '0') {
- start_pos = source_pos();
+ int start_pos = source_pos(); // For reporting octal positions.
AddLiteralCharAdvance();
// either 0, 0exxx, 0Exxx, 0.xxx, a hex number, a binary number or
@@ -1038,7 +1029,7 @@
while (true) {
if (c0_ == '8' || c0_ == '9') {
at_start = false;
- kind = DECIMAL_WITH_LEADING_ZERO;
+ kind = DECIMAL;
break;
}
if (c0_ < '0' || '7' < c0_) {
@@ -1048,13 +1039,11 @@
}
AddLiteralCharAdvance();
}
- } else if (c0_ == '8' || c0_ == '9') {
- kind = DECIMAL_WITH_LEADING_ZERO;
}
}
// Parse decimal digits and allow trailing fractional part.
- if (kind == DECIMAL || kind == DECIMAL_WITH_LEADING_ZERO) {
+ if (kind == DECIMAL) {
if (at_start) {
uint64_t value = 0;
while (IsDecimalDigit(c0_)) {
@@ -1071,8 +1060,6 @@
literal.Complete();
HandleLeadSurrogate();
- if (kind == DECIMAL_WITH_LEADING_ZERO)
- decimal_with_leading_zero_pos_ = Location(start_pos, source_pos());
return Token::SMI;
}
HandleLeadSurrogate();
@@ -1089,8 +1076,7 @@
// scan exponent, if any
if (c0_ == 'e' || c0_ == 'E') {
DCHECK(kind != HEX); // 'e'/'E' must be scanned as part of the hex number
- if (!(kind == DECIMAL || kind == DECIMAL_WITH_LEADING_ZERO))
- return Token::ILLEGAL;
+ if (kind != DECIMAL) return Token::ILLEGAL;
// scan exponent
AddLiteralCharAdvance();
if (c0_ == '+' || c0_ == '-')
@@ -1112,8 +1098,6 @@
literal.Complete();
- if (kind == DECIMAL_WITH_LEADING_ZERO)
- decimal_with_leading_zero_pos_ = Location(start_pos, source_pos());
return Token::NUMBER;
}
« 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