Bug 1038038 - Part 1: Reduce ShapeTable::MIN_SIZE_LOG2. r=bhackett, a=2.0+
authorNicholas Nethercote <nnethercote@mozilla.com>
Sun, 13 Jul 2014 23:27:44 -0700
changeset 208026 e12c32a65348691eb88f4f5ca88127eb0b8ffa24
parent 208025 e52bc38eac66a423c73649981f134d8fd6b2c36a
child 208027 d94467fc9adee8f45a1b5e1cdbd127b1e2924450
push id3741
push userasasaki@mozilla.com
push dateMon, 21 Jul 2014 20:25:18 +0000
treeherdermozilla-beta@4d6f46f5af68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbhackett, 2
bugs1038038
milestone32.0a2
Bug 1038038 - Part 1: Reduce ShapeTable::MIN_SIZE_LOG2. r=bhackett, a=2.0+ An entryCount of zero is common, due to initBoundFunction(), so it's worth choosing a value that doesn't waste too much space in that case.
js/src/vm/Shape.h
--- a/js/src/vm/Shape.h
+++ b/js/src/vm/Shape.h
@@ -121,17 +121,20 @@ static const uint32_t SHAPE_MAXIMUM_SLOT
 
 /*
  * Shapes use multiplicative hashing, but specialized to
  * minimize footprint.
  */
 struct ShapeTable {
     static const uint32_t HASH_BITS     = mozilla::tl::BitSize<HashNumber>::value;
     static const uint32_t MIN_ENTRIES   = 7;
-    static const uint32_t MIN_SIZE_LOG2 = 4;
+
+    // This value is low because it's common for a ShapeTable to be created
+    // with an entryCount of zero.
+    static const uint32_t MIN_SIZE_LOG2 = 2;
     static const uint32_t MIN_SIZE      = JS_BIT(MIN_SIZE_LOG2);
 
     int             hashShift;          /* multiplicative hash shift */
 
     uint32_t        entryCount;         /* number of entries in table */
     uint32_t        removedCount;       /* removed entry sentinels in table */
     uint32_t        freelist;           /* SHAPE_INVALID_SLOT or head of slot
                                            freelist in owning dictionary-mode