Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(416)

Side by Side Diff: src/ast/variables.h

Issue 2475433002: Turn Scope::locals_ into a ThreadedList (Closed)
Patch Set: Addressed comments Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/ast/scopes.cc ('k') | src/ast/variables.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/zone.h" 10 #include "src/zone/zone.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 bit_field_ = LocationField::update(bit_field_, location); 116 bit_field_ = LocationField::update(bit_field_, location);
117 DCHECK_EQ(location, this->location()); 117 DCHECK_EQ(location, this->location());
118 index_ = index; 118 index_ = index;
119 } 119 }
120 120
121 static InitializationFlag DefaultInitializationFlag(VariableMode mode) { 121 static InitializationFlag DefaultInitializationFlag(VariableMode mode) {
122 DCHECK(IsDeclaredVariableMode(mode)); 122 DCHECK(IsDeclaredVariableMode(mode));
123 return mode == VAR ? kCreatedInitialized : kNeedsInitialization; 123 return mode == VAR ? kCreatedInitialized : kNeedsInitialization;
124 } 124 }
125 125
126 typedef ThreadedList<Variable> List;
127
126 private: 128 private:
127 Scope* scope_; 129 Scope* scope_;
128 const AstRawString* name_; 130 const AstRawString* name_;
129 131
130 // If this field is set, this variable references the stored locally bound 132 // If this field is set, this variable references the stored locally bound
131 // variable, but it might be shadowed by variable bindings introduced by 133 // variable, but it might be shadowed by variable bindings introduced by
132 // sloppy 'eval' calls between the reference scope (inclusive) and the 134 // sloppy 'eval' calls between the reference scope (inclusive) and the
133 // binding scope (exclusive). 135 // binding scope (exclusive).
134 Variable* local_if_not_shadowed_; 136 Variable* local_if_not_shadowed_;
137 Variable* next_;
135 int index_; 138 int index_;
136 int initializer_position_; 139 int initializer_position_;
137 uint16_t bit_field_; 140 uint16_t bit_field_;
138 141
139 class VariableModeField : public BitField16<VariableMode, 0, 3> {}; 142 class VariableModeField : public BitField16<VariableMode, 0, 3> {};
140 class VariableKindField 143 class VariableKindField
141 : public BitField16<VariableKind, VariableModeField::kNext, 3> {}; 144 : public BitField16<VariableKind, VariableModeField::kNext, 3> {};
142 class LocationField 145 class LocationField
143 : public BitField16<VariableLocation, VariableKindField::kNext, 3> {}; 146 : public BitField16<VariableLocation, VariableKindField::kNext, 3> {};
144 class ForceContextAllocationField 147 class ForceContextAllocationField
145 : public BitField16<bool, LocationField::kNext, 1> {}; 148 : public BitField16<bool, LocationField::kNext, 1> {};
146 class IsUsedField 149 class IsUsedField
147 : public BitField16<bool, ForceContextAllocationField::kNext, 1> {}; 150 : public BitField16<bool, ForceContextAllocationField::kNext, 1> {};
148 class InitializationFlagField 151 class InitializationFlagField
149 : public BitField16<InitializationFlag, IsUsedField::kNext, 2> {}; 152 : public BitField16<InitializationFlag, IsUsedField::kNext, 2> {};
150 class MaybeAssignedFlagField 153 class MaybeAssignedFlagField
151 : public BitField16<MaybeAssignedFlag, InitializationFlagField::kNext, 154 : public BitField16<MaybeAssignedFlag, InitializationFlagField::kNext,
152 2> {}; 155 2> {};
156 Variable** next() { return &next_; }
157 friend List;
158 // To reset next to nullptr upon resetting after preparsing.
159 // TODO(verwaest): Remove once we properly preparse parameters.
160 friend class DeclarationScope;
153 }; 161 };
154 } // namespace internal 162 } // namespace internal
155 } // namespace v8 163 } // namespace v8
156 164
157 #endif // V8_AST_VARIABLES_H_ 165 #endif // V8_AST_VARIABLES_H_
OLDNEW
« no previous file with comments | « src/ast/scopes.cc ('k') | src/ast/variables.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698