| 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/assembler.h" |     8 #include "src/assembler.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 2817 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2828   FunctionLiteral* constructor() const { return constructor_; } |  2828   FunctionLiteral* constructor() const { return constructor_; } | 
|  2829   void set_constructor(FunctionLiteral* f) { constructor_ = f; } |  2829   void set_constructor(FunctionLiteral* f) { constructor_ = f; } | 
|  2830   ZoneList<Property*>* properties() const { return properties_; } |  2830   ZoneList<Property*>* properties() const { return properties_; } | 
|  2831   int start_position() const { return position(); } |  2831   int start_position() const { return position(); } | 
|  2832   int end_position() const { return end_position_; } |  2832   int end_position() const { return end_position_; } | 
|  2833  |  2833  | 
|  2834   BailoutId EntryId() const { return BailoutId(local_id(0)); } |  2834   BailoutId EntryId() const { return BailoutId(local_id(0)); } | 
|  2835   BailoutId DeclsId() const { return BailoutId(local_id(1)); } |  2835   BailoutId DeclsId() const { return BailoutId(local_id(1)); } | 
|  2836   BailoutId ExitId() { return BailoutId(local_id(2)); } |  2836   BailoutId ExitId() { return BailoutId(local_id(2)); } | 
|  2837   BailoutId CreateLiteralId() const { return BailoutId(local_id(3)); } |  2837   BailoutId CreateLiteralId() const { return BailoutId(local_id(3)); } | 
 |  2838   BailoutId PrototypeId() { return BailoutId(local_id(4)); } | 
|  2838  |  2839  | 
|  2839   // Return an AST id for a property that is used in simulate instructions. |  2840   // Return an AST id for a property that is used in simulate instructions. | 
|  2840   BailoutId GetIdForProperty(int i) { return BailoutId(local_id(i + 4)); } |  2841   BailoutId GetIdForProperty(int i) { return BailoutId(local_id(i + 5)); } | 
|  2841  |  2842  | 
|  2842   // Unlike other AST nodes, this number of bailout IDs allocated for an |  2843   // Unlike other AST nodes, this number of bailout IDs allocated for an | 
|  2843   // ClassLiteral can vary, so num_ids() is not a static method. |  2844   // ClassLiteral can vary, so num_ids() is not a static method. | 
|  2844   int num_ids() const { return parent_num_ids() + 4 + properties()->length(); } |  2845   int num_ids() const { return parent_num_ids() + 5 + properties()->length(); } | 
|  2845  |  2846  | 
|  2846   // Object literals need one feedback slot for each non-trivial value, as well |  2847   // Object literals need one feedback slot for each non-trivial value, as well | 
|  2847   // as some slots for home objects. |  2848   // as some slots for home objects. | 
|  2848   void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec, |  2849   void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec, | 
|  2849                                  FeedbackVectorSlotCache* cache) override; |  2850                                  FeedbackVectorSlotCache* cache) override; | 
|  2850  |  2851  | 
|  2851   bool NeedsProxySlot() const { |  2852   bool NeedsProxySlot() const { | 
|  2852     return class_variable_proxy() != nullptr && |  2853     return class_variable_proxy() != nullptr && | 
|  2853            class_variable_proxy()->var()->IsUnallocated(); |  2854            class_variable_proxy()->var()->IsUnallocated(); | 
|  2854   } |  2855   } | 
|  2855  |  2856  | 
|  2856   FeedbackVectorSlot ProxySlot() const { return slot_; } |  2857   FeedbackVectorSlot PrototypeSlot() const { return prototype_slot_; } | 
 |  2858   FeedbackVectorSlot ProxySlot() const { return proxy_slot_; } | 
