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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 InitializationFlag initialization_flag() const { | 95 InitializationFlag initialization_flag() const { |
96 return initialization_flag_; | 96 return initialization_flag_; |
97 } | 97 } |
98 | 98 |
99 void AllocateTo(VariableLocation location, int index) { | 99 void AllocateTo(VariableLocation location, int index) { |
100 DCHECK(IsUnallocated() || (location_ == location && index_ == index)); | 100 DCHECK(IsUnallocated() || (location_ == location && index_ == index)); |
101 location_ = location; | 101 location_ = location; |
102 index_ = index; | 102 index_ = index; |
103 } | 103 } |
104 | 104 |
105 static int CompareIndex(Variable* const* v, Variable* const* w); | |
106 | |
107 private: | 105 private: |
108 Scope* scope_; | 106 Scope* scope_; |
109 const AstRawString* name_; | 107 const AstRawString* name_; |
110 VariableMode mode_; | 108 VariableMode mode_; |
111 Kind kind_; | 109 Kind kind_; |
112 VariableLocation location_; | 110 VariableLocation location_; |
113 int index_; | 111 int index_; |
114 int initializer_position_; | 112 int initializer_position_; |
115 | 113 |
116 // If this field is set, this variable references the stored locally bound | 114 // If this field is set, this variable references the stored locally bound |
117 // variable, but it might be shadowed by variable bindings introduced by | 115 // variable, but it might be shadowed by variable bindings introduced by |
118 // sloppy 'eval' calls between the reference scope (inclusive) and the | 116 // sloppy 'eval' calls between the reference scope (inclusive) and the |
119 // binding scope (exclusive). | 117 // binding scope (exclusive). |
120 Variable* local_if_not_shadowed_; | 118 Variable* local_if_not_shadowed_; |
121 | 119 |
122 // Usage info. | 120 // Usage info. |
123 bool force_context_allocation_; // set by variable resolver | 121 bool force_context_allocation_; // set by variable resolver |
124 bool is_used_; | 122 bool is_used_; |
125 InitializationFlag initialization_flag_; | 123 InitializationFlag initialization_flag_; |
126 MaybeAssignedFlag maybe_assigned_; | 124 MaybeAssignedFlag maybe_assigned_; |
127 }; | 125 }; |
128 } // namespace internal | 126 } // namespace internal |
129 } // namespace v8 | 127 } // namespace v8 |
130 | 128 |
131 #endif // V8_AST_VARIABLES_H_ | 129 #endif // V8_AST_VARIABLES_H_ |
OLD | NEW |