[webkit-changes] cvs commit: JavaScriptCore/kjs object.h
property_map.cpp property_map.h
Darin
darin at opensource.apple.com
Sun Aug 14 09:27:13 PDT 2005
darin 05/08/14 09:27:13
Modified: . ChangeLog
kjs object.h property_map.cpp property_map.h
Log:
Reviewed by Maciej.
- fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4417
speed up JavaScript with some small changes to the property map code
my measurements show an improvement of 2% on iBench JavaScript
* kjs/property_map.h: (KJS::PropertyMap::PropertyMap): Made the default constructor inline.
* kjs/property_map.cpp:
(KJS::PropertyMap::~PropertyMap): Changed loop to exit early once we know we've processed
all the hash table entries, based on the count.
(KJS::PropertyMap::mark): Ditto.
* kjs/object.h: Made an arbitrary change here to force recompiling so we pick up changes to
property_map.h. Works around what seems to be an Xcode header dependency bug.
Revision Changes Path
1.794 +19 -1 JavaScriptCore/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/root/JavaScriptCore/ChangeLog,v
retrieving revision 1.793
retrieving revision 1.794
diff -u -r1.793 -r1.794
--- ChangeLog 14 Aug 2005 16:17:09 -0000 1.793
+++ ChangeLog 14 Aug 2005 16:27:12 -0000 1.794
@@ -2,10 +2,28 @@
Reviewed by Maciej.
+ - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4417
+ speed up JavaScript with some small changes to the property map code
+
+ my measurements show an improvement of 2% on iBench JavaScript
+
+ * kjs/property_map.h: (KJS::PropertyMap::PropertyMap): Made the default constructor inline.
+ * kjs/property_map.cpp:
+ (KJS::PropertyMap::~PropertyMap): Changed loop to exit early once we know we've processed
+ all the hash table entries, based on the count.
+ (KJS::PropertyMap::mark): Ditto.
+
+ * kjs/object.h: Made an arbitrary change here to force recompiling so we pick up changes to
+ property_map.h. Works around what seems to be an Xcode header dependency bug.
+
+2005-08-14 Darin Adler <darin at apple.com>
+
+ Reviewed by Maciej.
+
- fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4416
speed up JavaScript with some improvements to the garbage collector
- seems to give about 2% on iBench JavaScript
+ my measurements show an improvement of 2% on iBench JavaScript
* kjs/collector.cpp:
(KJS::Collector::allocate): Use local variables to shadow globals instead of repeatedly
1.44 +4 -2 JavaScriptCore/kjs/object.h
Index: object.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/object.h,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- object.h 14 Aug 2005 16:04:19 -0000 1.43
+++ object.h 14 Aug 2005 16:27:13 -0000 1.44
@@ -616,8 +616,10 @@
static const char * const * const errorNames;
};
- inline bool AllocatedValueImp::isObject(const ClassInfo *info) const
- { return isObject() && static_cast<const ObjectImp *>(this)->inherits(info); }
+inline bool AllocatedValueImp::isObject(const ClassInfo *info) const
+{
+ return isObject() && static_cast<const ObjectImp *>(this)->inherits(info);
+}
inline ObjectImp::ObjectImp(ObjectImp *proto)
: _proto(proto), _internalValue(0)
1.46 +12 -10 JavaScriptCore/kjs/property_map.cpp
Index: property_map.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/property_map.cpp,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -r1.45 -r1.46
--- property_map.cpp 8 Aug 2005 04:07:29 -0000 1.45
+++ property_map.cpp 14 Aug 2005 16:27:13 -0000 1.46
@@ -102,10 +102,6 @@
// Algorithm concepts from Algorithms in C++, Sedgewick.
-PropertyMap::PropertyMap() : _table(0)
-{
-}
-
PropertyMap::~PropertyMap()
{
if (!_table) {
@@ -117,12 +113,14 @@
return;
}
- int size = _table->size;
+ int minimumKeysToProcess = _table->keyCount + _table->sentinelCount;
Entry *entries = _table->entries;
- for (int i = 0; i < size; i++) {
+ for (int i = 0; i < minimumKeysToProcess; i++) {
UString::Rep *key = entries[i].key;
if (key)
key->deref();
+ else
+ ++minimumKeysToProcess;
}
kjs_fast_free(_table);
}
@@ -543,12 +541,16 @@
return;
}
- int size = _table->size;
+ int minimumKeysToProcess = _table->keyCount + _table->sentinelCount;
Entry *entries = _table->entries;
- for (int i = 0; i < size; i++) {
+ for (int i = 0; i < minimumKeysToProcess; i++) {
ValueImp *v = entries[i].value;
- if (v && !v->marked())
- v->mark();
+ if (v) {
+ if (!v->marked())
+ v->mark();
+ } else {
+ ++minimumKeysToProcess;
+ }
}
}
1.24 +4 -0 JavaScriptCore/kjs/property_map.h
Index: property_map.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/property_map.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- property_map.h 8 Aug 2005 04:07:29 -0000 1.23
+++ property_map.h 14 Aug 2005 16:27:13 -0000 1.24
@@ -105,6 +105,10 @@
Entry _singleEntry;
};
+inline PropertyMap::PropertyMap() : _table(NULL)
+{
+}
+
} // namespace
#endif // _KJS_PROPERTY_MAP_H_
More information about the webkit-changes
mailing list