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_AST_AST_H_ | 5 #ifndef V8_AST_AST_H_ |
6 #define V8_AST_AST_H_ | 6 #define V8_AST_AST_H_ |
7 | 7 |
8 #include "src/ast/ast-types.h" | 8 #include "src/ast/ast-types.h" |
9 #include "src/ast/ast-value-factory.h" | 9 #include "src/ast/ast-value-factory.h" |
10 #include "src/ast/modules.h" | 10 #include "src/ast/modules.h" |
(...skipping 2782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2793 typedef ClassLiteralProperty Property; | 2793 typedef ClassLiteralProperty Property; |
2794 | 2794 |
2795 VariableProxy* class_variable_proxy() const { return class_variable_proxy_; } | 2795 VariableProxy* class_variable_proxy() const { return class_variable_proxy_; } |
2796 Expression* extends() const { return extends_; } | 2796 Expression* extends() const { return extends_; } |
2797 void set_extends(Expression* e) { extends_ = e; } | 2797 void set_extends(Expression* e) { extends_ = e; } |
2798 FunctionLiteral* constructor() const { return constructor_; } | 2798 FunctionLiteral* constructor() const { return constructor_; } |
2799 void set_constructor(FunctionLiteral* f) { constructor_ = f; } | 2799 void set_constructor(FunctionLiteral* f) { constructor_ = f; } |
2800 ZoneList<Property*>* properties() const { return properties_; } | 2800 ZoneList<Property*>* properties() const { return properties_; } |
2801 int start_position() const { return position(); } | 2801 int start_position() const { return position(); } |
2802 int end_position() const { return end_position_; } | 2802 int end_position() const { return end_position_; } |
2803 bool has_name_static_property() const { return has_name_static_property_; } | |
2803 | 2804 |
2804 VariableProxy* static_initializer_proxy() const { | 2805 VariableProxy* static_initializer_proxy() const { |
2805 return static_initializer_proxy_; | 2806 return static_initializer_proxy_; |
2806 } | 2807 } |
2807 void set_static_initializer_proxy(VariableProxy* proxy) { | 2808 void set_static_initializer_proxy(VariableProxy* proxy) { |
2808 static_initializer_proxy_ = proxy; | 2809 static_initializer_proxy_ = proxy; |
2809 } | 2810 } |
2810 | 2811 |
2811 BailoutId CreateLiteralId() const { return BailoutId(local_id(0)); } | 2812 BailoutId CreateLiteralId() const { return BailoutId(local_id(0)); } |
2812 BailoutId PrototypeId() { return BailoutId(local_id(1)); } | 2813 BailoutId PrototypeId() { return BailoutId(local_id(1)); } |
(...skipping 16 matching lines...) Expand all Loading... | |
2829 } | 2830 } |
2830 | 2831 |
2831 FeedbackVectorSlot PrototypeSlot() const { return prototype_slot_; } | 2832 FeedbackVectorSlot PrototypeSlot() const { return prototype_slot_; } |
2832 FeedbackVectorSlot ProxySlot() const { return proxy_slot_; } | 2833 FeedbackVectorSlot ProxySlot() const { return proxy_slot_; } |
2833 | 2834 |
2834 private: | 2835 private: |
2835 friend class AstNodeFactory; | 2836 friend class AstNodeFactory; |
2836 | 2837 |
2837 ClassLiteral(VariableProxy* class_variable_proxy, Expression* extends, | 2838 ClassLiteral(VariableProxy* class_variable_proxy, Expression* extends, |
2838 FunctionLiteral* constructor, ZoneList<Property*>* properties, | 2839 FunctionLiteral* constructor, ZoneList<Property*>* properties, |
2839 int start_position, int end_position) | 2840 int start_position, int end_position, |
2841 bool has_name_static_property) | |
2840 : Expression(start_position, kClassLiteral), | 2842 : Expression(start_position, kClassLiteral), |
2841 end_position_(end_position), | 2843 end_position_(end_position), |
2842 class_variable_proxy_(class_variable_proxy), | 2844 class_variable_proxy_(class_variable_proxy), |
2843 extends_(extends), | 2845 extends_(extends), |
2844 constructor_(constructor), | 2846 constructor_(constructor), |
2845 properties_(properties), | 2847 properties_(properties), |
2846 static_initializer_proxy_(nullptr) {} | 2848 static_initializer_proxy_(nullptr), |
2849 has_name_static_property_(has_name_static_property) {} | |
2847 | 2850 |
2848 static int parent_num_ids() { return Expression::num_ids(); } | 2851 static int parent_num_ids() { return Expression::num_ids(); } |
2849 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 2852 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
2850 | 2853 |
2851 int end_position_; | 2854 int end_position_; |
2852 FeedbackVectorSlot prototype_slot_; | 2855 FeedbackVectorSlot prototype_slot_; |
2853 FeedbackVectorSlot proxy_slot_; | 2856 FeedbackVectorSlot proxy_slot_; |
2854 VariableProxy* class_variable_proxy_; | 2857 VariableProxy* class_variable_proxy_; |
2855 Expression* extends_; | 2858 Expression* extends_; |
2856 FunctionLiteral* constructor_; | 2859 FunctionLiteral* constructor_; |
2857 ZoneList<Property*>* properties_; | 2860 ZoneList<Property*>* properties_; |
2858 VariableProxy* static_initializer_proxy_; | 2861 VariableProxy* static_initializer_proxy_; |
2862 bool has_name_static_property_; | |
Toon Verwaest
2016/11/28 10:40:58
This should be added to the bitfield provided by A
| |
2859 }; | 2863 }; |
2860 | 2864 |
2861 | 2865 |
2862 class NativeFunctionLiteral final : public Expression { | 2866 class NativeFunctionLiteral final : public Expression { |
2863 public: | 2867 public: |
2864 Handle<String> name() const { return name_->string(); } | 2868 Handle<String> name() const { return name_->string(); } |
2865 v8::Extension* extension() const { return extension_; } | 2869 v8::Extension* extension() const { return extension_; } |
2866 | 2870 |
2867 private: | 2871 private: |
2868 friend class AstNodeFactory; | 2872 friend class AstNodeFactory; |
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3485 ClassLiteral::Property* NewClassLiteralProperty( | 3489 ClassLiteral::Property* NewClassLiteralProperty( |
3486 Expression* key, Expression* value, ClassLiteralProperty::Kind kind, | 3490 Expression* key, Expression* value, ClassLiteralProperty::Kind kind, |
3487 bool is_static, bool is_computed_name) { | 3491 bool is_static, bool is_computed_name) { |
3488 return new (zone_) | 3492 return new (zone_) |
3489 ClassLiteral::Property(key, value, kind, is_static, is_computed_name); | 3493 ClassLiteral::Property(key, value, kind, is_static, is_computed_name); |
3490 } | 3494 } |
3491 | 3495 |
3492 ClassLiteral* NewClassLiteral(VariableProxy* proxy, Expression* extends, | 3496 ClassLiteral* NewClassLiteral(VariableProxy* proxy, Expression* extends, |
3493 FunctionLiteral* constructor, | 3497 FunctionLiteral* constructor, |
3494 ZoneList<ClassLiteral::Property*>* properties, | 3498 ZoneList<ClassLiteral::Property*>* properties, |
3495 int start_position, int end_position) { | 3499 int start_position, int end_position, |
3496 return new (zone_) ClassLiteral(proxy, extends, constructor, properties, | 3500 bool has_name_static_property) { |
3497 start_position, end_position); | 3501 return new (zone_) |
3502 ClassLiteral(proxy, extends, constructor, properties, start_position, | |
3503 end_position, has_name_static_property); | |
3498 } | 3504 } |
3499 | 3505 |
3500 NativeFunctionLiteral* NewNativeFunctionLiteral(const AstRawString* name, | 3506 NativeFunctionLiteral* NewNativeFunctionLiteral(const AstRawString* name, |
3501 v8::Extension* extension, | 3507 v8::Extension* extension, |
3502 int pos) { | 3508 int pos) { |
3503 return new (zone_) NativeFunctionLiteral(name, extension, pos); | 3509 return new (zone_) NativeFunctionLiteral(name, extension, pos); |
3504 } | 3510 } |
3505 | 3511 |
3506 DoExpression* NewDoExpression(Block* block, Variable* result_var, int pos) { | 3512 DoExpression* NewDoExpression(Block* block, Variable* result_var, int pos) { |
3507 VariableProxy* result = NewVariableProxy(result_var, pos); | 3513 VariableProxy* result = NewVariableProxy(result_var, pos); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3598 : NULL; \ | 3604 : NULL; \ |
3599 } | 3605 } |
3600 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) | 3606 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) |
3601 #undef DECLARE_NODE_FUNCTIONS | 3607 #undef DECLARE_NODE_FUNCTIONS |
3602 | 3608 |
3603 | 3609 |
3604 } // namespace internal | 3610 } // namespace internal |
3605 } // namespace v8 | 3611 } // namespace v8 |
3606 | 3612 |
3607 #endif // V8_AST_AST_H_ | 3613 #endif // V8_AST_AST_H_ |
OLD | NEW |