|  2857  |  2859  | 
|  2858   bool IsAnonymousFunctionDefinition() const final { |  2860   bool IsAnonymousFunctionDefinition() const final { | 
|  2859     return constructor()->raw_name()->length() == 0; |  2861     return constructor()->raw_name()->length() == 0; | 
|  2860   } |  2862   } | 
|  2861  |  2863  | 
|  2862  protected: |  2864  protected: | 
|  2863   ClassLiteral(Zone* zone, Scope* scope, VariableProxy* class_variable_proxy, |  2865   ClassLiteral(Zone* zone, Scope* scope, VariableProxy* class_variable_proxy, | 
|  2864                Expression* extends, FunctionLiteral* constructor, |  2866                Expression* extends, FunctionLiteral* constructor, | 
|  2865                ZoneList<Property*>* properties, int start_position, |  2867                ZoneList<Property*>* properties, int start_position, | 
|  2866                int end_position) |  2868                int end_position) | 
|  2867       : Expression(zone, start_position), |  2869       : Expression(zone, start_position), | 
|  2868         scope_(scope), |  2870         scope_(scope), | 
|  2869         class_variable_proxy_(class_variable_proxy), |  2871         class_variable_proxy_(class_variable_proxy), | 
|  2870         extends_(extends), |  2872         extends_(extends), | 
|  2871         constructor_(constructor), |  2873         constructor_(constructor), | 
|  2872         properties_(properties), |  2874         properties_(properties), | 
|  2873         end_position_(end_position) {} |  2875         end_position_(end_position) {} | 
|  2874  |  2876  | 
|  2875   static int parent_num_ids() { return Expression::num_ids(); } |  2877   static int parent_num_ids() { return Expression::num_ids(); } | 
|  2876  |  2878  | 
|  2877  private: |  2879  private: | 
|  2878   int local_id(int n) const { return base_id() + parent_num_ids() + n; } |  2880   int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 
|  2879  |  2881  | 
|  2880   Scope* scope_; |  2882   Scope* scope_; | 
|  2881   VariableProxy* class_variable_proxy_; |  2883   VariableProxy* class_variable_proxy_; | 
|  2882   Expression* extends_; |  2884   Expression* extends_; | 
|  2883   FunctionLiteral* constructor_; |  2885   FunctionLiteral* constructor_; | 
|  2884   ZoneList<Property*>* properties_; |  2886   ZoneList<Property*>* properties_; | 
|  2885   int end_position_; |  2887   int end_position_; | 
|  2886   FeedbackVectorSlot slot_; |  2888   FeedbackVectorSlot prototype_slot_; | 
 |  2889   FeedbackVectorSlot proxy_slot_; | 
|  2887 }; |  2890 }; | 
|  2888  |  2891  | 
|  2889  |  2892  | 
|  2890 class NativeFunctionLiteral final : public Expression { |  2893 class NativeFunctionLiteral final : public Expression { | 
|  2891  public: |  2894  public: | 
|  2892   DECLARE_NODE_TYPE(NativeFunctionLiteral) |  2895   DECLARE_NODE_TYPE(NativeFunctionLiteral) | 
|  2893  |  2896  | 
|  2894   Handle<String> name() const { return name_->string(); } |  2897   Handle<String> name() const { return name_->string(); } | 
|  2895   v8::Extension* extension() const { return extension_; } |  2898   v8::Extension* extension() const { return extension_; } | 
|  2896  |  2899  | 
| (...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  3546   // the parser-level zone. |  3549   // the parser-level zone. | 
|  3547   Zone* parser_zone_; |  3550   Zone* parser_zone_; | 
|  3548   AstValueFactory* ast_value_factory_; |  3551   AstValueFactory* ast_value_factory_; | 
|  3549 }; |  3552 }; | 
|  3550  |  3553  | 
|  3551  |  3554  | 
|  3552 }  // namespace internal |  3555 }  // namespace internal | 
|  3553 }  // namespace v8 |  3556 }  // namespace v8 | 
|  3554  |  3557  | 
|  3555 #endif  // V8_AST_AST_H_ |  3558 #endif  // V8_AST_AST_H_ | 
| OLD | NEW |