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

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

Issue 2481163002: Assign unique IDs to FunctionLiterals (Closed)
Patch Set: updates Created 4 years, 1 month 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
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 644 matching lines...) Expand 10 before | Expand all | Expand 10 after
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, int function_length, 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 bool has_braces) { 665 bool has_braces, int function_literal_num) {
666 return PreParserExpression::Default(); 666 return PreParserExpression::Default();
667 } 667 }
668 668
669 PreParserExpression NewSpread(PreParserExpression expression, int pos, 669 PreParserExpression NewSpread(PreParserExpression expression, int pos,
670 int expr_pos) { 670 int expr_pos) {
671 return PreParserExpression::Spread(expression); 671 return PreParserExpression::Spread(expression);
672 } 672 }
673 673
674 PreParserExpression NewEmptyParentheses(int pos) { 674 PreParserExpression NewEmptyParentheses(int pos) {
675 return PreParserExpression::Default(); 675 return PreParserExpression::Default();
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
1073 DeclareClass(PreParserIdentifier variable_name, PreParserExpression value, 1073 DeclareClass(PreParserIdentifier variable_name, PreParserExpression value,
1074 ZoneList<const AstRawString*>* names, int class_token_pos, 1074 ZoneList<const AstRawString*>* names, int class_token_pos,
1075 int end_pos, bool* ok) { 1075 int end_pos, bool* ok) {
1076 return PreParserStatement::Default(); 1076 return PreParserStatement::Default();
1077 } 1077 }
1078 V8_INLINE void DeclareClassVariable(PreParserIdentifier name, 1078 V8_INLINE void DeclareClassVariable(PreParserIdentifier name,
1079 Scope* block_scope, ClassInfo* class_info, 1079 Scope* block_scope, ClassInfo* class_info,
1080 int class_token_pos, bool* ok) {} 1080 int class_token_pos, bool* ok) {}
1081 V8_INLINE void DeclareClassProperty(PreParserIdentifier class_name, 1081 V8_INLINE void DeclareClassProperty(PreParserIdentifier class_name,
1082 PreParserExpression property, 1082 PreParserExpression property,
1083 ClassInfo* class_info, bool* ok) {} 1083 ClassLiteralProperty::Kind kind,
1084 bool is_static, ClassInfo* class_info,
1085 bool* ok) {
1086 if (class_info->has_seen_constructor &&
1087 !class_info->constructor.IsEmpty()) {
1088 // We use Empty to differentiate an existing constructor from Default
1089 // which encodes the absence of a constructor.
1090 class_info->constructor = PreParserExpression::Empty();
marja 2016/11/18 10:51:10 Hmm, why does this matter?
jochen (gone - plz use gerrit) 2016/11/21 08:03:47 When the ParserBase defines the constructor, it se
1091 return;
1092 }
1093 if (kind == ClassLiteralProperty::FIELD && !is_static) {
1094 class_info->instance_field_initializers->Add(
1095 PreParserExpression::Default(), zone());
1096 }
1097 }
1084 V8_INLINE PreParserExpression RewriteClassLiteral(PreParserIdentifier name, 1098 V8_INLINE PreParserExpression RewriteClassLiteral(PreParserIdentifier name,
1085 ClassInfo* class_info, 1099 ClassInfo* class_info,
1086 int pos, bool* ok) { 1100 int pos, bool* ok) {
1101 bool has_default_constructor = !class_info->has_seen_constructor;
1102 bool has_instance_fields =
marja 2016/11/18 10:51:10 Where's the equivalent thing for these on the pars
jochen (gone - plz use gerrit) 2016/11/21 08:03:47 In Parser::RewriteClassLiteral - it's exactly the
1103 class_info->instance_field_initializers->length() > 0;
1104 // Account for the default constructor.
1105 if (has_default_constructor) GetNextFunctionLiteralNum();
1106 if (allow_harmony_class_fields() && has_instance_fields) {
1107 // Account for initializer function.
1108 GetNextFunctionLiteralNum();
1109 }
1087 return PreParserExpression::Default(); 1110 return PreParserExpression::Default();
1088 } 1111 }
1089 1112
1090 V8_INLINE PreParserStatement DeclareNative(PreParserIdentifier name, int pos, 1113 V8_INLINE PreParserStatement DeclareNative(PreParserIdentifier name, int pos,
1091 bool* ok) { 1114 bool* ok) {
1092 return PreParserStatement::Default(); 1115 return PreParserStatement::Default();
1093 } 1116 }
1094 1117
1095 V8_INLINE void QueueDestructuringAssignmentForRewriting( 1118 V8_INLINE void QueueDestructuringAssignmentForRewriting(
1096 PreParserExpression assignment) {} 1119 PreParserExpression assignment) {}
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
1559 function_state_->NextMaterializedLiteralIndex(); 1582 function_state_->NextMaterializedLiteralIndex();
1560 function_state_->NextMaterializedLiteralIndex(); 1583 function_state_->NextMaterializedLiteralIndex();
1561 } 1584 }
1562 return EmptyExpression(); 1585 return EmptyExpression();
1563 } 1586 }
1564 1587
1565 } // namespace internal 1588 } // namespace internal
1566 } // namespace v8 1589 } // namespace v8
1567 1590
1568 #endif // V8_PARSING_PREPARSER_H 1591 #endif // V8_PARSING_PREPARSER_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698