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 1653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1664 bool is_resolved() const { return IsResolvedField::decode(bit_field_); } | 1664 bool is_resolved() const { return IsResolvedField::decode(bit_field_); } |
1665 void set_is_resolved() { | 1665 void set_is_resolved() { |
1666 bit_field_ = IsResolvedField::update(bit_field_, true); | 1666 bit_field_ = IsResolvedField::update(bit_field_, true); |
1667 } | 1667 } |
1668 | 1668 |
1669 bool is_new_target() const { return IsNewTargetField::decode(bit_field_); } | 1669 bool is_new_target() const { return IsNewTargetField::decode(bit_field_); } |
1670 void set_is_new_target() { | 1670 void set_is_new_target() { |
1671 bit_field_ = IsNewTargetField::update(bit_field_, true); | 1671 bit_field_ = IsNewTargetField::update(bit_field_, true); |
1672 } | 1672 } |
1673 | 1673 |
| 1674 bool needs_hole_check() const { |
| 1675 return NeedsHoleCheckField::decode(bit_field_); |
| 1676 } |
| 1677 void set_needs_hole_check() { |
| 1678 bit_field_ = NeedsHoleCheckField::update(bit_field_, true); |
| 1679 } |
| 1680 |
1674 int end_position() const { return end_position_; } | 1681 int end_position() const { return end_position_; } |
1675 | 1682 |
1676 // Bind this proxy to the variable var. | 1683 // Bind this proxy to the variable var. |
1677 void BindTo(Variable* var); | 1684 void BindTo(Variable* var); |
1678 | 1685 |
1679 bool UsesVariableFeedbackSlot() const { | 1686 bool UsesVariableFeedbackSlot() const { |
1680 return var()->IsUnallocated() || var()->IsLookupSlot(); | 1687 return var()->IsUnallocated() || var()->IsLookupSlot(); |
1681 } | 1688 } |
1682 | 1689 |
1683 void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec, | 1690 void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec, |
(...skipping 15 matching lines...) Expand all Loading... |
1699 explicit VariableProxy(const VariableProxy* copy_from); | 1706 explicit VariableProxy(const VariableProxy* copy_from); |
1700 | 1707 |
1701 static int parent_num_ids() { return Expression::num_ids(); } | 1708 static int parent_num_ids() { return Expression::num_ids(); } |
1702 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 1709 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
1703 | 1710 |
1704 class IsThisField : public BitField<bool, Expression::kNextBitFieldIndex, 1> { | 1711 class IsThisField : public BitField<bool, Expression::kNextBitFieldIndex, 1> { |
1705 }; | 1712 }; |
1706 class IsAssignedField : public BitField<bool, IsThisField::kNext, 1> {}; | 1713 class IsAssignedField : public BitField<bool, IsThisField::kNext, 1> {}; |
1707 class IsResolvedField : public BitField<bool, IsAssignedField::kNext, 1> {}; | 1714 class IsResolvedField : public BitField<bool, IsAssignedField::kNext, 1> {}; |
1708 class IsNewTargetField : public BitField<bool, IsResolvedField::kNext, 1> {}; | 1715 class IsNewTargetField : public BitField<bool, IsResolvedField::kNext, 1> {}; |
| 1716 class NeedsHoleCheckField |
| 1717 : public BitField<bool, IsNewTargetField::kNext, 1> {}; |
1709 | 1718 |
1710 // Position is stored in the AstNode superclass, but VariableProxy needs to | 1719 // Position is stored in the AstNode superclass, but VariableProxy needs to |
1711 // know its end position too (for error messages). It cannot be inferred from | 1720 // know its end position too (for error messages). It cannot be inferred from |
1712 // the variable name length because it can contain escapes. | 1721 // the variable name length because it can contain escapes. |
1713 int end_position_; | 1722 int end_position_; |
1714 FeedbackVectorSlot variable_feedback_slot_; | 1723 FeedbackVectorSlot variable_feedback_slot_; |
1715 union { | 1724 union { |
1716 const AstRawString* raw_name_; // if !is_resolved_ | 1725 const AstRawString* raw_name_; // if !is_resolved_ |
1717 Variable* var_; // if is_resolved_ | 1726 Variable* var_; // if is_resolved_ |
1718 }; | 1727 }; |
(...skipping 1876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3595 : NULL; \ | 3604 : NULL; \ |
3596 } | 3605 } |
3597 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) | 3606 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) |
3598 #undef DECLARE_NODE_FUNCTIONS | 3607 #undef DECLARE_NODE_FUNCTIONS |
3599 | 3608 |
3600 | 3609 |
3601 } // namespace internal | 3610 } // namespace internal |
3602 } // namespace v8 | 3611 } // namespace v8 |
3603 | 3612 |
3604 #endif // V8_AST_AST_H_ | 3613 #endif // V8_AST_AST_H_ |
OLD | NEW |