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

Unified Diff: src/scopeinfo.cc

Issue 11093074: Get rid of static module allocation, do it in code. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed last comments; added other back-ends Created 8 years, 1 month 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/scopeinfo.h ('k') | src/scopes.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/scopeinfo.cc
diff --git a/src/scopeinfo.cc b/src/scopeinfo.cc
index 02b4323980f30218e51059a5ebc287fd64c72b09..c0b2c4c8e6cf4799ccf7a5257cea87ba989f1c31 100644
--- a/src/scopeinfo.cc
+++ b/src/scopeinfo.cc
@@ -321,6 +321,7 @@ int ScopeInfo::ContextSlotIndex(String* name,
return result;
}
}
+ // Cache as not found. Mode and init flag don't matter.
context_slot_cache->Update(this, name, INTERNAL, kNeedsInitialization, -1);
}
return -1;
@@ -504,4 +505,32 @@ void ScopeInfo::Print() {
}
#endif // DEBUG
+
+//---------------------------------------------------------------------------
+// ModuleInfo.
+
+Handle<ModuleInfo> ModuleInfo::Create(
+ Isolate* isolate, Interface* interface, Scope* scope) {
+ Handle<ModuleInfo> info = Allocate(isolate, interface->Length());
+ info->set_host_index(interface->Index());
+ int i = 0;
+ for (Interface::Iterator it = interface->iterator();
+ !it.done(); it.Advance(), ++i) {
+ Variable* var = scope->LocalLookup(it.name());
+ info->set_name(i, *it.name());
+ info->set_mode(i, var->mode());
+ ASSERT((var->mode() == MODULE) == (it.interface()->IsModule()));
+ if (var->mode() == MODULE) {
+ ASSERT(it.interface()->IsFrozen());
+ ASSERT(it.interface()->Index() >= 0);
+ info->set_index(i, it.interface()->Index());
+ } else {
+ ASSERT(var->index() >= 0);
+ info->set_index(i, var->index());
+ }
+ }
+ ASSERT(i == info->length());
+ return info;
+}
+
} } // namespace v8::internal
« no previous file with comments | « src/scopeinfo.h ('k') | src/scopes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698