Title: [165440] trunk/Source/_javascript_Core
- Revision
- 165440
- Author
- [email protected]
- Date
- 2014-03-11 02:35:55 -0700 (Tue, 11 Mar 2014)
Log Message
Streamline PropertyTable for lookup-only access.
<https://webkit.org/b/130060>
The PropertyTable lookup algorithm was written to support both read
and write access. This wasn't actually needed in most places.
This change adds a PropertyTable::get() that just returns the value
type (instead of an insertion iterator.) It also adds an early return
for empty tables.
Finally, up the minimum table capacity from 8 to 16. It was lowered
to 8 in order to save memory, but that was before PropertyTables were
GC allocated. Nowadays we don't have nearly as many tables, since all
the unpinned transitions die off.
Reviewed by Darin Adler.
* runtime/PropertyMapHashTable.h:
(JSC::PropertyTable::get):
* runtime/Structure.cpp:
(JSC::Structure::despecifyDictionaryFunction):
(JSC::Structure::attributeChangeTransition):
(JSC::Structure::get):
(JSC::Structure::despecifyFunction):
* runtime/StructureInlines.h:
(JSC::Structure::get):
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (165439 => 165440)
--- trunk/Source/_javascript_Core/ChangeLog 2014-03-11 09:14:22 UTC (rev 165439)
+++ trunk/Source/_javascript_Core/ChangeLog 2014-03-11 09:35:55 UTC (rev 165440)
@@ -1,3 +1,32 @@
+2014-03-11 Andreas Kling <[email protected]>
+
+ Streamline PropertyTable for lookup-only access.
+ <https://webkit.org/b/130060>
+
+ The PropertyTable lookup algorithm was written to support both read
+ and write access. This wasn't actually needed in most places.
+
+ This change adds a PropertyTable::get() that just returns the value
+ type (instead of an insertion iterator.) It also adds an early return
+ for empty tables.
+
+ Finally, up the minimum table capacity from 8 to 16. It was lowered
+ to 8 in order to save memory, but that was before PropertyTables were
+ GC allocated. Nowadays we don't have nearly as many tables, since all
+ the unpinned transitions die off.
+
+ Reviewed by Darin Adler.
+
+ * runtime/PropertyMapHashTable.h:
+ (JSC::PropertyTable::get):
+ * runtime/Structure.cpp:
+ (JSC::Structure::despecifyDictionaryFunction):
+ (JSC::Structure::attributeChangeTransition):
+ (JSC::Structure::get):
+ (JSC::Structure::despecifyFunction):
+ * runtime/StructureInlines.h:
+ (JSC::Structure::get):
+
2014-03-10 Mark Hahnenberg <[email protected]>
REGRESSION(r165407): DoYouEvenBench crashes in DRT
Modified: trunk/Source/_javascript_Core/runtime/PropertyMapHashTable.h (165439 => 165440)
--- trunk/Source/_javascript_Core/runtime/PropertyMapHashTable.h 2014-03-11 09:14:22 UTC (rev 165439)
+++ trunk/Source/_javascript_Core/runtime/PropertyMapHashTable.h 2014-03-11 09:35:55 UTC (rev 165440)
@@ -170,6 +170,7 @@
// Find a value in the table.
find_iterator find(const KeyType&);
find_iterator findWithString(const KeyType&);
+ ValueType* get(const KeyType&);
// Add a value to the table
enum EffectOnPropertyOffset { PropertyOffsetMayChange, PropertyOffsetMustNotChange };
std::pair<find_iterator, bool> add(const ValueType& entry, PropertyOffset&, EffectOnPropertyOffset);
@@ -256,7 +257,7 @@
unsigned m_deletedCount;
OwnPtr< Vector<PropertyOffset>> m_deletedOffsets;
- static const unsigned MinimumTableSize = 8;
+ static const unsigned MinimumTableSize = 16;
static const unsigned EmptyEntryIndex = 0;
};
@@ -312,6 +313,42 @@
}
}
+inline PropertyTable::ValueType* PropertyTable::get(const KeyType& key)
+{
+ ASSERT(key);
+ ASSERT(key->isIdentifier() || key->isEmptyUnique());
+
+ if (!m_keyCount)
+ return nullptr;
+
+ unsigned hash = key->existingHash();
+ unsigned step = 0;
+
+#if DUMP_PROPERTYMAP_STATS
+ ++numProbes;
+#endif
+
+ while (true) {
+ unsigned entryIndex = m_index[hash & m_indexMask];
+ if (entryIndex == EmptyEntryIndex)
+ return nullptr;
+ if (key == table()[entryIndex - 1].key)
+ return &table()[entryIndex - 1];
+
+#if DUMP_PROPERTYMAP_STATS
+ ++numCollisions;
+#endif
+
+ if (!step)
+ step = WTF::doubleHash(key->existingHash()) | 1;
+ hash += step;
+
+#if DUMP_PROPERTYMAP_STATS
+ ++numRehashes;
+#endif
+ }
+}
+
inline PropertyTable::find_iterator PropertyTable::findWithString(const KeyType& key)
{
ASSERT(key);
Modified: trunk/Source/_javascript_Core/runtime/Structure.cpp (165439 => 165440)
--- trunk/Source/_javascript_Core/runtime/Structure.cpp 2014-03-11 09:14:22 UTC (rev 165439)
+++ trunk/Source/_javascript_Core/runtime/Structure.cpp 2014-03-11 09:35:55 UTC (rev 165440)
@@ -339,7 +339,7 @@
ASSERT(isDictionary());
ASSERT(propertyTable());
- PropertyMapEntry* entry = propertyTable()->find(rep).first;
+ PropertyMapEntry* entry = propertyTable()->get(rep);
ASSERT(entry);
entry->specificValue.clear();
}
@@ -521,7 +521,7 @@
}
ASSERT(structure->propertyTable());
- PropertyMapEntry* entry = structure->propertyTable()->find(propertyName.uid()).first;
+ PropertyMapEntry* entry = structure->propertyTable()->get(propertyName.uid());
ASSERT(entry);
entry->attributes = attributes;
@@ -850,7 +850,7 @@
findStructuresAndMapForMaterialization(structures, structure, table);
if (table) {
- PropertyMapEntry* entry = table->find(uid).first;
+ PropertyMapEntry* entry = table->get(uid);
if (entry) {
attributes = entry->attributes;
specificValue = entry->specificValue.get();
@@ -884,7 +884,7 @@
if (!propertyTable())
return invalidOffset;
- PropertyMapEntry* entry = propertyTable()->find(propertyName.uid()).first;
+ PropertyMapEntry* entry = propertyTable()->get(propertyName.uid());
if (!entry)
return invalidOffset;
@@ -900,7 +900,7 @@
if (!propertyTable())
return false;
- PropertyMapEntry* entry = propertyTable()->find(propertyName.uid()).first;
+ PropertyMapEntry* entry = propertyTable()->get(propertyName.uid());
if (!entry)
return false;
Modified: trunk/Source/_javascript_Core/runtime/StructureInlines.h (165439 => 165440)
--- trunk/Source/_javascript_Core/runtime/StructureInlines.h 2014-03-11 09:14:22 UTC (rev 165439)
+++ trunk/Source/_javascript_Core/runtime/StructureInlines.h 2014-03-11 09:35:55 UTC (rev 165440)
@@ -82,7 +82,7 @@
if (!propertyTable())
return invalidOffset;
- PropertyMapEntry* entry = propertyTable()->find(propertyName.uid()).first;
+ PropertyMapEntry* entry = propertyTable()->get(propertyName.uid());
return entry ? entry->offset : invalidOffset;
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes