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 939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
950 | 950 |
951 FeedbackVectorSlot ForInFeedbackSlot() { | 951 FeedbackVectorSlot ForInFeedbackSlot() { |
952 DCHECK(!for_in_feedback_slot_.IsInvalid()); | 952 DCHECK(!for_in_feedback_slot_.IsInvalid()); |
953 return for_in_feedback_slot_; | 953 return for_in_feedback_slot_; |
954 } | 954 } |
955 | 955 |
956 enum ForInType { FAST_FOR_IN, SLOW_FOR_IN }; | 956 enum ForInType { FAST_FOR_IN, SLOW_FOR_IN }; |
957 ForInType for_in_type() const { return for_in_type_; } | 957 ForInType for_in_type() const { return for_in_type_; } |
958 void set_for_in_type(ForInType type) { for_in_type_ = type; } | 958 void set_for_in_type(ForInType type) { for_in_type_ = type; } |
959 | 959 |
960 static int num_ids() { return parent_num_ids() + 2; } | 960 static int num_ids() { return parent_num_ids() + 4; } |
961 BailoutId BodyId() const { return BailoutId(local_id(0)); } | 961 BailoutId BodyId() const { return BailoutId(local_id(0)); } |
962 BailoutId PrepareId() const { return BailoutId(local_id(1)); } | 962 BailoutId PrepareId() const { return BailoutId(local_id(1)); } |
| 963 BailoutId EnumId() const { return BailoutId(local_id(2)); } |
| 964 BailoutId ToObjectId() const { return BailoutId(local_id(3)); } |
963 virtual BailoutId ContinueId() const OVERRIDE { return EntryId(); } | 965 virtual BailoutId ContinueId() const OVERRIDE { return EntryId(); } |
964 virtual BailoutId StackCheckId() const OVERRIDE { return BodyId(); } | 966 virtual BailoutId StackCheckId() const OVERRIDE { return BodyId(); } |
965 | 967 |
966 protected: | 968 protected: |
967 ForInStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos) | 969 ForInStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos) |
968 : ForEachStatement(zone, labels, pos), | 970 : ForEachStatement(zone, labels, pos), |
969 for_in_type_(SLOW_FOR_IN), | 971 for_in_type_(SLOW_FOR_IN), |
970 for_in_feedback_slot_(FeedbackVectorSlot::Invalid()) {} | 972 for_in_feedback_slot_(FeedbackVectorSlot::Invalid()) {} |
971 static int parent_num_ids() { return ForEachStatement::num_ids(); } | 973 static int parent_num_ids() { return ForEachStatement::num_ids(); } |
972 | 974 |
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1561 return flags; | 1563 return flags; |
1562 } | 1564 } |
1563 | 1565 |
1564 enum Flags { | 1566 enum Flags { |
1565 kNoFlags = 0, | 1567 kNoFlags = 0, |
1566 kFastElements = 1, | 1568 kFastElements = 1, |
1567 kHasFunction = 1 << 1 | 1569 kHasFunction = 1 << 1 |
1568 }; | 1570 }; |
1569 | 1571 |
1570 struct Accessors: public ZoneObject { | 1572 struct Accessors: public ZoneObject { |
1571 Accessors() : getter(NULL), setter(NULL) { } | 1573 Accessors() : getter(NULL), setter(NULL) {} |
1572 Expression* getter; | 1574 Expression* getter; |
1573 Expression* setter; | 1575 Expression* setter; |
1574 }; | 1576 }; |
1575 | 1577 |
| 1578 BailoutId CreateLiteralId() const { return BailoutId(local_id(0)); } |
| 1579 |
| 1580 static int num_ids() { return parent_num_ids() + 1; } |
| 1581 |
1576 protected: | 1582 protected: |
1577 ObjectLiteral(Zone* zone, ZoneList<Property*>* properties, int literal_index, | 1583 ObjectLiteral(Zone* zone, ZoneList<Property*>* properties, int literal_index, |
1578 int boilerplate_properties, bool has_function, int pos) | 1584 int boilerplate_properties, bool has_function, int pos) |
1579 : MaterializedLiteral(zone, literal_index, pos), | 1585 : MaterializedLiteral(zone, literal_index, pos), |
1580 properties_(properties), | 1586 properties_(properties), |
1581 boilerplate_properties_(boilerplate_properties), | 1587 boilerplate_properties_(boilerplate_properties), |
1582 fast_elements_(false), | 1588 fast_elements_(false), |
1583 may_store_doubles_(false), | 1589 may_store_doubles_(false), |
1584 has_function_(has_function) {} | 1590 has_function_(has_function) {} |
| 1591 static int parent_num_ids() { return MaterializedLiteral::num_ids(); } |
1585 | 1592 |
1586 private: | 1593 private: |
| 1594 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
1587 Handle<FixedArray> constant_properties_; | 1595 Handle<FixedArray> constant_properties_; |
1588 ZoneList<Property*>* properties_; | 1596 ZoneList<Property*>* properties_; |
1589 int boilerplate_properties_; | 1597 int boilerplate_properties_; |
1590 bool fast_elements_; | 1598 bool fast_elements_; |
1591 bool may_store_doubles_; | 1599 bool may_store_doubles_; |
1592 bool has_function_; | 1600 bool has_function_; |
1593 }; | 1601 }; |
1594 | 1602 |
1595 | 1603 |
1596 // Node for capturing a regexp literal. | 1604 // Node for capturing a regexp literal. |
(...skipping 2044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3641 private: | 3649 private: |
3642 Zone* zone_; | 3650 Zone* zone_; |
3643 Visitor visitor_; | 3651 Visitor visitor_; |
3644 AstValueFactory* ast_value_factory_; | 3652 AstValueFactory* ast_value_factory_; |
3645 }; | 3653 }; |
3646 | 3654 |
3647 | 3655 |
3648 } } // namespace v8::internal | 3656 } } // namespace v8::internal |
3649 | 3657 |
3650 #endif // V8_AST_H_ | 3658 #endif // V8_AST_H_ |
OLD | NEW |