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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 | 103 |
104 // ---------------------------------------------------------------------------- | 104 // ---------------------------------------------------------------------------- |
105 // Implementation Variable. | 105 // Implementation Variable. |
106 | 106 |
107 | 107 |
108 const char* Variable::Mode2String(Mode mode) { | 108 const char* Variable::Mode2String(Mode mode) { |
109 switch (mode) { | 109 switch (mode) { |
110 case VAR: return "VAR"; | 110 case VAR: return "VAR"; |
111 case CONST: return "CONST"; | 111 case CONST: return "CONST"; |
112 case DYNAMIC: return "DYNAMIC"; | 112 case DYNAMIC: return "DYNAMIC"; |
| 113 case DYNAMIC_GLOBAL: return "DYNAMIC_GLOBAL"; |
| 114 case DYNAMIC_LOCAL: return "DYNAMIC_LOCAL"; |
113 case INTERNAL: return "INTERNAL"; | 115 case INTERNAL: return "INTERNAL"; |
114 case TEMPORARY: return "TEMPORARY"; | 116 case TEMPORARY: return "TEMPORARY"; |
115 } | 117 } |
116 UNREACHABLE(); | 118 UNREACHABLE(); |
117 return NULL; | 119 return NULL; |
118 } | 120 } |
119 | 121 |
120 | 122 |
121 Property* Variable::AsProperty() { | 123 Property* Variable::AsProperty() { |
122 return rewrite_ == NULL ? NULL : rewrite_->AsProperty(); | 124 return rewrite_ == NULL ? NULL : rewrite_->AsProperty(); |
(...skipping 13 matching lines...) Expand all Loading... |
136 Variable::Variable(Scope* scope, | 138 Variable::Variable(Scope* scope, |
137 Handle<String> name, | 139 Handle<String> name, |
138 Mode mode, | 140 Mode mode, |
139 bool is_valid_LHS, | 141 bool is_valid_LHS, |
140 bool is_this) | 142 bool is_this) |
141 : scope_(scope), | 143 : scope_(scope), |
142 name_(name), | 144 name_(name), |
143 mode_(mode), | 145 mode_(mode), |
144 is_valid_LHS_(is_valid_LHS), | 146 is_valid_LHS_(is_valid_LHS), |
145 is_this_(is_this), | 147 is_this_(is_this), |
| 148 local_if_not_shadowed_(NULL), |
146 is_accessed_from_inner_scope_(false), | 149 is_accessed_from_inner_scope_(false), |
147 rewrite_(NULL) { | 150 rewrite_(NULL) { |
148 // names must be canonicalized for fast equality checks | 151 // names must be canonicalized for fast equality checks |
149 ASSERT(name->IsSymbol()); | 152 ASSERT(name->IsSymbol()); |
150 } | 153 } |
151 | 154 |
152 | 155 |
153 bool Variable::is_global() const { | 156 bool Variable::is_global() const { |
154 // Temporaries are never global, they must always be allocated in the | 157 // Temporaries are never global, they must always be allocated in the |
155 // activation frame. | 158 // activation frame. |
156 return mode_ != TEMPORARY && scope_ != NULL && scope_->is_global_scope(); | 159 return mode_ != TEMPORARY && scope_ != NULL && scope_->is_global_scope(); |
157 } | 160 } |
158 | 161 |
159 | |
160 } } // namespace v8::internal | 162 } } // namespace v8::internal |
OLD | NEW |