OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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_VARIABLES_H_ | 5 #ifndef V8_AST_VARIABLES_H_ |
6 #define V8_AST_VARIABLES_H_ | 6 #define V8_AST_VARIABLES_H_ |
7 | 7 |
8 #include "src/ast/ast-value-factory.h" | 8 #include "src/ast/ast-value-factory.h" |
9 #include "src/zone.h" | 9 #include "src/zone.h" |
10 | 10 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 int initializer_position() { return initializer_position_; } | 64 int initializer_position() { return initializer_position_; } |
65 void set_initializer_position(int pos) { initializer_position_ = pos; } | 65 void set_initializer_position(int pos) { initializer_position_ = pos; } |
66 | 66 |
67 bool IsUnallocated() const { | 67 bool IsUnallocated() const { |
68 return location() == VariableLocation::UNALLOCATED; | 68 return location() == VariableLocation::UNALLOCATED; |
69 } | 69 } |
70 bool IsParameter() const { return location() == VariableLocation::PARAMETER; } | 70 bool IsParameter() const { return location() == VariableLocation::PARAMETER; } |
71 bool IsStackLocal() const { return location() == VariableLocation::LOCAL; } | 71 bool IsStackLocal() const { return location() == VariableLocation::LOCAL; } |
72 bool IsStackAllocated() const { return IsParameter() || IsStackLocal(); } | 72 bool IsStackAllocated() const { return IsParameter() || IsStackLocal(); } |
73 bool IsContextSlot() const { return location() == VariableLocation::CONTEXT; } | 73 bool IsContextSlot() const { return location() == VariableLocation::CONTEXT; } |
74 bool IsGlobalSlot() const { return location() == VariableLocation::GLOBAL; } | |
75 bool IsUnallocatedOrGlobalSlot() const { | |
76 return IsUnallocated() || IsGlobalSlot(); | |
77 } | |
78 bool IsLookupSlot() const { return location() == VariableLocation::LOOKUP; } | 74 bool IsLookupSlot() const { return location() == VariableLocation::LOOKUP; } |
79 bool IsGlobalObjectProperty() const; | 75 bool IsGlobalObjectProperty() const; |
80 bool IsStaticGlobalObjectProperty() const; | 76 bool IsStaticGlobalObjectProperty() const; |
81 | 77 |
82 bool is_dynamic() const { return IsDynamicVariableMode(mode()); } | 78 bool is_dynamic() const { return IsDynamicVariableMode(mode()); } |
83 bool is_const_mode() const { return IsImmutableVariableMode(mode()); } | 79 bool is_const_mode() const { return IsImmutableVariableMode(mode()); } |
84 bool binding_needs_init() const { | 80 bool binding_needs_init() const { |
85 DCHECK(initialization_flag() != kNeedsInitialization || | 81 DCHECK(initialization_flag() != kNeedsInitialization || |
86 IsLexicalVariableMode(mode())); | 82 IsLexicalVariableMode(mode())); |
87 return initialization_flag() == kNeedsInitialization; | 83 return initialization_flag() == kNeedsInitialization; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 class InitializationFlagField | 138 class InitializationFlagField |
143 : public BitField16<InitializationFlag, IsUsedField::kNext, 2> {}; | 139 : public BitField16<InitializationFlag, IsUsedField::kNext, 2> {}; |
144 class MaybeAssignedFlagField | 140 class MaybeAssignedFlagField |
145 : public BitField16<MaybeAssignedFlag, InitializationFlagField::kNext, | 141 : public BitField16<MaybeAssignedFlag, InitializationFlagField::kNext, |
146 2> {}; | 142 2> {}; |
147 }; | 143 }; |
148 } // namespace internal | 144 } // namespace internal |
149 } // namespace v8 | 145 } // namespace v8 |
150 | 146 |
151 #endif // V8_AST_VARIABLES_H_ | 147 #endif // V8_AST_VARIABLES_H_ |
OLD | NEW |