| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 // in an outer scope about which we don't know anything (it may not | 131 // in an outer scope about which we don't know anything (it may not |
| 132 // be the global scope). scope() is NULL in that case. Currently the | 132 // be the global scope). scope() is NULL in that case. Currently the |
| 133 // scope is only used to follow the context chain length. | 133 // scope is only used to follow the context chain length. |
| 134 Scope* scope() const { return scope_; } | 134 Scope* scope() const { return scope_; } |
| 135 | 135 |
| 136 Handle<String> name() const { return name_; } | 136 Handle<String> name() const { return name_; } |
| 137 Mode mode() const { return mode_; } | 137 Mode mode() const { return mode_; } |
| 138 bool is_accessed_from_inner_scope() const { | 138 bool is_accessed_from_inner_scope() const { |
| 139 return is_accessed_from_inner_scope_; | 139 return is_accessed_from_inner_scope_; |
| 140 } | 140 } |
| 141 void MarkAsAccessedFromInnerScope() { |
| 142 is_accessed_from_inner_scope_ = true; |
| 143 } |
| 141 bool is_used() { return is_used_; } | 144 bool is_used() { return is_used_; } |
| 142 void set_is_used(bool flag) { is_used_ = flag; } | 145 void set_is_used(bool flag) { is_used_ = flag; } |
| 143 | 146 |
| 144 bool IsVariable(Handle<String> n) const { | 147 bool IsVariable(Handle<String> n) const { |
| 145 return !is_this() && name().is_identical_to(n); | 148 return !is_this() && name().is_identical_to(n); |
| 146 } | 149 } |
| 147 | 150 |
| 148 bool IsStackAllocated() const; | 151 bool IsStackAllocated() const; |
| 149 bool IsParameter() const; // Includes 'this'. | 152 bool IsParameter() const; // Includes 'this'. |
| 150 bool IsStackLocal() const; | 153 bool IsStackLocal() const; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 168 Variable* local_if_not_shadowed() const { | 171 Variable* local_if_not_shadowed() const { |
| 169 ASSERT(mode_ == DYNAMIC_LOCAL && local_if_not_shadowed_ != NULL); | 172 ASSERT(mode_ == DYNAMIC_LOCAL && local_if_not_shadowed_ != NULL); |
| 170 return local_if_not_shadowed_; | 173 return local_if_not_shadowed_; |
| 171 } | 174 } |
| 172 | 175 |
| 173 void set_local_if_not_shadowed(Variable* local) { | 176 void set_local_if_not_shadowed(Variable* local) { |
| 174 local_if_not_shadowed_ = local; | 177 local_if_not_shadowed_ = local; |
| 175 } | 178 } |
| 176 | 179 |
| 177 Expression* rewrite() const { return rewrite_; } | 180 Expression* rewrite() const { return rewrite_; } |
| 181 void set_rewrite(Expression* expr) { rewrite_ = expr; } |
| 178 | 182 |
| 179 StaticType* type() { return &type_; } | 183 StaticType* type() { return &type_; } |
| 180 | 184 |
| 181 private: | 185 private: |
| 182 Scope* scope_; | 186 Scope* scope_; |
| 183 Handle<String> name_; | 187 Handle<String> name_; |
| 184 Mode mode_; | 188 Mode mode_; |
| 185 bool is_valid_LHS_; | 189 bool is_valid_LHS_; |
| 186 Kind kind_; | 190 Kind kind_; |
| 187 | 191 |
| 188 Variable* local_if_not_shadowed_; | 192 Variable* local_if_not_shadowed_; |
| 189 | 193 |
| 190 // Usage info. | 194 // Usage info. |
| 191 bool is_accessed_from_inner_scope_; // set by variable resolver | 195 bool is_accessed_from_inner_scope_; // set by variable resolver |
| 192 bool is_used_; | 196 bool is_used_; |
| 193 | 197 |
| 194 // Static type information | 198 // Static type information |
| 195 StaticType type_; | 199 StaticType type_; |
| 196 | 200 |
| 197 // Code generation. | 201 // Code generation. |
| 198 // rewrite_ is usually a Slot or a Property, but may be any expression. | 202 // rewrite_ is usually a Slot or a Property, but may be any expression. |
| 199 Expression* rewrite_; | 203 Expression* rewrite_; |
| 200 | |
| 201 friend class Scope; // Has explicit access to rewrite_. | |
| 202 }; | 204 }; |
| 203 | 205 |
| 204 | 206 |
| 205 } } // namespace v8::internal | 207 } } // namespace v8::internal |
| 206 | 208 |
| 207 #endif // V8_VARIABLES_H_ | 209 #endif // V8_VARIABLES_H_ |
| OLD | NEW |