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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 ZoneList<const AstRawString*>* names, bool* ok); | 348 ZoneList<const AstRawString*>* names, bool* ok); |
347 V8_INLINE Statement* DeclareClass(const AstRawString* variable_name, | 349 V8_INLINE Statement* DeclareClass(const AstRawString* variable_name, |
348 Expression* value, | 350 Expression* value, |
349 ZoneList<const AstRawString*>* names, | 351 ZoneList<const AstRawString*>* names, |
350 int class_token_pos, int end_pos, bool* ok); | 352 int class_token_pos, int end_pos, bool* ok); |
351 V8_INLINE void DeclareClassVariable(const AstRawString* name, | 353 V8_INLINE void DeclareClassVariable(const AstRawString* name, |
352 Scope* block_scope, ClassInfo* class_info, | 354 Scope* block_scope, ClassInfo* class_info, |
353 int class_token_pos, bool* ok); | 355 int class_token_pos, bool* ok); |
354 V8_INLINE void DeclareClassProperty(const AstRawString* class_name, | 356 V8_INLINE void DeclareClassProperty(const AstRawString* class_name, |
355 ClassLiteralProperty* property, | 357 ClassLiteralProperty* property, |
356 ClassInfo* class_info, bool* ok); | 358 ClassLiteralProperty::Kind kind, |
| 359 bool is_static, ClassInfo* class_info, |
| 360 bool* ok); |
357 V8_INLINE Expression* RewriteClassLiteral(const AstRawString* name, | 361 V8_INLINE Expression* RewriteClassLiteral(const AstRawString* name, |
358 ClassInfo* class_info, int pos, | 362 ClassInfo* class_info, int pos, |
359 bool* ok); | 363 bool* ok); |
360 V8_INLINE Statement* DeclareNative(const AstRawString* name, int pos, | 364 V8_INLINE Statement* DeclareNative(const AstRawString* name, int pos, |
361 bool* ok); | 365 bool* ok); |
362 | 366 |
363 class PatternRewriter final : public AstVisitor<PatternRewriter> { | 367 class PatternRewriter final : public AstVisitor<PatternRewriter> { |
364 public: | 368 public: |
365 static void DeclareAndInitializeVariables( | 369 static void DeclareAndInitializeVariables( |
366 Parser* parser, Block* block, | 370 Parser* parser, Block* block, |
(...skipping 819 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1186 | 1190 |
1187 private: | 1191 private: |
1188 ParserTarget** variable_; | 1192 ParserTarget** variable_; |
1189 ParserTarget* previous_; | 1193 ParserTarget* previous_; |
1190 }; | 1194 }; |
1191 | 1195 |
1192 } // namespace internal | 1196 } // namespace internal |
1193 } // namespace v8 | 1197 } // namespace v8 |
1194 | 1198 |
1195 #endif // V8_PARSING_PARSER_H_ | 1199 #endif // V8_PARSING_PARSER_H_ |
OLD | NEW |