Changeset 98495 in webkit
- Timestamp:
- Oct 26, 2011, 10:12:13 AM (15 years ago)
- Location:
- trunk/Source
- Files:
-
- 6 edited
-
JavaScriptCore/ChangeLog (modified) (1 diff)
-
JavaScriptCore/create_hash_table (modified) (2 diffs)
-
JavaScriptCore/wtf/StringHasher.h (modified) (2 diffs)
-
JavaScriptCore/wtf/text/StringImpl.h (modified) (1 diff)
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/bindings/scripts/CodeGeneratorJS.pm (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r98491 r98495 1 2011-10-26 Michael Saboff <msaboff@apple.com> 2 3 Increase StringImpl Flag Bits for 8 bit Strings 4 https://bugs.webkit.org/show_bug.cgi?id=70937 5 6 Increased the number of bits used for flags in StringImpl 7 from 6 to 8 bits. This frees up 2 flag bits that will be 8 used for 8-bit string support. Updated hash methods accordingly. 9 Changed hash value masking from the low bits to the high 10 bits. 11 12 Reviewed by Darin Adler. 13 14 * create_hash_table: 15 * wtf/StringHasher.h: 16 (WTF::StringHasher::hash): 17 * wtf/text/StringImpl.h: 18 1 19 2011-10-26 Dan Bernstein <mitz@apple.com> 2 20 -
trunk/Source/JavaScriptCore/create_hash_table
r98491 r98495 222 222 $hash ^= (leftShift($hash, 10)% $EXP2_32); 223 223 224 # Save 6bits for StringImpl to use as flags.225 $hash = ($hash >> 6);224 # Save 8 bits for StringImpl to use as flags. 225 $hash &= 0xffffff; 226 226 227 227 # This avoids ever returning a hash code of 0, since that is used to … … 229 229 # reasonable fidelity to a hash code of 0 because it is likely to yield 230 230 # exactly 0 when hash lookup masks out the high bits. 231 $hash = (0x80000000 >> 6) if ($hash == 0);231 $hash = (0x80000000 >> 8) if ($hash == 0); 232 232 233 233 return $hash; -
trunk/Source/JavaScriptCore/wtf/StringHasher.h
r98217 r98495 37 37 class StringHasher { 38 38 public: 39 static const unsigned flagCount = 6; // Save 6bits for StringImpl to use as flags.39 static const unsigned flagCount = 8; // Save 8 bits for StringImpl to use as flags. 40 40 41 41 inline StringHasher() … … 82 82 result ^= result << 10; 83 83 84 // Reserving the high bits for flags preserves most of the hash's value,85 // since hash lookup typically masks out the high bits anyway.86 result >>= flagCount;84 // Reserving space from the high bits for flags preserves most of the hash's 85 // value, since hash lookup typically masks out the high bits anyway. 86 result &= (1u << (sizeof(result) * 8 - flagCount)) - 1; 87 87 88 88 // This avoids ever returning a hash code of 0, since that is used to -
trunk/Source/JavaScriptCore/wtf/text/StringImpl.h
r98316 r98495 382 382 static const unsigned s_refCountIncrement = 0x2; // This allows us to ref / deref without disturbing the static string flag. 383 383 384 // The bottom 6bits in the hash are flags.385 static const unsigned s_flagCount = 6;384 // The bottom 8 bits in the hash are flags. 385 static const unsigned s_flagCount = 8; 386 386 static const unsigned s_flagMask = (1u << s_flagCount) - 1; 387 387 COMPILE_ASSERT(s_flagCount == StringHasher::flagCount, StringHasher_reserves_enough_bits_for_StringImpl_flags); -
trunk/Source/WebCore/ChangeLog
r98492 r98495 1 2011-10-26 Michael Saboff <msaboff@apple.com> 2 3 Increase StringImpl Flag Bits for 8 bit Strings 4 https://bugs.webkit.org/show_bug.cgi?id=70937 5 6 Increased the number of bits used for flags in StringImpl 7 from 6 to 8 bits. This frees up 2 flag bits that will be 8 used for 8-bit string support. Updated hash methods accordingly. 9 Changed hash value masking from the low bits to the high 10 bits. 11 12 Reviewed by Darin Adler. 13 14 * bindings/scripts/CodeGeneratorJS.pm: 15 (GenerateHashValue): 16 1 17 2011-10-26 Dimitri Glazkov <dglazkov@chromium.org> 2 18 -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
r98434 r98495 3069 3069 $hash ^= (leftShift($hash, 10)% $EXP2_32); 3070 3070 3071 # Save 6bits for StringImpl to use as flags.3072 $hash = ($hash >> 6);3071 # Save 8 bits for StringImpl to use as flags. 3072 $hash &= 0xffffff; 3073 3073 3074 3074 # This avoids ever returning a hash code of 0, since that is used to … … 3076 3076 # reasonable fidelity to a hash code of 0 because it is likely to yield 3077 3077 # exactly 0 when hash lookup masks out the high bits. 3078 $hash = (0x80000000 >> 6) if ($hash == 0);3078 $hash = (0x80000000 >> 8) if ($hash == 0); 3079 3079 3080 3080 return $hash;
Note:
See TracChangeset
for help on using the changeset viewer.