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

Unified Diff: src/ast/scopeinfo.cc

Issue 2314483002: Store the ScopeInfo in WithContexts (Closed)
Patch Set: updates Created 4 years, 3 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
« no previous file with comments | « src/api.cc ('k') | src/ast/scopes.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast/scopeinfo.cc
diff --git a/src/ast/scopeinfo.cc b/src/ast/scopeinfo.cc
index 20a96938c2a93625c2d7b97409c219e518dddabd..a6ba5af0aad031f4d9973ef67e27affccf3c3ccc 100644
--- a/src/ast/scopeinfo.cc
+++ b/src/ast/scopeinfo.cc
@@ -241,6 +241,38 @@ Handle<ScopeInfo> ScopeInfo::Create(Isolate* isolate, Zone* zone,
return scope_info;
}
+Handle<ScopeInfo> ScopeInfo::CreateForWithScope(Isolate* isolate) {
+ const int length = kVariablePartIndex + 1;
+
+ Factory* factory = isolate->factory();
+ Handle<ScopeInfo> scope_info = factory->NewScopeInfo(length);
+
+ // Encode the flags.
+ int flags =
+ ScopeTypeField::encode(WITH_SCOPE) | CallsEvalField::encode(false) |
+ LanguageModeField::encode(SLOPPY) | DeclarationScopeField::encode(false) |
+ ReceiverVariableField::encode(NONE) | HasNewTargetField::encode(false) |
+ FunctionVariableField::encode(NONE) | AsmModuleField::encode(false) |
+ AsmFunctionField::encode(false) | HasSimpleParametersField::encode(true) |
+ FunctionKindField::encode(kNormalFunction);
+ scope_info->SetFlags(flags);
+
+ scope_info->SetParameterCount(0);
+ scope_info->SetStackLocalCount(0);
+ scope_info->SetContextLocalCount(0);
+
+ int index = kVariablePartIndex;
+ DCHECK_EQ(index, scope_info->ParameterEntriesIndex());
+ DCHECK_EQ(index, scope_info->StackLocalFirstSlotIndex());
+ scope_info->set(index++, Smi::FromInt(0));
+ DCHECK_EQ(index, scope_info->StackLocalEntriesIndex());
+ DCHECK_EQ(index, scope_info->ReceiverEntryIndex());
+ DCHECK_EQ(index, scope_info->FunctionNameEntryIndex());
+ DCHECK_EQ(index, scope_info->length());
+ DCHECK_EQ(0, scope_info->ParameterCount());
+ DCHECK_EQ(Context::MIN_CONTEXT_SLOTS, scope_info->ContextLength());
+ return scope_info;
+}
Handle<ScopeInfo> ScopeInfo::CreateGlobalThisBinding(Isolate* isolate) {
DCHECK(isolate->bootstrapper()->IsActive());
« no previous file with comments | « src/api.cc ('k') | src/ast/scopes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698