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

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

Issue 2414003002: Move function length tracking from Scope to (Pre)?ParserFormalParameters. (Closed)
Patch Set: oops cont Created 4 years, 2 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/parser-base.h ('k') | no next file » | 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_PREPARSER_H 5 #ifndef V8_PARSING_PREPARSER_H
6 #define V8_PARSING_PREPARSER_H 6 #define V8_PARSING_PREPARSER_H
7 7
8 #include "src/ast/scopes.h" 8 #include "src/ast/scopes.h"
9 #include "src/parsing/parser-base.h" 9 #include "src/parsing/parser-base.h"
10 10
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 int pos) { 651 int pos) {
652 return PreParserExpression::Default(); 652 return PreParserExpression::Default();
653 } 653 }
654 PreParserStatement NewReturnStatement(PreParserExpression expression, 654 PreParserStatement NewReturnStatement(PreParserExpression expression,
655 int pos) { 655 int pos) {
656 return PreParserStatement::Jump(); 656 return PreParserStatement::Jump();
657 } 657 }
658 PreParserExpression NewFunctionLiteral( 658 PreParserExpression NewFunctionLiteral(
659 PreParserIdentifier name, Scope* scope, PreParserStatementList body, 659 PreParserIdentifier name, Scope* scope, PreParserStatementList body,
660 int materialized_literal_count, int expected_property_count, 660 int materialized_literal_count, int expected_property_count,
661 int parameter_count, 661 int parameter_count, int function_length,
662 FunctionLiteral::ParameterFlag has_duplicate_parameters, 662 FunctionLiteral::ParameterFlag has_duplicate_parameters,
663 FunctionLiteral::FunctionType function_type, 663 FunctionLiteral::FunctionType function_type,
664 FunctionLiteral::EagerCompileHint eager_compile_hint, int position) { 664 FunctionLiteral::EagerCompileHint eager_compile_hint, int position) {
665 return PreParserExpression::Default(); 665 return PreParserExpression::Default();
666 } 666 }
667 667
668 PreParserExpression NewSpread(PreParserExpression expression, int pos, 668 PreParserExpression NewSpread(PreParserExpression expression, int pos,
669 int expr_pos) { 669 int expr_pos) {
670 return PreParserExpression::Spread(expression); 670 return PreParserExpression::Spread(expression);
671 } 671 }
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 } 754 }
755 755
756 private: 756 private:
757 Zone* zone_; 757 Zone* zone_;
758 }; 758 };
759 759
760 760
761 struct PreParserFormalParameters : FormalParametersBase { 761 struct PreParserFormalParameters : FormalParametersBase {
762 explicit PreParserFormalParameters(DeclarationScope* scope) 762 explicit PreParserFormalParameters(DeclarationScope* scope)
763 : FormalParametersBase(scope) {} 763 : FormalParametersBase(scope) {}
764 int arity = 0;
765
766 int Arity() const { return arity; }
767 PreParserIdentifier at(int i) { return PreParserIdentifier(); } // Dummy 764 PreParserIdentifier at(int i) { return PreParserIdentifier(); } // Dummy
768 }; 765 };
769 766
770 767
771 class PreParser; 768 class PreParser;
772 769
773 class PreParserTarget { 770 class PreParserTarget {
774 public: 771 public:
775 PreParserTarget(ParserBase<PreParser>* preparser, 772 PreParserTarget(ParserBase<PreParser>* preparser,
776 PreParserStatement statement) {} 773 PreParserStatement statement) {}
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after
1427 1424
1428 V8_INLINE void AddParameterInitializationBlock( 1425 V8_INLINE void AddParameterInitializationBlock(
1429 const PreParserFormalParameters& parameters, PreParserStatementList body, 1426 const PreParserFormalParameters& parameters, PreParserStatementList body,
1430 bool is_async, bool* ok) {} 1427 bool is_async, bool* ok) {}
1431 1428
1432 V8_INLINE void AddFormalParameter(PreParserFormalParameters* parameters, 1429 V8_INLINE void AddFormalParameter(PreParserFormalParameters* parameters,
1433 PreParserExpression pattern, 1430 PreParserExpression pattern,
1434 PreParserExpression initializer, 1431 PreParserExpression initializer,
1435 int initializer_end_position, 1432 int initializer_end_position,
1436 bool is_rest) { 1433 bool is_rest) {
1437 ++parameters->arity; 1434 parameters->UpdateArityAndFunctionLength(!initializer.IsEmpty(), is_rest);
1438 } 1435 }
1439 1436
1440 V8_INLINE void DeclareFormalParameter(DeclarationScope* scope, 1437 V8_INLINE void DeclareFormalParameter(DeclarationScope* scope,
1441 PreParserIdentifier parameter) { 1438 PreParserIdentifier parameter) {
1442 if (!classifier()->is_simple_parameter_list()) { 1439 if (!classifier()->is_simple_parameter_list()) {
1443 scope->SetHasNonSimpleParameters(); 1440 scope->SetHasNonSimpleParameters();
1444 } 1441 }
1445 } 1442 }
1446 1443
1447 V8_INLINE void DeclareArrowFunctionFormalParameters( 1444 V8_INLINE void DeclareArrowFunctionFormalParameters(
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
1541 function_state_->NextMaterializedLiteralIndex(); 1538 function_state_->NextMaterializedLiteralIndex();
1542 function_state_->NextMaterializedLiteralIndex(); 1539 function_state_->NextMaterializedLiteralIndex();
1543 } 1540 }
1544 return EmptyExpression(); 1541 return EmptyExpression();
1545 } 1542 }
1546 1543
1547 } // namespace internal 1544 } // namespace internal
1548 } // namespace v8 1545 } // namespace v8
1549 1546
1550 #endif // V8_PARSING_PREPARSER_H 1547 #endif // V8_PARSING_PREPARSER_H
OLDNEW
« no previous file with comments | « src/parsing/parser-base.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698