| 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 inner_scopes_(4), | 142 inner_scopes_(4), |
| 143 variables_(), | 143 variables_(), |
| 144 temps_(4), | 144 temps_(4), |
| 145 params_(4), | 145 params_(4), |
| 146 unresolved_(16), | 146 unresolved_(16), |
| 147 decls_(4), | 147 decls_(4), |
| 148 already_resolved_(true) { | 148 already_resolved_(true) { |
| 149 SetDefaults(type, NULL, scope_info); | 149 SetDefaults(type, NULL, scope_info); |
| 150 if (!scope_info.is_null()) { | 150 if (!scope_info.is_null()) { |
| 151 num_heap_slots_ = scope_info_->ContextLength(); | 151 num_heap_slots_ = scope_info_->ContextLength(); |
| 152 if (*scope_info != ScopeInfo::Empty()) { | |
| 153 language_mode_ = scope_info->language_mode(); | |
| 154 } | |
| 155 } else if (is_with_scope()) { | |
| 156 num_heap_slots_ = Context::MIN_CONTEXT_SLOTS; | |
| 157 } | 152 } |
| 153 // Ensure at least MIN_CONTEXT_SLOTS to indicate a materialized context. |
| 154 num_heap_slots_ = Max(num_heap_slots_, |
| 155 static_cast<int>(Context::MIN_CONTEXT_SLOTS)); |
| 158 AddInnerScope(inner_scope); | 156 AddInnerScope(inner_scope); |
| 159 } | 157 } |
| 160 | 158 |
| 161 | 159 |
| 162 Scope::Scope(Scope* inner_scope, Handle<String> catch_variable_name) | 160 Scope::Scope(Scope* inner_scope, Handle<String> catch_variable_name) |
| 163 : isolate_(Isolate::Current()), | 161 : isolate_(Isolate::Current()), |
| 164 inner_scopes_(1), | 162 inner_scopes_(1), |
| 165 variables_(), | 163 variables_(), |
| 166 temps_(0), | 164 temps_(0), |
| 167 params_(0), | 165 params_(0), |
| (...skipping 1062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1230 } | 1228 } |
| 1231 | 1229 |
| 1232 | 1230 |
| 1233 int Scope::ContextLocalCount() const { | 1231 int Scope::ContextLocalCount() const { |
| 1234 if (num_heap_slots() == 0) return 0; | 1232 if (num_heap_slots() == 0) return 0; |
| 1235 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - | 1233 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - |
| 1236 (function_ != NULL && function_->var()->IsContextSlot() ? 1 : 0); | 1234 (function_ != NULL && function_->var()->IsContextSlot() ? 1 : 0); |
| 1237 } | 1235 } |
| 1238 | 1236 |
| 1239 } } // namespace v8::internal | 1237 } } // namespace v8::internal |
| OLD | NEW |