Commit 8091bedc authored by darin's avatar darin

- another hash table fix; yields a 2% improvement on iBench JavaScript

        * kjs/property_map.cpp: A few more places where we use & instead of %.

	- some List changes that don't affect speed yet

        * kjs/types.cpp:
        (List::prependList): Tighten up a tiny bit.
        (List::copy): Use prependList.
        * kjs/types.h: Remove appendList and globalClear.

        * kjs/interpreter.cpp: (Interpreter::finalCheck): Remove List::globalClear().


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2757 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 8943db9c
2002-11-19 Darin Adler <darin@apple.com>
- another hash table fix; yields a 2% improvement on iBench JavaScript
* kjs/property_map.cpp: A few more places where we use & instead of %.
- some List changes that don't affect speed yet
* kjs/types.cpp:
(List::prependList): Tighten up a tiny bit.
(List::copy): Use prependList.
* kjs/types.h: Remove appendList and globalClear.
* kjs/interpreter.cpp: (Interpreter::finalCheck): Remove List::globalClear().
2002-11-19 Darin Adler <darin@apple.com>
- fixed 3105026 -- REGRESSION: DHTML menus are broken all over the place
......
2002-11-19 Darin Adler <darin@apple.com>
- another hash table fix; yields a 2% improvement on iBench JavaScript
* kjs/property_map.cpp: A few more places where we use & instead of %.
- some List changes that don't affect speed yet
* kjs/types.cpp:
(List::prependList): Tighten up a tiny bit.
(List::copy): Use prependList.
* kjs/types.h: Remove appendList and globalClear.
* kjs/interpreter.cpp: (Interpreter::finalCheck): Remove List::globalClear().
2002-11-19 Darin Adler <darin@apple.com>
- fixed 3105026 -- REGRESSION: DHTML menus are broken all over the place
......
2002-11-19 Darin Adler <darin@apple.com>
- another hash table fix; yields a 2% improvement on iBench JavaScript
* kjs/property_map.cpp: A few more places where we use & instead of %.
- some List changes that don't affect speed yet
* kjs/types.cpp:
(List::prependList): Tighten up a tiny bit.
(List::copy): Use prependList.
* kjs/types.h: Remove appendList and globalClear.
* kjs/interpreter.cpp: (Interpreter::finalCheck): Remove List::globalClear().
2002-11-19 Darin Adler <darin@apple.com>
- fixed 3105026 -- REGRESSION: DHTML menus are broken all over the place
......
......@@ -312,7 +312,6 @@ void Interpreter::finalCheck()
Node::finalCheck();
Collector::finalCheck();
Lexer::globalClear();
List::globalClear();
UString::globalClear();
}
#endif
......
......@@ -110,7 +110,7 @@ ValueImp *PropertyMap::get(const UString &name, int &attributes) const
attributes = _table[i].attributes;
return _table[i].value;
}
i = (i + 1) % _tableSize;
i = (i + 1) & _tableSizeHashMask;
}
return 0;
}
......@@ -128,7 +128,7 @@ ValueImp *PropertyMap::get(const UString &name) const
while (UString::Rep *key = _table[i].key) {
if (keysMatch(name.rep, key))
return _table[i].value;
i = (i + 1) % _tableSize;
i = (i + 1) & _tableSizeHashMask;
}
return 0;
}
......@@ -152,7 +152,7 @@ void PropertyMap::put(const UString &name, ValueImp *value, int attributes)
}
}
if (_keyCount >= _tableSize / 2)
if (_keyCount * 2 >= _tableSize)
expand();
int i = hash(name.rep);
......@@ -163,7 +163,7 @@ void PropertyMap::put(const UString &name, ValueImp *value, int attributes)
// Attributes are intentionally not updated.
return;
}
i = (i + 1) % _tableSize;
i = (i + 1) & _tableSizeHashMask;
}
// Create a new hash table entry.
......@@ -178,7 +178,7 @@ inline void PropertyMap::insert(UString::Rep *key, ValueImp *value, int attribut
{
int i = hash(key);
while (_table[i].key)
i = (i + 1) % _tableSize;
i = (i + 1) & _tableSizeHashMask;
_table[i].key = key;
_table[i].value = value;
......@@ -228,7 +228,7 @@ void PropertyMap::remove(const UString &name)
while ((key = _table[i].key)) {
if (keysMatch(name.rep, key))
break;
i = (i + 1) % _tableSize;
i = (i + 1) & _tableSizeHashMask;
}
if (!key)
return;
......@@ -240,7 +240,7 @@ void PropertyMap::remove(const UString &name)
// Reinsert all the items to the right in the same cluster.
while (1) {
i = (i + 1) % _tableSize;
i = (i + 1) & _tableSizeHashMask;
key = _table[i].key;
if (!key)
break;
......
......@@ -193,23 +193,13 @@ void List::prepend(ValueImp *val)
hook->next = n;
}
void List::appendList(const List& lst)
{
ListNode *otherHook = lst.hook;
ListNode *o = otherHook->next;
while (o != otherHook) {
append(o->member);
o = o->next;
}
}
void List::prependList(const List& lst)
{
ListNode *otherHook = lst.hook;
ListNode *o = otherHook->prev;
while (o != otherHook) {
prepend(o->member);
o = o->prev;
ListNode *n = otherHook->prev;
while (n != otherHook) {
prepend(n->member);
n = n->prev;
}
}
......@@ -237,7 +227,6 @@ void List::remove(const Value &val)
}
}
void List::clear()
{
if (!m_needsMarking) {
......@@ -261,7 +250,7 @@ void List::clearInternal()
List List::copy() const
{
List newList;
newList.appendList(*this);
newList.prependList(*this);
return newList;
}
......@@ -314,7 +303,6 @@ const List &List::empty()
return l;
}
void List::erase(ListNode *n)
{
if (n != hook) {
......@@ -361,10 +349,3 @@ void List::swap(List &other)
hook = other.hook;
other.hook = tmp;
}
#ifdef KJS_DEBUG_MEM
void List::globalClear()
{
}
#endif
......@@ -121,10 +121,6 @@ namespace KJS {
*/
void prepend(const Value& val);
void prepend(ValueImp *val);
/**
* Appends the items of another list at the end of this one.
*/
void appendList(const List& lst);
/**
* Prepend the items of another list to this one.
* The first item of @p lst will become the first item of the list.
......@@ -187,9 +183,6 @@ namespace KJS {
* function has a @ref KJS::List parameter.
*/
static const List &empty();
#ifdef KJS_DEBUG_MEM
static void globalClear();
#endif
void mark();
private:
......@@ -198,7 +191,7 @@ namespace KJS {
void refAll();
void derefAll();
void swap(List &other);
ListHookNode *hook;
bool m_needsMarking;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment