Title: [98495] trunk/Source
- Revision
- 98495
- Author
- msab...@apple.com
- Date
- 2011-10-26 10:12:13 -0700 (Wed, 26 Oct 2011)
Log Message
Increase StringImpl Flag Bits for 8 bit Strings
https://bugs.webkit.org/show_bug.cgi?id=70937
Increased the number of bits used for flags in StringImpl
from 6 to 8 bits. This frees up 2 flag bits that will be
used for 8-bit string support. Updated hash methods accordingly.
Changed hash value masking from the low bits to the high
bits.
Reviewed by Darin Adler.
Source/_javascript_Core:
* create_hash_table:
* wtf/StringHasher.h:
(WTF::StringHasher::hash):
* wtf/text/StringImpl.h:
Source/WebCore:
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateHashValue):
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (98494 => 98495)
--- trunk/Source/_javascript_Core/ChangeLog 2011-10-26 17:06:03 UTC (rev 98494)
+++ trunk/Source/_javascript_Core/ChangeLog 2011-10-26 17:12:13 UTC (rev 98495)
@@ -1,3 +1,21 @@
+2011-10-26 Michael Saboff <msab...@apple.com>
+
+ Increase StringImpl Flag Bits for 8 bit Strings
+ https://bugs.webkit.org/show_bug.cgi?id=70937
+
+ Increased the number of bits used for flags in StringImpl
+ from 6 to 8 bits. This frees up 2 flag bits that will be
+ used for 8-bit string support. Updated hash methods accordingly.
+ Changed hash value masking from the low bits to the high
+ bits.
+
+ Reviewed by Darin Adler.
+
+ * create_hash_table:
+ * wtf/StringHasher.h:
+ (WTF::StringHasher::hash):
+ * wtf/text/StringImpl.h:
+
2011-10-26 Dan Bernstein <m...@apple.com>
Build fix.
Modified: trunk/Source/_javascript_Core/create_hash_table (98494 => 98495)
--- trunk/Source/_javascript_Core/create_hash_table 2011-10-26 17:06:03 UTC (rev 98494)
+++ trunk/Source/_javascript_Core/create_hash_table 2011-10-26 17:12:13 UTC (rev 98495)
@@ -221,14 +221,14 @@
$hash = $hash% $EXP2_32;
$hash ^= (leftShift($hash, 10)% $EXP2_32);
- # Save 6 bits for StringImpl to use as flags.
- $hash = ($hash >> 6);
+ # Save 8 bits for StringImpl to use as flags.
+ $hash &= 0xffffff;
# This avoids ever returning a hash code of 0, since that is used to
# signal "hash not computed yet". Setting the high bit maintains
# reasonable fidelity to a hash code of 0 because it is likely to yield
# exactly 0 when hash lookup masks out the high bits.
- $hash = (0x80000000 >> 6) if ($hash == 0);
+ $hash = (0x80000000 >> 8) if ($hash == 0);
return $hash;
}
Modified: trunk/Source/_javascript_Core/wtf/StringHasher.h (98494 => 98495)
--- trunk/Source/_javascript_Core/wtf/StringHasher.h 2011-10-26 17:06:03 UTC (rev 98494)
+++ trunk/Source/_javascript_Core/wtf/StringHasher.h 2011-10-26 17:12:13 UTC (rev 98495)
@@ -36,7 +36,7 @@
// _javascript_Core and the CodeGeneratorJS.pm script in WebCore.
class StringHasher {
public:
- static const unsigned flagCount = 6; // Save 6 bits for StringImpl to use as flags.
+ static const unsigned flagCount = 8; // Save 8 bits for StringImpl to use as flags.
inline StringHasher()
: m_hash(stringHashingStartValue)
@@ -81,9 +81,9 @@
result += result >> 15;
result ^= result << 10;
- // Reserving the high bits for flags preserves most of the hash's value,
- // since hash lookup typically masks out the high bits anyway.
- result >>= flagCount;
+ // Reserving space from the high bits for flags preserves most of the hash's
+ // value, since hash lookup typically masks out the high bits anyway.
+ result &= (1u << (sizeof(result) * 8 - flagCount)) - 1;
// This avoids ever returning a hash code of 0, since that is used to
// signal "hash not computed yet". Setting the high bit maintains
Modified: trunk/Source/_javascript_Core/wtf/text/StringImpl.h (98494 => 98495)
--- trunk/Source/_javascript_Core/wtf/text/StringImpl.h 2011-10-26 17:06:03 UTC (rev 98494)
+++ trunk/Source/_javascript_Core/wtf/text/StringImpl.h 2011-10-26 17:12:13 UTC (rev 98495)
@@ -381,8 +381,8 @@
static const unsigned s_refCountFlagIsStaticString = 0x1;
static const unsigned s_refCountIncrement = 0x2; // This allows us to ref / deref without disturbing the static string flag.
- // The bottom 6 bits in the hash are flags.
- static const unsigned s_flagCount = 6;
+ // The bottom 8 bits in the hash are flags.
+ static const unsigned s_flagCount = 8;
static const unsigned s_flagMask = (1u << s_flagCount) - 1;
COMPILE_ASSERT(s_flagCount == StringHasher::flagCount, StringHasher_reserves_enough_bits_for_StringImpl_flags);
Modified: trunk/Source/WebCore/ChangeLog (98494 => 98495)
--- trunk/Source/WebCore/ChangeLog 2011-10-26 17:06:03 UTC (rev 98494)
+++ trunk/Source/WebCore/ChangeLog 2011-10-26 17:12:13 UTC (rev 98495)
@@ -1,3 +1,19 @@
+2011-10-26 Michael Saboff <msab...@apple.com>
+
+ Increase StringImpl Flag Bits for 8 bit Strings
+ https://bugs.webkit.org/show_bug.cgi?id=70937
+
+ Increased the number of bits used for flags in StringImpl
+ from 6 to 8 bits. This frees up 2 flag bits that will be
+ used for 8-bit string support. Updated hash methods accordingly.
+ Changed hash value masking from the low bits to the high
+ bits.
+
+ Reviewed by Darin Adler.
+
+ * bindings/scripts/CodeGeneratorJS.pm:
+ (GenerateHashValue):
+
2011-10-26 Dimitri Glazkov <dglaz...@chromium.org>
REGRESSION (r94887): Scrolling the HTML spec is more jerky now than it was (regression)
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (98494 => 98495)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2011-10-26 17:06:03 UTC (rev 98494)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2011-10-26 17:12:13 UTC (rev 98495)
@@ -3068,14 +3068,14 @@
$hash = $hash% $EXP2_32;
$hash ^= (leftShift($hash, 10)% $EXP2_32);
- # Save 6 bits for StringImpl to use as flags.
- $hash = ($hash >> 6);
+ # Save 8 bits for StringImpl to use as flags.
+ $hash &= 0xffffff;
# This avoids ever returning a hash code of 0, since that is used to
# signal "hash not computed yet". Setting the high bit maintains
# reasonable fidelity to a hash code of 0 because it is likely to yield
# exactly 0 when hash lookup masks out the high bits.
- $hash = (0x80000000 >> 6) if ($hash == 0);
+ $hash = (0x80000000 >> 8) if ($hash == 0);
return $hash;
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes