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

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

Issue 2481163002: Assign unique IDs to FunctionLiterals (Closed)
Patch Set: updates Created 4 years 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 634 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 int pos) { 645 int pos) {
646 return PreParserStatement::Jump(); 646 return PreParserStatement::Jump();
647 } 647 }
648 PreParserExpression NewFunctionLiteral( 648 PreParserExpression NewFunctionLiteral(
649 PreParserIdentifier name, Scope* scope, PreParserStatementList body, 649 PreParserIdentifier name, Scope* scope, PreParserStatementList body,
650 int materialized_literal_count, int expected_property_count, 650 int materialized_literal_count, int expected_property_count,
651 int parameter_count, int function_length, 651 int parameter_count, int function_length,
652 FunctionLiteral::ParameterFlag has_duplicate_parameters, 652 FunctionLiteral::ParameterFlag has_duplicate_parameters,
653 FunctionLiteral::FunctionType function_type, 653 FunctionLiteral::FunctionType function_type,
654 FunctionLiteral::EagerCompileHint eager_compile_hint, int position, 654 FunctionLiteral::EagerCompileHint eager_compile_hint, int position,
655 bool has_braces) { 655 bool has_braces, int function_literal_id) {
656 return PreParserExpression::Default(); 656 return PreParserExpression::Default();
657 } 657 }
658 658
659 PreParserExpression NewSpread(PreParserExpression expression, int pos, 659 PreParserExpression NewSpread(PreParserExpression expression, int pos,
660 int expr_pos) { 660 int expr_pos) {
661 return PreParserExpression::Spread(expression); 661 return PreParserExpression::Spread(expression);
662 } 662 }
663 663
664 PreParserExpression NewEmptyParentheses(int pos) { 664 PreParserExpression NewEmptyParentheses(int pos) {
665 return PreParserExpression::Default(); 665 return PreParserExpression::Default();
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
1063 DeclareClass(PreParserIdentifier variable_name, PreParserExpression value, 1063 DeclareClass(PreParserIdentifier variable_name, PreParserExpression value,
1064 ZoneList<const AstRawString*>* names, int class_token_pos, 1064 ZoneList<const AstRawString*>* names, int class_token_pos,
1065 int end_pos, bool* ok) { 1065 int end_pos, bool* ok) {
1066 return PreParserStatement::Default(); 1066 return PreParserStatement::Default();
1067 } 1067 }
1068 V8_INLINE void DeclareClassVariable(PreParserIdentifier name, 1068 V8_INLINE void DeclareClassVariable(PreParserIdentifier name,
1069 Scope* block_scope, ClassInfo* class_info, 1069 Scope* block_scope, ClassInfo* class_info,
1070 int class_token_pos, bool* ok) {} 1070 int class_token_pos, bool* ok) {}
1071 V8_INLINE void DeclareClassProperty(PreParserIdentifier class_name, 1071 V8_INLINE void DeclareClassProperty(PreParserIdentifier class_name,
1072 PreParserExpression property, 1072 PreParserExpression property,
1073 ClassInfo* class_info, bool* ok) {} 1073 ClassLiteralProperty::Kind kind,
1074 bool is_static, bool is_constructor,
1075 ClassInfo* class_info, bool* ok) {
1076 if (kind == ClassLiteralProperty::FIELD && !is_static && !is_constructor) {
1077 class_info->instance_field_initializers->Add(
1078 PreParserExpression::Default(), zone());
1079 }
1080 }
1074 V8_INLINE PreParserExpression RewriteClassLiteral(PreParserIdentifier name, 1081 V8_INLINE PreParserExpression RewriteClassLiteral(PreParserIdentifier name,
1075 ClassInfo* class_info, 1082 ClassInfo* class_info,
1076 int pos, bool* ok) { 1083 int pos, bool* ok) {
1084 bool has_default_constructor = !class_info->has_seen_constructor;
1085 bool has_instance_fields =
1086 class_info->instance_field_initializers->length() > 0;
1087 // Account for the default constructor.
1088 if (has_default_constructor) GetNextFunctionLiteralId();
1089 if (allow_harmony_class_fields() && has_instance_fields) {
1090 // Account for initializer function.
1091 GetNextFunctionLiteralId();
1092 }
1077 return PreParserExpression::Default(); 1093 return PreParserExpression::Default();
1078 } 1094 }
1079 1095
1080 V8_INLINE PreParserStatement DeclareNative(PreParserIdentifier name, int pos, 1096 V8_INLINE PreParserStatement DeclareNative(PreParserIdentifier name, int pos,
1081 bool* ok) { 1097 bool* ok) {
1082 return PreParserStatement::Default(); 1098 return PreParserStatement::Default();
1083 } 1099 }
1084 1100
1085 V8_INLINE void QueueDestructuringAssignmentForRewriting( 1101 V8_INLINE void QueueDestructuringAssignmentForRewriting(
1086 PreParserExpression assignment) {} 1102 PreParserExpression assignment) {}
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
1545 function_state_->NextMaterializedLiteralIndex(); 1561 function_state_->NextMaterializedLiteralIndex();
1546 function_state_->NextMaterializedLiteralIndex(); 1562 function_state_->NextMaterializedLiteralIndex();
1547 } 1563 }
1548 return EmptyExpression(); 1564 return EmptyExpression();
1549 } 1565 }
1550 1566
1551 } // namespace internal 1567 } // namespace internal
1552 } // namespace v8 1568 } // namespace v8
1553 1569
1554 #endif // V8_PARSING_PREPARSER_H 1570 #endif // V8_PARSING_PREPARSER_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698