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

Unified Diff: src/interface.h

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/ia32/macro-assembler-ia32.h ('k') | src/interface.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/interface.h
diff --git a/src/interface.h b/src/interface.h
index 94ef11ba5c29d40f40e3755cafd16f2837252cfc..f824a9a8749b91b59805034d924eff5fd70f7fab 100644
--- a/src/interface.h
+++ b/src/interface.h
@@ -108,18 +108,18 @@ class Interface : public ZoneObject {
if (*ok) Chase()->flags_ |= MODULE;
}
- // Set associated instance object.
- void MakeSingleton(Handle<JSModule> instance, bool* ok) {
- *ok = IsModule() && Chase()->instance_.is_null();
- if (*ok) Chase()->instance_ = instance;
- }
-
// Do not allow any further refinements, directly or through unification.
void Freeze(bool* ok) {
*ok = IsValue() || IsModule();
if (*ok) Chase()->flags_ |= FROZEN;
}
+ // Assign an index.
+ void Allocate(int index) {
+ ASSERT(IsModule() && IsFrozen() && Chase()->index_ == -1);
+ Chase()->index_ = index;
+ }
+
// ---------------------------------------------------------------------------
// Accessors.
@@ -138,7 +138,23 @@ class Interface : public ZoneObject {
// Check whether this is closed (i.e. fully determined).
bool IsFrozen() { return Chase()->flags_ & FROZEN; }
- Handle<JSModule> Instance() { return Chase()->instance_; }
+ bool IsUnified(Interface* that) {
+ return Chase() == that->Chase()
+ || (this->IsValue() == that->IsValue() &&
+ this->IsConst() == that->IsConst());
+ }
+
+ int Length() {
+ ASSERT(IsModule() && IsFrozen());
+ ZoneHashMap* exports = Chase()->exports_;
+ return exports ? exports->occupancy() : 0;
+ }
+
+ // The context slot in the hosting global context pointing to this module.
+ int Index() {
+ ASSERT(IsModule() && IsFrozen());
+ return Chase()->index_;
+ }
// Look up an exported name. Returns NULL if not (yet) defined.
Interface* Lookup(Handle<String> name, Zone* zone);
@@ -194,12 +210,13 @@ class Interface : public ZoneObject {
int flags_;
Interface* forward_; // Unification link
ZoneHashMap* exports_; // Module exports and their types (allocated lazily)
- Handle<JSModule> instance_;
+ int index_;
explicit Interface(int flags)
: flags_(flags),
forward_(NULL),
- exports_(NULL) {
+ exports_(NULL),
+ index_(-1) {
#ifdef DEBUG
if (FLAG_print_interface_details)
PrintF("# Creating %p\n", static_cast<void*>(this));
« no previous file with comments | « src/ia32/macro-assembler-ia32.h ('k') | src/interface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698