OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 bool has_forced_context_allocation() const { | 96 bool has_forced_context_allocation() const { |
97 return force_context_allocation_; | 97 return force_context_allocation_; |
98 } | 98 } |
99 void ForceContextAllocation() { | 99 void ForceContextAllocation() { |
100 ASSERT(mode_ != TEMPORARY); | 100 ASSERT(mode_ != TEMPORARY); |
101 force_context_allocation_ = true; | 101 force_context_allocation_ = true; |
102 } | 102 } |
103 bool is_used() { return is_used_; } | 103 bool is_used() { return is_used_; } |
104 void set_is_used(bool flag) { is_used_ = flag; } | 104 void set_is_used(bool flag) { is_used_ = flag; } |
105 | 105 |
| 106 int initializer_position() { return initializer_position_; } |
| 107 void set_initializer_position(int pos) { initializer_position_ = pos; } |
| 108 |
106 bool IsVariable(Handle<String> n) const { | 109 bool IsVariable(Handle<String> n) const { |
107 return !is_this() && name().is_identical_to(n); | 110 return !is_this() && name().is_identical_to(n); |
108 } | 111 } |
109 | 112 |
110 bool IsUnallocated() const { return location_ == UNALLOCATED; } | 113 bool IsUnallocated() const { return location_ == UNALLOCATED; } |
111 bool IsParameter() const { return location_ == PARAMETER; } | 114 bool IsParameter() const { return location_ == PARAMETER; } |
112 bool IsStackLocal() const { return location_ == LOCAL; } | 115 bool IsStackLocal() const { return location_ == LOCAL; } |
113 bool IsStackAllocated() const { return IsParameter() || IsStackLocal(); } | 116 bool IsStackAllocated() const { return IsParameter() || IsStackLocal(); } |
114 bool IsContextSlot() const { return location_ == CONTEXT; } | 117 bool IsContextSlot() const { return location_ == CONTEXT; } |
115 bool IsLookupSlot() const { return location_ == LOOKUP; } | 118 bool IsLookupSlot() const { return location_ == LOOKUP; } |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 | 161 |
159 static int CompareIndex(Variable* const* v, Variable* const* w); | 162 static int CompareIndex(Variable* const* v, Variable* const* w); |
160 | 163 |
161 private: | 164 private: |
162 Scope* scope_; | 165 Scope* scope_; |
163 Handle<String> name_; | 166 Handle<String> name_; |
164 VariableMode mode_; | 167 VariableMode mode_; |
165 Kind kind_; | 168 Kind kind_; |
166 Location location_; | 169 Location location_; |
167 int index_; | 170 int index_; |
| 171 int initializer_position_; |
168 | 172 |
169 // If this field is set, this variable references the stored locally bound | 173 // If this field is set, this variable references the stored locally bound |
170 // variable, but it might be shadowed by variable bindings introduced by | 174 // variable, but it might be shadowed by variable bindings introduced by |
171 // non-strict 'eval' calls between the reference scope (inclusive) and the | 175 // non-strict 'eval' calls between the reference scope (inclusive) and the |
172 // binding scope (exclusive). | 176 // binding scope (exclusive). |
173 Variable* local_if_not_shadowed_; | 177 Variable* local_if_not_shadowed_; |
174 | 178 |
175 // Valid as a LHS? (const and this are not valid LHS, for example) | 179 // Valid as a LHS? (const and this are not valid LHS, for example) |
176 bool is_valid_LHS_; | 180 bool is_valid_LHS_; |
177 | 181 |
178 // Usage info. | 182 // Usage info. |
179 bool force_context_allocation_; // set by variable resolver | 183 bool force_context_allocation_; // set by variable resolver |
180 bool is_used_; | 184 bool is_used_; |
181 InitializationFlag initialization_flag_; | 185 InitializationFlag initialization_flag_; |
182 }; | 186 }; |
183 | 187 |
184 | 188 |
185 } } // namespace v8::internal | 189 } } // namespace v8::internal |
186 | 190 |
187 #endif // V8_VARIABLES_H_ | 191 #endif // V8_VARIABLES_H_ |
OLD | NEW |