| 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_H_ | 5 #ifndef V8_AST_H_ |
| 6 #define V8_AST_H_ | 6 #define V8_AST_H_ |
| 7 | 7 |
| 8 #include "src/v8.h" | 8 #include "src/v8.h" |
| 9 | 9 |
| 10 #include "src/assembler.h" | 10 #include "src/assembler.h" |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 }; | 181 }; |
| 182 | 182 |
| 183 | 183 |
| 184 typedef List<VariableICSlotPair> ICSlotCache; | 184 typedef List<VariableICSlotPair> ICSlotCache; |
| 185 | 185 |
| 186 | 186 |
| 187 class AstProperties FINAL BASE_EMBEDDED { | 187 class AstProperties FINAL BASE_EMBEDDED { |
| 188 public: | 188 public: |
| 189 class Flags : public EnumSet<AstPropertiesFlag, int> {}; | 189 class Flags : public EnumSet<AstPropertiesFlag, int> {}; |
| 190 | 190 |
| 191 AstProperties() : node_count_(0) {} | 191 explicit AstProperties(Zone* zone) : node_count_(0), spec_(zone) {} |
| 192 | 192 |
| 193 Flags* flags() { return &flags_; } | 193 Flags* flags() { return &flags_; } |
| 194 int node_count() { return node_count_; } | 194 int node_count() { return node_count_; } |
| 195 void add_node_count(int count) { node_count_ += count; } | 195 void add_node_count(int count) { node_count_ += count; } |
| 196 | 196 |
| 197 int slots() const { return spec_.slots(); } | 197 int slots() const { return spec_.slots(); } |
| 198 void increase_slots(int count) { spec_.increase_slots(count); } | 198 void increase_slots(int count) { spec_.increase_slots(count); } |
| 199 | 199 |
| 200 int ic_slots() const { return spec_.ic_slots(); } | 200 int ic_slots() const { return spec_.ic_slots(); } |
| 201 void increase_ic_slots(int count) { spec_.increase_ic_slots(count); } | 201 void increase_ic_slots(int count) { spec_.increase_ic_slots(count); } |
| 202 void SetKind(int ic_slot, Code::Kind kind) { spec_.SetKind(ic_slot, kind); } | 202 void SetKind(int ic_slot, Code::Kind kind) { spec_.SetKind(ic_slot, kind); } |
| 203 const FeedbackVectorSpec& get_spec() const { return spec_; } | 203 const ZoneFeedbackVectorSpec* get_spec() const { return &spec_; } |
| 204 | 204 |
| 205 private: | 205 private: |
| 206 Flags flags_; | 206 Flags flags_; |
| 207 int node_count_; | 207 int node_count_; |
| 208 FeedbackVectorSpec spec_; | 208 ZoneFeedbackVectorSpec spec_; |
| 209 }; | 209 }; |
| 210 | 210 |
| 211 | 211 |
| 212 class AstNode: public ZoneObject { | 212 class AstNode: public ZoneObject { |
| 213 public: | 213 public: |
| 214 #define DECLARE_TYPE_ENUM(type) k##type, | 214 #define DECLARE_TYPE_ENUM(type) k##type, |
| 215 enum NodeType { | 215 enum NodeType { |
| 216 AST_NODE_LIST(DECLARE_TYPE_ENUM) | 216 AST_NODE_LIST(DECLARE_TYPE_ENUM) |
| 217 kInvalid = -1 | 217 kInvalid = -1 |
| 218 }; | 218 }; |
| (...skipping 2329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2548 bitfield_ = IsParenthesized::update(bitfield_, kIsParenthesized); | 2548 bitfield_ = IsParenthesized::update(bitfield_, kIsParenthesized); |
| 2549 } | 2549 } |
| 2550 | 2550 |
| 2551 FunctionKind kind() { return FunctionKindBits::decode(bitfield_); } | 2551 FunctionKind kind() { return FunctionKindBits::decode(bitfield_); } |
| 2552 | 2552 |
| 2553 int ast_node_count() { return ast_properties_.node_count(); } | 2553 int ast_node_count() { return ast_properties_.node_count(); } |
| 2554 AstProperties::Flags* flags() { return ast_properties_.flags(); } | 2554 AstProperties::Flags* flags() { return ast_properties_.flags(); } |
| 2555 void set_ast_properties(AstProperties* ast_properties) { | 2555 void set_ast_properties(AstProperties* ast_properties) { |
| 2556 ast_properties_ = *ast_properties; | 2556 ast_properties_ = *ast_properties; |
| 2557 } | 2557 } |
| 2558 const FeedbackVectorSpec& feedback_vector_spec() const { | 2558 const ZoneFeedbackVectorSpec* feedback_vector_spec() const { |
| 2559 return ast_properties_.get_spec(); | 2559 return ast_properties_.get_spec(); |
| 2560 } | 2560 } |
| 2561 bool dont_optimize() { return dont_optimize_reason_ != kNoReason; } | 2561 bool dont_optimize() { return dont_optimize_reason_ != kNoReason; } |
| 2562 BailoutReason dont_optimize_reason() { return dont_optimize_reason_; } | 2562 BailoutReason dont_optimize_reason() { return dont_optimize_reason_; } |
| 2563 void set_dont_optimize_reason(BailoutReason reason) { | 2563 void set_dont_optimize_reason(BailoutReason reason) { |
| 2564 dont_optimize_reason_ = reason; | 2564 dont_optimize_reason_ = reason; |
| 2565 } | 2565 } |
| 2566 | 2566 |
| 2567 protected: | 2567 protected: |
| 2568 FunctionLiteral(Zone* zone, const AstRawString* name, | 2568 FunctionLiteral(Zone* zone, const AstRawString* name, |
| 2569 AstValueFactory* ast_value_factory, Scope* scope, | 2569 AstValueFactory* ast_value_factory, Scope* scope, |
| 2570 ZoneList<Statement*>* body, int materialized_literal_count, | 2570 ZoneList<Statement*>* body, int materialized_literal_count, |
| 2571 int expected_property_count, int handler_count, | 2571 int expected_property_count, int handler_count, |
| 2572 int parameter_count, FunctionType function_type, | 2572 int parameter_count, FunctionType function_type, |
| 2573 ParameterFlag has_duplicate_parameters, | 2573 ParameterFlag has_duplicate_parameters, |
| 2574 IsFunctionFlag is_function, | 2574 IsFunctionFlag is_function, |
| 2575 IsParenthesizedFlag is_parenthesized, FunctionKind kind, | 2575 IsParenthesizedFlag is_parenthesized, FunctionKind kind, |
| 2576 int position) | 2576 int position) |
| 2577 : Expression(zone, position), | 2577 : Expression(zone, position), |
| 2578 raw_name_(name), | 2578 raw_name_(name), |
| 2579 scope_(scope), | 2579 scope_(scope), |
| 2580 body_(body), | 2580 body_(body), |
| 2581 raw_inferred_name_(ast_value_factory->empty_string()), | 2581 raw_inferred_name_(ast_value_factory->empty_string()), |
| 2582 ast_properties_(zone), |
| 2582 dont_optimize_reason_(kNoReason), | 2583 dont_optimize_reason_(kNoReason), |
| 2583 materialized_literal_count_(materialized_literal_count), | 2584 materialized_literal_count_(materialized_literal_count), |
| 2584 expected_property_count_(expected_property_count), | 2585 expected_property_count_(expected_property_count), |
| 2585 handler_count_(handler_count), | 2586 handler_count_(handler_count), |
| 2586 parameter_count_(parameter_count), | 2587 parameter_count_(parameter_count), |
| 2587 function_token_position_(RelocInfo::kNoPosition) { | 2588 function_token_position_(RelocInfo::kNoPosition) { |
| 2588 bitfield_ = IsExpression::encode(function_type != DECLARATION) | | 2589 bitfield_ = IsExpression::encode(function_type != DECLARATION) | |
| 2589 IsAnonymous::encode(function_type == ANONYMOUS_EXPRESSION) | | 2590 IsAnonymous::encode(function_type == ANONYMOUS_EXPRESSION) | |
| 2590 Pretenure::encode(false) | | 2591 Pretenure::encode(false) | |
| 2591 HasDuplicateParameters::encode(has_duplicate_parameters) | | 2592 HasDuplicateParameters::encode(has_duplicate_parameters) | |
| (...skipping 939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3531 | 3532 |
| 3532 private: | 3533 private: |
| 3533 Zone* zone_; | 3534 Zone* zone_; |
| 3534 AstValueFactory* ast_value_factory_; | 3535 AstValueFactory* ast_value_factory_; |
| 3535 }; | 3536 }; |
| 3536 | 3537 |
| 3537 | 3538 |
| 3538 } } // namespace v8::internal | 3539 } } // namespace v8::internal |
| 3539 | 3540 |
| 3540 #endif // V8_AST_H_ | 3541 #endif // V8_AST_H_ |
| OLD | NEW |