Chromium Code Reviews| Index: src/scopes.cc |
| diff --git a/src/scopes.cc b/src/scopes.cc |
| index d0ee8ec7f21af11758a2cb3c49dcf9f8a2aa6b18..b03ea3d00777a93b3366365d611c1b325abb7c9f 100644 |
| --- a/src/scopes.cc |
| +++ b/src/scopes.cc |
| @@ -137,7 +137,8 @@ Scope::Scope(Scope* outer_scope, ScopeType type) |
| Scope::Scope(Scope* inner_scope, |
| ScopeType type, |
| - Handle<ScopeInfo> scope_info) |
| + Handle<ScopeInfo> scope_info, |
| + bool has_context_with_extension) |
| : isolate_(Isolate::Current()), |
| inner_scopes_(4), |
| variables_(), |
| @@ -147,12 +148,10 @@ Scope::Scope(Scope* inner_scope, |
| decls_(4), |
| already_resolved_(true) { |
| SetDefaults(type, NULL, scope_info); |
| - if (!scope_info.is_null()) { |
| + if (!scope_info.is_null() && *scope_info != ScopeInfo::Empty()) { |
|
Kevin Millikin (Chromium)
2012/02/02 08:36:13
As far as I can tell, there is no reason *at all*
ulan
2012/02/02 09:16:19
Indeed, this constructor is called only from Deser
|
| num_heap_slots_ = scope_info_->ContextLength(); |
| - if (*scope_info != ScopeInfo::Empty()) { |
|
Kevin Millikin (Chromium)
2012/02/02 08:36:13
As a simple cleanup, you can get rid of this compl
|
| - language_mode_ = scope_info->language_mode(); |
| - } |
| - } else if (is_with_scope()) { |
| + language_mode_ = scope_info->language_mode(); |
| + } else if (is_with_scope() || has_context_with_extension) { |
| num_heap_slots_ = Context::MIN_CONTEXT_SLOTS; |
| } |
| AddInnerScope(inner_scope); |
| @@ -235,7 +234,8 @@ Scope* Scope::DeserializeScopeChain(Context* context, Scope* global_scope) { |
| ScopeInfo* scope_info = context->closure()->shared()->scope_info(); |
| current_scope = new Scope(current_scope, |
| FUNCTION_SCOPE, |
| - Handle<ScopeInfo>(scope_info)); |
| + Handle<ScopeInfo>(scope_info), |
| + context->extension() != NULL); |
| } else if (context->IsBlockContext()) { |
| ScopeInfo* scope_info = ScopeInfo::cast(context->extension()); |
| current_scope = new Scope(current_scope, |