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

Side by Side Diff: src/parsing/parser-base.h

Issue 2599253002: [counters] Add UseCounters for 'f() = 0' syntax (Closed)
Patch Set: fix test Created 3 years, 12 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 | « include/v8.h ('k') | test/cctest/test-usecounters.cc » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 #ifndef V8_PARSING_PARSER_BASE_H 5 #ifndef V8_PARSING_PARSER_BASE_H
6 #define V8_PARSING_PARSER_BASE_H 6 #define V8_PARSING_PARSER_BASE_H
7 7
8 #include "src/ast/ast.h" 8 #include "src/ast/ast.h"
9 #include "src/ast/scopes.h" 9 #include "src/ast/scopes.h"
10 #include "src/bailout-reason.h" 10 #include "src/bailout-reason.h"
(...skipping 4313 matching lines...) Expand 10 before | Expand all | Expand 10 after
4324 ReportMessageAt(Scanner::Location(beg_pos, end_pos), 4324 ReportMessageAt(Scanner::Location(beg_pos, end_pos),
4325 MessageTemplate::kStrictEvalArguments, kSyntaxError); 4325 MessageTemplate::kStrictEvalArguments, kSyntaxError);
4326 *ok = false; 4326 *ok = false;
4327 return impl()->EmptyExpression(); 4327 return impl()->EmptyExpression();
4328 } 4328 }
4329 if (expression->IsValidReferenceExpression()) { 4329 if (expression->IsValidReferenceExpression()) {
4330 return expression; 4330 return expression;
4331 } 4331 }
4332 if (expression->IsCall()) { 4332 if (expression->IsCall()) {
4333 // If it is a call, make it a runtime error for legacy web compatibility. 4333 // If it is a call, make it a runtime error for legacy web compatibility.
4334 // Bug: https://bugs.chromium.org/p/v8/issues/detail?id=4480
4334 // Rewrite `expr' to `expr[throw ReferenceError]'. 4335 // Rewrite `expr' to `expr[throw ReferenceError]'.
4336 impl()->CountUsage(
4337 is_strict(language_mode())
4338 ? v8::Isolate::kAssigmentExpressionLHSIsCallInStrict
4339 : v8::Isolate::kAssigmentExpressionLHSIsCallInSloppy);
4335 ExpressionT error = impl()->NewThrowReferenceError(message, beg_pos); 4340 ExpressionT error = impl()->NewThrowReferenceError(message, beg_pos);
4336 return factory()->NewProperty(expression, error, beg_pos); 4341 return factory()->NewProperty(expression, error, beg_pos);
4337 } 4342 }
4338 ReportMessageAt(Scanner::Location(beg_pos, end_pos), message, type); 4343 ReportMessageAt(Scanner::Location(beg_pos, end_pos), message, type);
4339 *ok = false; 4344 *ok = false;
4340 return impl()->EmptyExpression(); 4345 return impl()->EmptyExpression();
4341 } 4346 }
4342 4347
4343 template <typename Impl> 4348 template <typename Impl>
4344 bool ParserBase<Impl>::IsValidReferenceExpression(ExpressionT expression) { 4349 bool ParserBase<Impl>::IsValidReferenceExpression(ExpressionT expression) {
(...skipping 1148 matching lines...) Expand 10 before | Expand all | Expand 10 after
5493 has_seen_constructor_ = true; 5498 has_seen_constructor_ = true;
5494 return; 5499 return;
5495 } 5500 }
5496 } 5501 }
5497 5502
5498 5503
5499 } // namespace internal 5504 } // namespace internal
5500 } // namespace v8 5505 } // namespace v8
5501 5506
5502 #endif // V8_PARSING_PARSER_BASE_H 5507 #endif // V8_PARSING_PARSER_BASE_H
OLDNEW
« no previous file with comments | « include/v8.h ('k') | test/cctest/test-usecounters.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698