| 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-value-factory.h" | 8 #include "src/ast/ast-value-factory.h" |
| 9 #include "src/ast/modules.h" | 9 #include "src/ast/modules.h" |
| 10 #include "src/ast/variables.h" | 10 #include "src/ast/variables.h" |
| (...skipping 1647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1658 return var()->IsUnallocated() || var()->IsLookupSlot(); | 1658 return var()->IsUnallocated() || var()->IsLookupSlot(); |
| 1659 } | 1659 } |
| 1660 | 1660 |
| 1661 void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec, | 1661 void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec, |
| 1662 FeedbackVectorSlotCache* cache); | 1662 FeedbackVectorSlotCache* cache); |
| 1663 | 1663 |
| 1664 FeedbackVectorSlot VariableFeedbackSlot() { return variable_feedback_slot_; } | 1664 FeedbackVectorSlot VariableFeedbackSlot() { return variable_feedback_slot_; } |
| 1665 | 1665 |
| 1666 static int num_ids() { return parent_num_ids() + 1; } | 1666 static int num_ids() { return parent_num_ids() + 1; } |
| 1667 BailoutId BeforeId() const { return BailoutId(local_id(0)); } | 1667 BailoutId BeforeId() const { return BailoutId(local_id(0)); } |
| 1668 void set_next_unresolved(VariableProxy* next) { next_unresolved_ = next; } |
| 1669 VariableProxy* next_unresolved() { return next_unresolved_; } |
| 1668 | 1670 |
| 1669 protected: | 1671 protected: |
| 1670 VariableProxy(Zone* zone, Variable* var, int start_position, | 1672 VariableProxy(Zone* zone, Variable* var, int start_position, |
| 1671 int end_position); | 1673 int end_position); |
| 1672 | 1674 |
| 1673 VariableProxy(Zone* zone, const AstRawString* name, | 1675 VariableProxy(Zone* zone, const AstRawString* name, |
| 1674 Variable::Kind variable_kind, int start_position, | 1676 Variable::Kind variable_kind, int start_position, |
| 1675 int end_position); | 1677 int end_position); |
| 1676 static int parent_num_ids() { return Expression::num_ids(); } | 1678 static int parent_num_ids() { return Expression::num_ids(); } |
| 1677 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 1679 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
| 1678 | 1680 |
| 1679 class IsThisField : public BitField8<bool, 0, 1> {}; | 1681 class IsThisField : public BitField8<bool, 0, 1> {}; |
| 1680 class IsAssignedField : public BitField8<bool, 1, 1> {}; | 1682 class IsAssignedField : public BitField8<bool, 1, 1> {}; |
| 1681 class IsResolvedField : public BitField8<bool, 2, 1> {}; | 1683 class IsResolvedField : public BitField8<bool, 2, 1> {}; |
| 1682 class IsNewTargetField : public BitField8<bool, 3, 1> {}; | 1684 class IsNewTargetField : public BitField8<bool, 3, 1> {}; |
| 1683 | 1685 |
| 1684 // Start with 16-bit (or smaller) field, which should get packed together | 1686 // Start with 16-bit (or smaller) field, which should get packed together |
| 1685 // with Expression's trailing 16-bit field. | 1687 // with Expression's trailing 16-bit field. |
| 1686 uint8_t bit_field_; | 1688 uint8_t bit_field_; |
| 1687 // Position is stored in the AstNode superclass, but VariableProxy needs to | 1689 // Position is stored in the AstNode superclass, but VariableProxy needs to |
| 1688 // know its end position too (for error messages). It cannot be inferred from | 1690 // know its end position too (for error messages). It cannot be inferred from |
| 1689 // the variable name length because it can contain escapes. | 1691 // the variable name length because it can contain escapes. |
| 1690 int end_position_; | 1692 int end_position_; |
| 1691 FeedbackVectorSlot variable_feedback_slot_; | 1693 FeedbackVectorSlot variable_feedback_slot_; |
| 1692 union { | 1694 union { |
| 1693 const AstRawString* raw_name_; // if !is_resolved_ | 1695 const AstRawString* raw_name_; // if !is_resolved_ |
| 1694 Variable* var_; // if is_resolved_ | 1696 Variable* var_; // if is_resolved_ |
| 1695 }; | 1697 }; |
| 1698 VariableProxy* next_unresolved_; |
| 1696 }; | 1699 }; |
| 1697 | 1700 |
| 1698 | 1701 |
| 1699 // Left-hand side can only be a property, a global or a (parameter or local) | 1702 // Left-hand side can only be a property, a global or a (parameter or local) |
| 1700 // slot. | 1703 // slot. |
| 1701 enum LhsKind { | 1704 enum LhsKind { |
| 1702 VARIABLE, | 1705 VARIABLE, |
| 1703 NAMED_PROPERTY, | 1706 NAMED_PROPERTY, |
| 1704 KEYED_PROPERTY, | 1707 KEYED_PROPERTY, |
| 1705 NAMED_SUPER_PROPERTY, | 1708 NAMED_SUPER_PROPERTY, |
| (...skipping 1834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3540 : NULL; \ | 3543 : NULL; \ |
| 3541 } | 3544 } |
| 3542 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) | 3545 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) |
| 3543 #undef DECLARE_NODE_FUNCTIONS | 3546 #undef DECLARE_NODE_FUNCTIONS |
| 3544 | 3547 |
| 3545 | 3548 |
| 3546 } // namespace internal | 3549 } // namespace internal |
| 3547 } // namespace v8 | 3550 } // namespace v8 |
| 3548 | 3551 |
| 3549 #endif // V8_AST_AST_H_ | 3552 #endif // V8_AST_AST_H_ |
| OLD | NEW |