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