| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 | 74 |
| 75 Variable(Scope* scope, | 75 Variable(Scope* scope, |
| 76 Handle<String> name, | 76 Handle<String> name, |
| 77 Mode mode, | 77 Mode mode, |
| 78 bool is_valid_lhs, | 78 bool is_valid_lhs, |
| 79 Kind kind); | 79 Kind kind); |
| 80 | 80 |
| 81 // Printing support | 81 // Printing support |
| 82 static const char* Mode2String(Mode mode); | 82 static const char* Mode2String(Mode mode); |
| 83 | 83 |
| 84 // Type testing & conversion | 84 // Type testing & conversion. Global variables are not slots. |
| 85 Property* AsProperty() const; | 85 Property* AsProperty() const; |
| 86 Slot* AsSlot() const; | 86 Slot* AsSlot() const; |
| 87 | 87 |
| 88 bool IsValidLeftHandSide() { return is_valid_LHS_; } | 88 bool IsValidLeftHandSide() { return is_valid_LHS_; } |
| 89 | 89 |
| 90 // The source code for an eval() call may refer to a variable that is | 90 // The source code for an eval() call may refer to a variable that is |
| 91 // in an outer scope about which we don't know anything (it may not | 91 // in an outer scope about which we don't know anything (it may not |
| 92 // be the global scope). scope() is NULL in that case. Currently the | 92 // be the global scope). scope() is NULL in that case. Currently the |
| 93 // scope is only used to follow the context chain length. | 93 // scope is only used to follow the context chain length. |
| 94 Scope* scope() const { return scope_; } | 94 Scope* scope() const { return scope_; } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 | 131 |
| 132 Variable* local_if_not_shadowed() const { | 132 Variable* local_if_not_shadowed() const { |
| 133 ASSERT(mode_ == DYNAMIC_LOCAL && local_if_not_shadowed_ != NULL); | 133 ASSERT(mode_ == DYNAMIC_LOCAL && local_if_not_shadowed_ != NULL); |
| 134 return local_if_not_shadowed_; | 134 return local_if_not_shadowed_; |
| 135 } | 135 } |
| 136 | 136 |
| 137 void set_local_if_not_shadowed(Variable* local) { | 137 void set_local_if_not_shadowed(Variable* local) { |
| 138 local_if_not_shadowed_ = local; | 138 local_if_not_shadowed_ = local; |
| 139 } | 139 } |
| 140 | 140 |
| 141 Expression* rewrite() const { return rewrite_; } | 141 Slot* rewrite() const { return rewrite_; } |
| 142 void set_rewrite(Expression* expr) { rewrite_ = expr; } | 142 void set_rewrite(Slot* slot) { rewrite_ = slot; } |
| 143 | 143 |
| 144 private: | 144 private: |
| 145 Scope* scope_; | 145 Scope* scope_; |
| 146 Handle<String> name_; | 146 Handle<String> name_; |
| 147 Mode mode_; | 147 Mode mode_; |
| 148 Kind kind_; | 148 Kind kind_; |
| 149 | 149 |
| 150 Variable* local_if_not_shadowed_; | 150 Variable* local_if_not_shadowed_; |
| 151 | 151 |
| 152 // Code generation. | 152 // Code generation. |
| 153 // rewrite_ is usually a Slot or a Property, but may be any expression. | 153 Slot* rewrite_; |
| 154 Expression* rewrite_; | |
| 155 | 154 |
| 156 // Valid as a LHS? (const and this are not valid LHS, for example) | 155 // Valid as a LHS? (const and this are not valid LHS, for example) |
| 157 bool is_valid_LHS_; | 156 bool is_valid_LHS_; |
| 158 | 157 |
| 159 // Usage info. | 158 // Usage info. |
| 160 bool is_accessed_from_inner_scope_; // set by variable resolver | 159 bool is_accessed_from_inner_scope_; // set by variable resolver |
| 161 bool is_used_; | 160 bool is_used_; |
| 162 }; | 161 }; |
| 163 | 162 |
| 164 | 163 |
| 165 } } // namespace v8::internal | 164 } } // namespace v8::internal |
| 166 | 165 |
| 167 #endif // V8_VARIABLES_H_ | 166 #endif // V8_VARIABLES_H_ |
| OLD | NEW |