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() || |
| 53 location() == VariableLocation::MODULE); |
52 bit_field_ = ForceContextAllocationField::update(bit_field_, true); | 54 bit_field_ = ForceContextAllocationField::update(bit_field_, true); |
53 } | 55 } |
54 bool is_used() { return IsUsedField::decode(bit_field_); } | 56 bool is_used() { return IsUsedField::decode(bit_field_); } |
55 void set_is_used() { bit_field_ = IsUsedField::update(bit_field_, true); } | 57 void set_is_used() { bit_field_ = IsUsedField::update(bit_field_, true); } |
56 MaybeAssignedFlag maybe_assigned() const { | 58 MaybeAssignedFlag maybe_assigned() const { |
57 return MaybeAssignedFlagField::decode(bit_field_); | 59 return MaybeAssignedFlagField::decode(bit_field_); |
58 } | 60 } |
59 void set_maybe_assigned() { | 61 void set_maybe_assigned() { |
60 bit_field_ = MaybeAssignedFlagField::update(bit_field_, kMaybeAssigned); | 62 bit_field_ = MaybeAssignedFlagField::update(bit_field_, kMaybeAssigned); |
61 } | 63 } |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 class InitializationFlagField | 145 class InitializationFlagField |
144 : public BitField16<InitializationFlag, IsUsedField::kNext, 2> {}; | 146 : public BitField16<InitializationFlag, IsUsedField::kNext, 2> {}; |
145 class MaybeAssignedFlagField | 147 class MaybeAssignedFlagField |
146 : public BitField16<MaybeAssignedFlag, InitializationFlagField::kNext, | 148 : public BitField16<MaybeAssignedFlag, InitializationFlagField::kNext, |
147 2> {}; | 149 2> {}; |
148 }; | 150 }; |
149 } // namespace internal | 151 } // namespace internal |
150 } // namespace v8 | 152 } // namespace v8 |
151 | 153 |
152 #endif // V8_AST_VARIABLES_H_ | 154 #endif // V8_AST_VARIABLES_H_ |
OLD | NEW |