Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(82)

Unified Diff: src/scopes.cc

Issue 9310027: Do not ignore an empty context with extension when creating a scope object. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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,
« src/scopes.h ('K') | « src/scopes.h ('k') | test/mjsunit/regress/regress-crbug-107996.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698