OLD | NEW |
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_H_ | 5 #ifndef V8_PARSING_PARSER_H_ |
6 #define V8_PARSING_PARSER_H_ | 6 #define V8_PARSING_PARSER_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/base/compiler-specific.h" | 10 #include "src/base/compiler-specific.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 class FunctionEntry BASE_EMBEDDED { | 29 class FunctionEntry BASE_EMBEDDED { |
30 public: | 30 public: |
31 enum { | 31 enum { |
32 kStartPositionIndex, | 32 kStartPositionIndex, |
33 kEndPositionIndex, | 33 kEndPositionIndex, |
34 kNumParametersIndex, | 34 kNumParametersIndex, |
35 kFunctionLengthIndex, | 35 kFunctionLengthIndex, |
36 kLiteralCountIndex, | 36 kLiteralCountIndex, |
37 kPropertyCountIndex, | 37 kPropertyCountIndex, |
38 kFlagsIndex, | 38 kFlagsIndex, |
| 39 kNumInnerFunctionsIndex, |
39 kSize | 40 kSize |
40 }; | 41 }; |
41 | 42 |
42 explicit FunctionEntry(Vector<unsigned> backing) | 43 explicit FunctionEntry(Vector<unsigned> backing) |
43 : backing_(backing) { } | 44 : backing_(backing) { } |
44 | 45 |
45 FunctionEntry() : backing_() { } | 46 FunctionEntry() : backing_() { } |
46 | 47 |
47 class LanguageModeField : public BitField<LanguageMode, 0, 1> {}; | 48 class LanguageModeField : public BitField<LanguageMode, 0, 1> {}; |
48 class UsesSuperPropertyField | 49 class UsesSuperPropertyField |
(...skipping 23 matching lines...) Expand all Loading... |
72 } | 73 } |
73 bool uses_super_property() const { | 74 bool uses_super_property() const { |
74 return UsesSuperPropertyField::decode(backing_[kFlagsIndex]); | 75 return UsesSuperPropertyField::decode(backing_[kFlagsIndex]); |
75 } | 76 } |
76 bool calls_eval() const { | 77 bool calls_eval() const { |
77 return CallsEvalField::decode(backing_[kFlagsIndex]); | 78 return CallsEvalField::decode(backing_[kFlagsIndex]); |
78 } | 79 } |
79 bool has_duplicate_parameters() const { | 80 bool has_duplicate_parameters() const { |
80 return HasDuplicateParametersField::decode(backing_[kFlagsIndex]); | 81 return HasDuplicateParametersField::decode(backing_[kFlagsIndex]); |
81 } | 82 } |
| 83 int num_inner_functions() const { return backing_[kNumInnerFunctionsIndex]; } |
82 | 84 |
83 bool is_valid() const { return !backing_.is_empty(); } | 85 bool is_valid() const { return !backing_.is_empty(); } |
84 | 86 |
85 private: | 87 private: |
86 Vector<unsigned> backing_; | 88 Vector<unsigned> backing_; |
87 }; | 89 }; |
88 | 90 |
89 | 91 |
90 // Wrapper around ScriptData to provide parser-specific functionality. | 92 // Wrapper around ScriptData to provide parser-specific functionality. |
91 class ParseData { | 93 class ParseData { |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 ZoneList<const AstRawString*>* names, bool* ok); | 346 ZoneList<const AstRawString*>* names, bool* ok); |
345 V8_INLINE Statement* DeclareClass(const AstRawString* variable_name, | 347 V8_INLINE Statement* DeclareClass(const AstRawString* variable_name, |
346 Expression* value, | 348 Expression* value, |
347 ZoneList<const AstRawString*>* names, | 349 ZoneList<const AstRawString*>* names, |
348 int class_token_pos, int end_pos, bool* ok); | 350 int class_token_pos, int end_pos, bool* ok); |
349 V8_INLINE void DeclareClassVariable(const AstRawString* name, | 351 V8_INLINE void DeclareClassVariable(const AstRawString* name, |
350 Scope* block_scope, ClassInfo* class_info, | 352 Scope* block_scope, ClassInfo* class_info, |
351 int class_token_pos, bool* ok); | 353 int class_token_pos, bool* ok); |
352 V8_INLINE void DeclareClassProperty(const AstRawString* class_name, | 354 V8_INLINE void DeclareClassProperty(const AstRawString* class_name, |
353 ClassLiteralProperty* property, | 355 ClassLiteralProperty* property, |
| 356 ClassLiteralProperty::Kind kind, |
| 357 bool is_static, bool is_constructor, |
354 ClassInfo* class_info, bool* ok); | 358 ClassInfo* class_info, bool* ok); |
355 V8_INLINE Expression* RewriteClassLiteral(const AstRawString* name, | 359 V8_INLINE Expression* RewriteClassLiteral(const AstRawString* name, |
356 ClassInfo* class_info, int pos, | 360 ClassInfo* class_info, int pos, |
357 bool* ok); | 361 bool* ok); |
358 V8_INLINE Statement* DeclareNative(const AstRawString* name, int pos, | 362 V8_INLINE Statement* DeclareNative(const AstRawString* name, int pos, |
359 bool* ok); | 363 bool* ok); |
360 | 364 |
361 class PatternRewriter final : public AstVisitor<PatternRewriter> { | 365 class PatternRewriter final : public AstVisitor<PatternRewriter> { |
362 public: | 366 public: |
363 static void DeclareAndInitializeVariables( | 367 static void DeclareAndInitializeVariables( |
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1181 | 1185 |
1182 private: | 1186 private: |
1183 ParserTarget** variable_; | 1187 ParserTarget** variable_; |
1184 ParserTarget* previous_; | 1188 ParserTarget* previous_; |
1185 }; | 1189 }; |
1186 | 1190 |
1187 } // namespace internal | 1191 } // namespace internal |
1188 } // namespace v8 | 1192 } // namespace v8 |
1189 | 1193 |
1190 #endif // V8_PARSING_PARSER_H_ | 1194 #endif // V8_PARSING_PARSER_H_ |
OLD | NEW |