| OLD | NEW |
| 1 // Copyright 2006-2008 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 |
| 11 // with the distribution. | 11 // with the distribution. |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 | 114 |
| 115 Variable(Scope* scope, | 115 Variable(Scope* scope, |
| 116 Handle<String> name, | 116 Handle<String> name, |
| 117 Mode mode, | 117 Mode mode, |
| 118 bool is_valid_lhs, | 118 bool is_valid_lhs, |
| 119 Kind kind); | 119 Kind kind); |
| 120 | 120 |
| 121 // Printing support | 121 // Printing support |
| 122 static const char* Mode2String(Mode mode); | 122 static const char* Mode2String(Mode mode); |
| 123 | 123 |
| 124 // Type testing & conversion | 124 // Type testing & conversion. Global variables are not slots. |
| 125 Property* AsProperty() const; | |
| 126 Slot* AsSlot() const; | 125 Slot* AsSlot() const; |
| 127 | 126 |
| 128 bool IsValidLeftHandSide() { return is_valid_LHS_; } | 127 bool IsValidLeftHandSide() { return is_valid_LHS_; } |
| 129 | 128 |
| 130 // The source code for an eval() call may refer to a variable that is | 129 // The source code for an eval() call may refer to a variable that is |
| 131 // in an outer scope about which we don't know anything (it may not | 130 // 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 | 131 // be the global scope). scope() is NULL in that case. Currently the |
| 133 // scope is only used to follow the context chain length. | 132 // scope is only used to follow the context chain length. |
| 134 Scope* scope() const { return scope_; } | 133 Scope* scope() const { return scope_; } |
| 135 | 134 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 Variable* local_if_not_shadowed() const { | 171 Variable* local_if_not_shadowed() const { |
| 173 ASSERT(mode_ == DYNAMIC_LOCAL && local_if_not_shadowed_ != NULL); | 172 ASSERT(mode_ == DYNAMIC_LOCAL && local_if_not_shadowed_ != NULL); |
| 174 return local_if_not_shadowed_; | 173 return local_if_not_shadowed_; |
| 175 } | 174 } |
| 176 | 175 |
| 177 void set_local_if_not_shadowed(Variable* local) { | 176 void set_local_if_not_shadowed(Variable* local) { |
| 178 local_if_not_shadowed_ = local; | 177 local_if_not_shadowed_ = local; |
| 179 } | 178 } |
| 180 | 179 |
| 181 Slot* rewrite() const { return rewrite_; } | 180 Slot* rewrite() const { return rewrite_; } |
| 182 void set_rewrite(Slot* expr) { rewrite_ = expr; } | 181 void set_rewrite(Slot* slot) { rewrite_ = slot; } |
| 183 | 182 |
| 184 StaticType* type() { return &type_; } | 183 StaticType* type() { return &type_; } |
| 185 | 184 |
| 186 private: | 185 private: |
| 187 Scope* scope_; | 186 Scope* scope_; |
| 188 Handle<String> name_; | 187 Handle<String> name_; |
| 189 Mode mode_; | 188 Mode mode_; |
| 190 Kind kind_; | 189 Kind kind_; |
| 191 | 190 |
| 192 Variable* local_if_not_shadowed_; | 191 Variable* local_if_not_shadowed_; |
| 193 | 192 |
| 194 // Static type information | 193 // Static type information |
| 195 StaticType type_; | 194 StaticType type_; |
| 196 | 195 |
| 197 // Code generation. | 196 // Code generation. |
| 198 Slot* rewrite_; | 197 Slot* rewrite_; |
| 199 | 198 |
| 200 // Valid as a LHS? (const and this are not valid LHS, for example) | 199 // Valid as a LHS? (const and this are not valid LHS, for example) |
| 201 bool is_valid_LHS_; | 200 bool is_valid_LHS_; |
| 202 | 201 |
| 203 // Usage info. | 202 // Usage info. |
| 204 bool is_accessed_from_inner_scope_; // set by variable resolver | 203 bool is_accessed_from_inner_scope_; // set by variable resolver |
| 205 bool is_used_; | 204 bool is_used_; |
| 206 }; | 205 }; |
| 207 | 206 |
| 208 | 207 |
| 209 } } // namespace v8::internal | 208 } } // namespace v8::internal |
| 210 | 209 |
| 211 #endif // V8_VARIABLES_H_ | 210 #endif // V8_VARIABLES_H_ |
| OLD | NEW |