| 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 { | 1674 HoleCheckMode hole_check_mode() const { |
| 1675 return NeedsHoleCheckField::decode(bit_field_); | 1675 return HoleCheckModeField::decode(bit_field_); |
| 1676 } | 1676 } |
| 1677 void set_needs_hole_check() { | 1677 void set_needs_hole_check() { |
| 1678 bit_field_ = NeedsHoleCheckField::update(bit_field_, true); | 1678 bit_field_ = |
| 1679 HoleCheckModeField::update(bit_field_, HoleCheckMode::kRequired); |
| 1679 } | 1680 } |
| 1680 | 1681 |
| 1681 int end_position() const { return end_position_; } | 1682 int end_position() const { return end_position_; } |
| 1682 | 1683 |
| 1683 // Bind this proxy to the variable var. | 1684 // Bind this proxy to the variable var. |
| 1684 void BindTo(Variable* var); | 1685 void BindTo(Variable* var); |
| 1685 | 1686 |
| 1686 bool UsesVariableFeedbackSlot() const { | 1687 bool UsesVariableFeedbackSlot() const { |
| 1687 return var()->IsUnallocated() || var()->IsLookupSlot(); | 1688 return var()->IsUnallocated() || var()->IsLookupSlot(); |
| 1688 } | 1689 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1706 explicit VariableProxy(const VariableProxy* copy_from); | 1707 explicit VariableProxy(const VariableProxy* copy_from); |
| 1707 | 1708 |
| 1708 static int parent_num_ids() { return Expression::num_ids(); } | 1709 static int parent_num_ids() { return Expression::num_ids(); } |
| 1709 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 1710 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
| 1710 | 1711 |
| 1711 class IsThisField : public BitField<bool, Expression::kNextBitFieldIndex, 1> { | 1712 class IsThisField : public BitField<bool, Expression::kNextBitFieldIndex, 1> { |
| 1712 }; | 1713 }; |
| 1713 class IsAssignedField : public BitField<bool, IsThisField::kNext, 1> {}; | 1714 class IsAssignedField : public BitField<bool, IsThisField::kNext, 1> {}; |
| 1714 class IsResolvedField : public BitField<bool, IsAssignedField::kNext, 1> {}; | 1715 class IsResolvedField : public BitField<bool, IsAssignedField::kNext, 1> {}; |
| 1715 class IsNewTargetField : public BitField<bool, IsResolvedField::kNext, 1> {}; | 1716 class IsNewTargetField : public BitField<bool, IsResolvedField::kNext, 1> {}; |
| 1716 class NeedsHoleCheckField | 1717 class HoleCheckModeField |
| 1717 : public BitField<bool, IsNewTargetField::kNext, 1> {}; | 1718 : public BitField<HoleCheckMode, IsNewTargetField::kNext, 1> {}; |
| 1718 | 1719 |
| 1719 // Position is stored in the AstNode superclass, but VariableProxy needs to | 1720 // Position is stored in the AstNode superclass, but VariableProxy needs to |
| 1720 // know its end position too (for error messages). It cannot be inferred from | 1721 // know its end position too (for error messages). It cannot be inferred from |
| 1721 // the variable name length because it can contain escapes. | 1722 // the variable name length because it can contain escapes. |
| 1722 int end_position_; | 1723 int end_position_; |
| 1723 FeedbackVectorSlot variable_feedback_slot_; | 1724 FeedbackVectorSlot variable_feedback_slot_; |
| 1724 union { | 1725 union { |
| 1725 const AstRawString* raw_name_; // if !is_resolved_ | 1726 const AstRawString* raw_name_; // if !is_resolved_ |
| 1726 Variable* var_; // if is_resolved_ | 1727 Variable* var_; // if is_resolved_ |
| 1727 }; | 1728 }; |
| (...skipping 1874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3602 : NULL; \ | 3603 : NULL; \ |
| 3603 } | 3604 } |
| 3604 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) | 3605 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) |
| 3605 #undef DECLARE_NODE_FUNCTIONS | 3606 #undef DECLARE_NODE_FUNCTIONS |
| 3606 | 3607 |
| 3607 | 3608 |
| 3608 } // namespace internal | 3609 } // namespace internal |
| 3609 } // namespace v8 | 3610 } // namespace v8 |
| 3610 | 3611 |
| 3611 #endif // V8_AST_AST_H_ | 3612 #endif // V8_AST_AST_H_ |
| OLD | NEW |