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

Side by Side Diff: src/parsing/preparser.cc

Issue 1969203004: Add UseCounter for decimal with leading zero. (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 unified diff | Download patch
« no previous file with comments | « src/parsing/preparser.h ('k') | src/parsing/scanner.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <cmath> 5 #include <cmath>
6 6
7 #include "src/allocation.h" 7 #include "src/allocation.h"
8 #include "src/base/logging.h" 8 #include "src/base/logging.h"
9 #include "src/conversions-inl.h" 9 #include "src/conversions-inl.h"
10 #include "src/conversions.h" 10 #include "src/conversions.h"
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 // Do nothing, as we've just aborted scanning this function. 127 // Do nothing, as we've just aborted scanning this function.
128 } else if (stack_overflow()) { 128 } else if (stack_overflow()) {
129 return kPreParseStackOverflow; 129 return kPreParseStackOverflow;
130 } else if (!ok) { 130 } else if (!ok) {
131 ReportUnexpectedToken(scanner()->current_token()); 131 ReportUnexpectedToken(scanner()->current_token());
132 } else { 132 } else {
133 DCHECK_EQ(Token::RBRACE, scanner()->peek()); 133 DCHECK_EQ(Token::RBRACE, scanner()->peek());
134 if (is_strict(scope_->language_mode())) { 134 if (is_strict(scope_->language_mode())) {
135 int end_pos = scanner()->location().end_pos; 135 int end_pos = scanner()->location().end_pos;
136 CheckStrictOctalLiteral(start_position, end_pos, &ok); 136 CheckStrictOctalLiteral(start_position, end_pos, &ok);
137 CheckDecimalLiteralWithLeadingZero(use_counts, start_position, end_pos);
137 if (!ok) return kPreParseSuccess; 138 if (!ok) return kPreParseSuccess;
138 } 139 }
139 } 140 }
140 return kPreParseSuccess; 141 return kPreParseSuccess;
141 } 142 }
142 143
143 PreParserExpression PreParserTraits::ParseClassLiteral( 144 PreParserExpression PreParserTraits::ParseClassLiteral(
144 Type::ExpressionClassifier* classifier, PreParserIdentifier name, 145 Type::ExpressionClassifier* classifier, PreParserIdentifier name,
145 Scanner::Location class_name_location, bool name_is_strict_reserved, 146 Scanner::Location class_name_location, bool name_is_strict_reserved,
146 int pos, bool* ok) { 147 int pos, bool* ok) {
(...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after
1099 CheckFunctionName(language_mode, function_name, function_name_validity, 1100 CheckFunctionName(language_mode, function_name, function_name_validity,
1100 function_name_location, CHECK_OK); 1101 function_name_location, CHECK_OK);
1101 const bool allow_duplicate_parameters = 1102 const bool allow_duplicate_parameters =
1102 is_sloppy(language_mode) && formals.is_simple && !IsConciseMethod(kind); 1103 is_sloppy(language_mode) && formals.is_simple && !IsConciseMethod(kind);
1103 ValidateFormalParameters(&formals_classifier, language_mode, 1104 ValidateFormalParameters(&formals_classifier, language_mode,
1104 allow_duplicate_parameters, CHECK_OK); 1105 allow_duplicate_parameters, CHECK_OK);
1105 1106
1106 if (is_strict(language_mode)) { 1107 if (is_strict(language_mode)) {
1107 int end_position = scanner()->location().end_pos; 1108 int end_position = scanner()->location().end_pos;
1108 CheckStrictOctalLiteral(start_position, end_position, CHECK_OK); 1109 CheckStrictOctalLiteral(start_position, end_position, CHECK_OK);
1110 CheckDecimalLiteralWithLeadingZero(use_counts_, start_position,
1111 end_position);
1109 } 1112 }
1110 1113
1111 return Expression::Default(); 1114 return Expression::Default();
1112 } 1115 }
1113 1116
1114 1117
1115 void PreParser::ParseLazyFunctionLiteralBody(bool* ok, 1118 void PreParser::ParseLazyFunctionLiteralBody(bool* ok,
1116 Scanner::BookmarkScope* bookmark) { 1119 Scanner::BookmarkScope* bookmark) {
1117 int body_start = position(); 1120 int body_start = position();
1118 ParseStatementList(Token::RBRACE, ok, bookmark); 1121 ParseStatementList(Token::RBRACE, ok, bookmark);
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
1224 } 1227 }
1225 Expect(Token::RBRACE, CHECK_OK); 1228 Expect(Token::RBRACE, CHECK_OK);
1226 return PreParserExpression::Default(); 1229 return PreParserExpression::Default();
1227 } 1230 }
1228 1231
1229 #undef CHECK_OK 1232 #undef CHECK_OK
1230 1233
1231 1234
1232 } // namespace internal 1235 } // namespace internal
1233 } // namespace v8 1236 } // namespace v8
OLDNEW
« no previous file with comments | « src/parsing/preparser.h ('k') | src/parsing/scanner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698