| 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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 Scope* scope() const { return scope_; } | 164 Scope* scope() const { return scope_; } |
| 165 | 165 |
| 166 Handle<String> name() const { return name_; } | 166 Handle<String> name() const { return name_; } |
| 167 Mode mode() const { return mode_; } | 167 Mode mode() const { return mode_; } |
| 168 bool is_accessed_from_inner_scope() const { | 168 bool is_accessed_from_inner_scope() const { |
| 169 return is_accessed_from_inner_scope_; | 169 return is_accessed_from_inner_scope_; |
| 170 } | 170 } |
| 171 UseCount* var_uses() { return &var_uses_; } | 171 UseCount* var_uses() { return &var_uses_; } |
| 172 UseCount* obj_uses() { return &obj_uses_; } | 172 UseCount* obj_uses() { return &obj_uses_; } |
| 173 | 173 |
| 174 bool IsVariable(Handle<String> n) { | 174 bool IsVariable(Handle<String> n) const { |
| 175 return !is_this() && name().is_identical_to(n); | 175 return !is_this() && name().is_identical_to(n); |
| 176 } | 176 } |
| 177 | 177 |
| 178 bool is_dynamic() const { | 178 bool is_dynamic() const { |
| 179 return (mode_ == DYNAMIC || | 179 return (mode_ == DYNAMIC || |
| 180 mode_ == DYNAMIC_GLOBAL || | 180 mode_ == DYNAMIC_GLOBAL || |
| 181 mode_ == DYNAMIC_LOCAL); | 181 mode_ == DYNAMIC_LOCAL); |
| 182 } | 182 } |
| 183 | 183 |
| 184 bool is_global() const; | 184 bool is_global() const; |
| 185 bool is_this() const { return kind_ == THIS; } | 185 bool is_this() const { return kind_ == THIS; } |
| 186 bool is_arguments() const { return kind_ == ARGUMENTS; } | 186 bool is_arguments() const { return kind_ == ARGUMENTS; } |
| 187 | 187 |
| 188 // True if the variable is named eval and not known to be shadowed. |
| 189 bool is_possibly_eval() const { |
| 190 return IsVariable(Factory::eval_symbol()) && |
| 191 (mode_ == DYNAMIC || mode_ == DYNAMIC_GLOBAL); |
| 192 } |
| 193 |
| 188 Variable* local_if_not_shadowed() const { | 194 Variable* local_if_not_shadowed() const { |
| 189 ASSERT(mode_ == DYNAMIC_LOCAL && local_if_not_shadowed_ != NULL); | 195 ASSERT(mode_ == DYNAMIC_LOCAL && local_if_not_shadowed_ != NULL); |
| 190 return local_if_not_shadowed_; | 196 return local_if_not_shadowed_; |
| 191 } | 197 } |
| 192 | 198 |
| 193 void set_local_if_not_shadowed(Variable* local) { | 199 void set_local_if_not_shadowed(Variable* local) { |
| 194 local_if_not_shadowed_ = local; | 200 local_if_not_shadowed_ = local; |
| 195 } | 201 } |
| 196 | 202 |
| 197 Expression* rewrite() const { return rewrite_; } | 203 Expression* rewrite() const { return rewrite_; } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 220 // rewrite_ is usually a Slot or a Property, but may be any expression. | 226 // rewrite_ is usually a Slot or a Property, but may be any expression. |
| 221 Expression* rewrite_; | 227 Expression* rewrite_; |
| 222 | 228 |
| 223 friend class Scope; // Has explicit access to rewrite_. | 229 friend class Scope; // Has explicit access to rewrite_. |
| 224 }; | 230 }; |
| 225 | 231 |
| 226 | 232 |
| 227 } } // namespace v8::internal | 233 } } // namespace v8::internal |
| 228 | 234 |
| 229 #endif // V8_VARIABLES_H_ | 235 #endif // V8_VARIABLES_H_ |
| OLD | NEW |