| 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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 TEMPORARY // temporary variables (not user-visible), never | 136 TEMPORARY // temporary variables (not user-visible), never |
| 137 // in a context | 137 // in a context |
| 138 }; | 138 }; |
| 139 | 139 |
| 140 enum Kind { | 140 enum Kind { |
| 141 NORMAL, | 141 NORMAL, |
| 142 THIS, | 142 THIS, |
| 143 ARGUMENTS | 143 ARGUMENTS |
| 144 }; | 144 }; |
| 145 | 145 |
| 146 Variable(Scope* scope, |
| 147 Handle<String> name, |
| 148 Mode mode, |
| 149 bool is_valid_lhs, |
| 150 Kind kind); |
| 151 |
| 146 // Printing support | 152 // Printing support |
| 147 static const char* Mode2String(Mode mode); | 153 static const char* Mode2String(Mode mode); |
| 148 | 154 |
| 149 // Type testing & conversion | 155 // Type testing & conversion |
| 150 Property* AsProperty(); | 156 Property* AsProperty(); |
| 151 Variable* AsVariable(); | 157 Variable* AsVariable(); |
| 152 bool IsValidLeftHandSide() { return is_valid_LHS_; } | 158 bool IsValidLeftHandSide() { return is_valid_LHS_; } |
| 153 | 159 |
| 154 // The source code for an eval() call may refer to a variable that is | 160 // The source code for an eval() call may refer to a variable that is |
| 155 // in an outer scope about which we don't know anything (it may not | 161 // in an outer scope about which we don't know anything (it may not |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 void set_local_if_not_shadowed(Variable* local) { | 195 void set_local_if_not_shadowed(Variable* local) { |
| 190 local_if_not_shadowed_ = local; | 196 local_if_not_shadowed_ = local; |
| 191 } | 197 } |
| 192 | 198 |
| 193 Expression* rewrite() const { return rewrite_; } | 199 Expression* rewrite() const { return rewrite_; } |
| 194 Slot* slot() const; | 200 Slot* slot() const; |
| 195 | 201 |
| 196 SmiAnalysis* type() { return &type_; } | 202 SmiAnalysis* type() { return &type_; } |
| 197 | 203 |
| 198 private: | 204 private: |
| 199 Variable(Scope* scope, Handle<String> name, Mode mode, bool is_valid_LHS, | |
| 200 Kind kind); | |
| 201 | |
| 202 Scope* scope_; | 205 Scope* scope_; |
| 203 Handle<String> name_; | 206 Handle<String> name_; |
| 204 Mode mode_; | 207 Mode mode_; |
| 205 bool is_valid_LHS_; | 208 bool is_valid_LHS_; |
| 206 Kind kind_; | 209 Kind kind_; |
| 207 | 210 |
| 208 Variable* local_if_not_shadowed_; | 211 Variable* local_if_not_shadowed_; |
| 209 | 212 |
| 210 // Usage info. | 213 // Usage info. |
| 211 bool is_accessed_from_inner_scope_; // set by variable resolver | 214 bool is_accessed_from_inner_scope_; // set by variable resolver |
| 212 UseCount var_uses_; // uses of the variable value | 215 UseCount var_uses_; // uses of the variable value |
| 213 UseCount obj_uses_; // uses of the object the variable points to | 216 UseCount obj_uses_; // uses of the object the variable points to |
| 214 | 217 |
| 215 // Static type information | 218 // Static type information |
| 216 SmiAnalysis type_; | 219 SmiAnalysis type_; |
| 217 | 220 |
| 218 // Code generation. | 221 // Code generation. |
| 219 // rewrite_ is usually a Slot or a Property, but maybe any expression. | 222 // rewrite_ is usually a Slot or a Property, but may be any expression. |
| 220 Expression* rewrite_; | 223 Expression* rewrite_; |
| 221 | 224 |
| 222 friend class VariableProxy; | 225 friend class Scope; // Has explicit access to rewrite_. |
| 223 friend class Scope; | |
| 224 friend class LocalsMap; | |
| 225 friend class AstBuildingParser; | |
| 226 }; | 226 }; |
| 227 | 227 |
| 228 | 228 |
| 229 } } // namespace v8::internal | 229 } } // namespace v8::internal |
| 230 | 230 |
| 231 #endif // V8_VARIABLES_H_ | 231 #endif // V8_VARIABLES_H_ |
| OLD | NEW |