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 is_accessed_from_inner_scope() const { | 96 bool is_accessed_from_inner_scope() const { |
97 return is_accessed_from_inner_scope_; | 97 return is_accessed_from_inner_scope_; |
98 } | 98 } |
99 void MarkAsAccessedFromInnerScope() { | 99 void MarkAsAccessedFromInnerScope() { |
100 ASSERT(mode_ != TEMPORARY); | 100 ASSERT(mode_ != TEMPORARY); |
101 is_accessed_from_inner_scope_ = true; | 101 is_accessed_from_inner_scope_ = 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 index_ = index; | 159 index_ = index; |
157 } | 160 } |
158 | 161 |
159 private: | 162 private: |
160 Scope* scope_; | 163 Scope* scope_; |
161 Handle<String> name_; | 164 Handle<String> name_; |
162 VariableMode mode_; | 165 VariableMode mode_; |
163 Kind kind_; | 166 Kind kind_; |
164 Location location_; | 167 Location location_; |
165 int index_; | 168 int index_; |
| 169 int initializer_position_; |
166 | 170 |
167 // If this field is set, this variable references the stored locally bound | 171 // If this field is set, this variable references the stored locally bound |
168 // variable, but it might be shadowed by variable bindings introduced by | 172 // variable, but it might be shadowed by variable bindings introduced by |
169 // non-strict 'eval' calls between the reference scope (inclusive) and the | 173 // non-strict 'eval' calls between the reference scope (inclusive) and the |
170 // binding scope (exclusive). | 174 // binding scope (exclusive). |
171 Variable* local_if_not_shadowed_; | 175 Variable* local_if_not_shadowed_; |
172 | 176 |
173 // Valid as a LHS? (const and this are not valid LHS, for example) | 177 // Valid as a LHS? (const and this are not valid LHS, for example) |
174 bool is_valid_LHS_; | 178 bool is_valid_LHS_; |
175 | 179 |
176 // Usage info. | 180 // Usage info. |
177 bool is_accessed_from_inner_scope_; // set by variable resolver | 181 bool is_accessed_from_inner_scope_; // set by variable resolver |
178 bool is_used_; | 182 bool is_used_; |
179 InitializationFlag initialization_flag_; | 183 InitializationFlag initialization_flag_; |
180 }; | 184 }; |
181 | 185 |
182 | 186 |
183 } } // namespace v8::internal | 187 } } // namespace v8::internal |
184 | 188 |
185 #endif // V8_VARIABLES_H_ | 189 #endif // V8_VARIABLES_H_ |
OLD | NEW |