| 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 VariableLocation location() const { | 106 VariableLocation location() const { |
| 107 return LocationField::decode(bit_field_); | 107 return LocationField::decode(bit_field_); |
| 108 } | 108 } |
| 109 Kind kind() const { return KindField::decode(bit_field_); } | 109 Kind kind() const { return KindField::decode(bit_field_); } |
| 110 InitializationFlag initialization_flag() const { | 110 InitializationFlag initialization_flag() const { |
| 111 return InitializationFlagField::decode(bit_field_); | 111 return InitializationFlagField::decode(bit_field_); |
| 112 } | 112 } |
| 113 | 113 |
| 114 int index() const { return index_; } | 114 int index() const { return index_; } |
| 115 | 115 |
| 116 bool IsExport() const { |
| 117 DCHECK(location() == VariableLocation::MODULE); |
| 118 return index() == 0; |
| 119 } |
| 120 |
| 116 void AllocateTo(VariableLocation location, int index) { | 121 void AllocateTo(VariableLocation location, int index) { |
| 117 DCHECK(IsUnallocated() || | 122 DCHECK(IsUnallocated() || |
| 118 (this->location() == location && this->index() == index)); | 123 (this->location() == location && this->index() == index)); |
| 119 bit_field_ = LocationField::update(bit_field_, location); | 124 bit_field_ = LocationField::update(bit_field_, location); |
| 120 DCHECK_EQ(location, this->location()); | 125 DCHECK_EQ(location, this->location()); |
| 121 index_ = index; | 126 index_ = index; |
| 122 } | 127 } |
| 123 | 128 |
| 124 private: | 129 private: |
| 125 Scope* scope_; | 130 Scope* scope_; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 145 class InitializationFlagField | 150 class InitializationFlagField |
| 146 : public BitField16<InitializationFlag, IsUsedField::kNext, 2> {}; | 151 : public BitField16<InitializationFlag, IsUsedField::kNext, 2> {}; |
| 147 class MaybeAssignedFlagField | 152 class MaybeAssignedFlagField |
| 148 : public BitField16<MaybeAssignedFlag, InitializationFlagField::kNext, | 153 : public BitField16<MaybeAssignedFlag, InitializationFlagField::kNext, |
| 149 2> {}; | 154 2> {}; |
| 150 }; | 155 }; |
| 151 } // namespace internal | 156 } // namespace internal |
| 152 } // namespace v8 | 157 } // namespace v8 |
| 153 | 158 |
| 154 #endif // V8_AST_VARIABLES_H_ | 159 #endif // V8_AST_VARIABLES_H_ |
| OLD | NEW |