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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 // parameter initializers. | 42 // parameter initializers. |
43 void set_scope(Scope* scope) { scope_ = scope; } | 43 void set_scope(Scope* scope) { scope_ = scope; } |
44 | 44 |
45 Handle<String> name() const { return name_->string(); } | 45 Handle<String> name() const { return name_->string(); } |
46 const AstRawString* raw_name() const { return name_; } | 46 const AstRawString* raw_name() const { return name_; } |
47 VariableMode mode() const { return VariableModeField::decode(bit_field_); } | 47 VariableMode mode() const { return VariableModeField::decode(bit_field_); } |
48 bool has_forced_context_allocation() const { | 48 bool has_forced_context_allocation() const { |
49 return ForceContextAllocationField::decode(bit_field_); | 49 return ForceContextAllocationField::decode(bit_field_); |
50 } | 50 } |
51 void ForceContextAllocation() { | 51 void ForceContextAllocation() { |
52 DCHECK(IsUnallocated() || IsContextSlot()); | 52 DCHECK(IsUnallocated() || IsContextSlot() || |
| 53 location() == VariableLocation::MODULE); |
53 bit_field_ = ForceContextAllocationField::update(bit_field_, true); | 54 bit_field_ = ForceContextAllocationField::update(bit_field_, true); |
54 } | 55 } |
55 bool is_used() { return IsUsedField::decode(bit_field_); } | 56 bool is_used() { return IsUsedField::decode(bit_field_); } |
56 void set_is_used() { bit_field_ = IsUsedField::update(bit_field_, true); } | 57 void set_is_used() { bit_field_ = IsUsedField::update(bit_field_, true); } |
57 MaybeAssignedFlag maybe_assigned() const { | 58 MaybeAssignedFlag maybe_assigned() const { |
58 return MaybeAssignedFlagField::decode(bit_field_); | 59 return MaybeAssignedFlagField::decode(bit_field_); |
59 } | 60 } |
60 void set_maybe_assigned() { | 61 void set_maybe_assigned() { |
61 bit_field_ = MaybeAssignedFlagField::update(bit_field_, kMaybeAssigned); | 62 bit_field_ = MaybeAssignedFlagField::update(bit_field_, kMaybeAssigned); |
62 } | 63 } |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 class InitializationFlagField | 139 class InitializationFlagField |
139 : public BitField16<InitializationFlag, IsUsedField::kNext, 2> {}; | 140 : public BitField16<InitializationFlag, IsUsedField::kNext, 2> {}; |
140 class MaybeAssignedFlagField | 141 class MaybeAssignedFlagField |
141 : public BitField16<MaybeAssignedFlag, InitializationFlagField::kNext, | 142 : public BitField16<MaybeAssignedFlag, InitializationFlagField::kNext, |
142 2> {}; | 143 2> {}; |
143 }; | 144 }; |
144 } // namespace internal | 145 } // namespace internal |
145 } // namespace v8 | 146 } // namespace v8 |
146 | 147 |
147 #endif // V8_AST_VARIABLES_H_ | 148 #endif // V8_AST_VARIABLES_H_ |
OLD | NEW |