Completed switch for LocalBinding map to hash table.

This commit is contained in:
rogerl%netscape.com 2003-03-14 23:14:04 +00:00
Родитель 5fbb03ffd6
Коммит 0e9bd4ea45
4 изменённых файлов: 29 добавлений и 13 удалений

Просмотреть файл

@ -245,7 +245,6 @@ namespace JavaScript {
HashTable(uint32 nEntriesDefault = 0, const H &hasher = H()): GenericHashTable(nEntriesDefault), hasher(hasher) {}
~HashTable();
template<class Value> Data &insert(Reference &r, Key key, Value value);
Data &insert(Reference &r, Key key);
Data &insert(Key key);
Data &insert(Data data);
@ -265,9 +264,25 @@ namespace JavaScript {
#ifndef _WIN32
template<class Value> Data &insert(Key key, Value value);
template<class Value> Data &insert(Reference &r, Key key, Value value);
#else
// Microsoft VC6 bug: VC6 doesn't allow this to be defined outside the
// class
template<class Value>
inline Data &insert(Reference &r, Key key, Value value)
{
ASSERT(r.ht == this && !r.entry);
Entry *e = new Entry(r.keyHash, key, value);
*r.backpointer = e;
++nEntries;
maybeGrow();
#ifdef DEBUG
--r.ht->nReferences;
r.ht = 0;
#endif
return e->data;
}
template<class Value> Data &insert(Key key, Value value) {
Reference r(*this, key);
if (r)
@ -275,6 +290,8 @@ namespace JavaScript {
else
return insert(r, key, value);
}
#endif
};

Просмотреть файл

@ -1011,10 +1011,11 @@ namespace MetaData {
{
if (obj->kind == ClassKind) {
JS2Class *c = checked_cast<JS2Class *>(obj);
nameList = new const String *[c->localReadBindings.size()];
nameList = new const String *[c->localBindings.size()];
length = 0;
for (LocalBindingIterator sbi = c->localReadBindings.begin(), end = c->localReadBindings.end(); (sbi != end); sbi++) {
nameList[length++] = &sbi->first;
for (LocalBindingIterator bi = c->localBindings.begin(), bend = c->localBindings.end(); (bi != bend); bi++) {
LocalBindingEntry *lbe = *bi;
nameList[length++] = &lbe->name;
}
}
else {

Просмотреть файл

@ -4402,6 +4402,7 @@ deleteClassProperty:
new_b->xplicit = m->xplicit;
new_e->localBindingList.push_back(NamespaceLocalBinding(ns.first, new_b));
}
return new_e;
}
@ -4908,7 +4909,5 @@ deleteClassProperty:
return released;
}
}; // namespace MetaData
}; // namespace Javascript

Просмотреть файл

@ -492,16 +492,11 @@ public:
};
// for HashTable usage, since we're only distinguishing between id's at that level:
inline bool operator==(const LocalBindingEntry &s1, const LocalBindingEntry &s2) {return s1.name == s2.name;}
inline bool operator!=(const LocalBindingEntry &s1, const LocalBindingEntry &s2) {return s1.name != s2.name;}
// A LocalBindingMap maps names to a list of LocalBindings. Each LocalBinding in the list
// will have the same QualifiedName.name, but (potentially) different QualifiedName.namespace values
typedef HashTable<LocalBindingEntry *, String> LocalBindingMap;
typedef TableIterator<LocalBindingEntry *, String> LocalBindingIterator;
typedef HashTable<LocalBindingEntry *, const String> LocalBindingMap;
typedef TableIterator<LocalBindingEntry *, const String> LocalBindingIterator;
typedef std::multimap<String, InstanceBinding *> InstanceBindingMap;
typedef InstanceBindingMap::iterator InstanceBindingIterator;
@ -1285,6 +1280,10 @@ public:
inline char narrow(char16 ch) { return char(ch); }
}; // namespace MetaData
inline bool operator==(MetaData::LocalBindingEntry *s1, const String &s2) { return s1->name == s2;}
inline bool operator!=(MetaData::LocalBindingEntry *s1, const String &s2) { return s1->name != s2;}
}; // namespace Javascript
#endif