| 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 | |
| 109 bool IsVariable(Handle<String> n) const { | 106 bool IsVariable(Handle<String> n) const { |
| 110 return !is_this() && name().is_identical_to(n); | 107 return !is_this() && name().is_identical_to(n); |
| 111 } | 108 } |
| 112 | 109 |
| 113 bool IsUnallocated() const { return location_ == UNALLOCATED; } | 110 bool IsUnallocated() const { return location_ == UNALLOCATED; } |
| 114 bool IsParameter() const { return location_ == PARAMETER; } | 111 bool IsParameter() const { return location_ == PARAMETER; } |
| 115 bool IsStackLocal() const { return location_ == LOCAL; } | 112 bool IsStackLocal() const { return location_ == LOCAL; } |
| 116 bool IsStackAllocated() const { return IsParameter() || IsStackLocal(); } | 113 bool IsStackAllocated() const { return IsParameter() || IsStackLocal(); } |
| 117 bool IsContextSlot() const { return location_ == CONTEXT; } | 114 bool IsContextSlot() const { return location_ == CONTEXT; } |
| 118 bool IsLookupSlot() const { return location_ == LOOKUP; } | 115 bool IsLookupSlot() const { return location_ == LOOKUP; } |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 | 158 |
| 162 static int CompareIndex(Variable* const* v, Variable* const* w); | 159 static int CompareIndex(Variable* const* v, Variable* const* w); |
| 163 | 160 |
| 164 private: | 161 private: |
| 165 Scope* scope_; | 162 Scope* scope_; |
| 166 Handle<String> name_; | 163 Handle<String> name_; |
| 167 VariableMode mode_; | 164 VariableMode mode_; |
| 168 Kind kind_; | 165 Kind kind_; |
| 169 Location location_; | 166 Location location_; |
| 170 int index_; | 167 int index_; |
| 171 int initializer_position_; | |
| 172 | 168 |
| 173 // If this field is set, this variable references the stored locally bound | 169 // If this field is set, this variable references the stored locally bound |
| 174 // variable, but it might be shadowed by variable bindings introduced by | 170 // variable, but it might be shadowed by variable bindings introduced by |
| 175 // non-strict 'eval' calls between the reference scope (inclusive) and the | 171 // non-strict 'eval' calls between the reference scope (inclusive) and the |
| 176 // binding scope (exclusive). | 172 // binding scope (exclusive). |
| 177 Variable* local_if_not_shadowed_; | 173 Variable* local_if_not_shadowed_; |
| 178 | 174 |
| 179 // Valid as a LHS? (const and this are not valid LHS, for example) | 175 // Valid as a LHS? (const and this are not valid LHS, for example) |
| 180 bool is_valid_LHS_; | 176 bool is_valid_LHS_; |
| 181 | 177 |
| 182 // Usage info. | 178 // Usage info. |
| 183 bool force_context_allocation_; // set by variable resolver | 179 bool force_context_allocation_; // set by variable resolver |
| 184 bool is_used_; | 180 bool is_used_; |
| 185 InitializationFlag initialization_flag_; | 181 InitializationFlag initialization_flag_; |
| 186 }; | 182 }; |
| 187 | 183 |
| 188 | 184 |
| 189 } } // namespace v8::internal | 185 } } // namespace v8::internal |
| 190 | 186 |
| 191 #endif // V8_VARIABLES_H_ | 187 #endif // V8_VARIABLES_H_ |
| OLD | NEW |