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

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

Issue 2301183003: Move sloppy block function hoisting logic from Parser to Scope. (Closed)
Patch Set: Created 4 years, 3 months 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
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/zone.h" 9 #include "src/zone.h"
10 10
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 int index() const { return index_; } 114 int index() const { return index_; }
115 115
116 void AllocateTo(VariableLocation location, int index) { 116 void AllocateTo(VariableLocation location, int index) {
117 DCHECK(IsUnallocated() || 117 DCHECK(IsUnallocated() ||
118 (this->location() == location && this->index() == index)); 118 (this->location() == location && this->index() == index));
119 bit_field_ = LocationField::update(bit_field_, location); 119 bit_field_ = LocationField::update(bit_field_, location);
120 DCHECK_EQ(location, this->location()); 120 DCHECK_EQ(location, this->location());
121 index_ = index; 121 index_ = index;
122 } 122 }
123 123
124 static InitializationFlag DefaultInitializationFlag(VariableMode mode) {
125 DCHECK(IsDeclaredVariableMode(mode));
126 return mode == VAR ? kCreatedInitialized : kNeedsInitialization;
127 }
128
124 private: 129 private:
125 Scope* scope_; 130 Scope* scope_;
126 const AstRawString* name_; 131 const AstRawString* name_;
127 132
128 // If this field is set, this variable references the stored locally bound 133 // If this field is set, this variable references the stored locally bound
129 // variable, but it might be shadowed by variable bindings introduced by 134 // variable, but it might be shadowed by variable bindings introduced by
130 // sloppy 'eval' calls between the reference scope (inclusive) and the 135 // sloppy 'eval' calls between the reference scope (inclusive) and the
131 // binding scope (exclusive). 136 // binding scope (exclusive).
132 Variable* local_if_not_shadowed_; 137 Variable* local_if_not_shadowed_;
133 int index_; 138 int index_;
(...skipping 11 matching lines...) Expand all
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_
OLDNEW
« src/ast/scopes.cc ('K') | « src/ast/scopes.cc ('k') | src/parsing/parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698