| 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/globals.h" | 9 #include "src/globals.h" |
| 10 #include "src/zone.h" | 10 #include "src/zone.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 VariableLocation location() const { | 95 VariableLocation location() const { |
| 96 return LocationField::decode(bit_field_); | 96 return LocationField::decode(bit_field_); |
| 97 } | 97 } |
| 98 VariableKind kind() const { return VariableKindField::decode(bit_field_); } | 98 VariableKind kind() const { return VariableKindField::decode(bit_field_); } |
| 99 InitializationFlag initialization_flag() const { | 99 InitializationFlag initialization_flag() const { |
| 100 return InitializationFlagField::decode(bit_field_); | 100 return InitializationFlagField::decode(bit_field_); |
| 101 } | 101 } |
| 102 | 102 |
| 103 int index() const { return index_; } | 103 int index() const { return index_; } |
| 104 | 104 |
| 105 bool IsExport() const { |
| 106 DCHECK(location() == VariableLocation::MODULE); |
| 107 return index() == 0; |
| 108 } |
| 109 |
| 105 void AllocateTo(VariableLocation location, int index) { | 110 void AllocateTo(VariableLocation location, int index) { |
| 106 DCHECK(IsUnallocated() || | 111 DCHECK(IsUnallocated() || |
| 107 (this->location() == location && this->index() == index)); | 112 (this->location() == location && this->index() == index)); |
| 108 bit_field_ = LocationField::update(bit_field_, location); | 113 bit_field_ = LocationField::update(bit_field_, location); |
| 109 DCHECK_EQ(location, this->location()); | 114 DCHECK_EQ(location, this->location()); |
| 110 index_ = index; | 115 index_ = index; |
| 111 } | 116 } |
| 112 | 117 |
| 113 static InitializationFlag DefaultInitializationFlag(VariableMode mode) { | 118 static InitializationFlag DefaultInitializationFlag(VariableMode mode) { |
| 114 DCHECK(IsDeclaredVariableMode(mode)); | 119 DCHECK(IsDeclaredVariableMode(mode)); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 140 class InitializationFlagField | 145 class InitializationFlagField |
| 141 : public BitField16<InitializationFlag, IsUsedField::kNext, 2> {}; | 146 : public BitField16<InitializationFlag, IsUsedField::kNext, 2> {}; |
| 142 class MaybeAssignedFlagField | 147 class MaybeAssignedFlagField |
| 143 : public BitField16<MaybeAssignedFlag, InitializationFlagField::kNext, | 148 : public BitField16<MaybeAssignedFlag, InitializationFlagField::kNext, |
| 144 2> {}; | 149 2> {}; |
| 145 }; | 150 }; |
| 146 } // namespace internal | 151 } // namespace internal |
| 147 } // namespace v8 | 152 } // namespace v8 |
| 148 | 153 |
| 149 #endif // V8_AST_VARIABLES_H_ | 154 #endif // V8_AST_VARIABLES_H_ |
| OLD | NEW |