Separated string lifetime bits from character buffer state bits
authorggaren@apple.com <ggaren@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 23 Oct 2011 07:21:19 +0000 (07:21 +0000)
committerggaren@apple.com <ggaren@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 23 Oct 2011 07:21:19 +0000 (07:21 +0000)
commita33d20e86f2c8743705e648d0f5276d02c42b4dd
tree71c8f297d4487d2fab051af62bff0df83ac8a001
parent6e4353cf4ffc7d19f3c4524b9bc7077bb7215186
Separated string lifetime bits from character buffer state bits
https://bugs.webkit.org/show_bug.cgi?id=70673

Source/JavaScriptCore:

Reviewed by Anders Carlsson.

Moved the static/immortal bit into the bottom bit of the refcount, and
moved all other bits into the high bits of the hash code.

This is the first step toward a new Characters/PassString class, and it
makes ref/deref slightly more efficient.

* create_hash_table:
* wtf/StringHasher.h:
(WTF::StringHasher::hash): Tweaked the string hashing function to leave
the top bits clear, so they can be used as flags.

Fixed some small differences between the PERL copy of this function and
the C++ copy of this function, which could have in theory caused subtle
crashes.

* wtf/text/StringImpl.cpp:
(WTF::StringImpl::sharedBuffer):
(WTF::StringImpl::createWithTerminatingNullCharacter):
* wtf/text/StringImpl.h:
(WTF::StringImpl::StringImpl):
(WTF::StringImpl::cost): Renamed s_refCountFlagShouldReportedCost to
s_didReportExtraCost, since the original name was both self-contradictory
and used as a double-negative.

(WTF::StringImpl::isIdentifier):
(WTF::StringImpl::setIsIdentifier):
(WTF::StringImpl::hasTerminatingNullCharacter):
(WTF::StringImpl::isAtomic):
(WTF::StringImpl::setIsAtomic):
(WTF::StringImpl::setHash):
(WTF::StringImpl::rawHash):
(WTF::StringImpl::hasHash):
(WTF::StringImpl::existingHash):
(WTF::StringImpl::hash):
(WTF::StringImpl::hasOneRef):
(WTF::StringImpl::ref):
(WTF::StringImpl::deref):
(WTF::StringImpl::bufferOwnership):
(WTF::StringImpl::isStatic): Moved the static/immortal bit into the bottom
bit of the refcount. Now, all lifetime information lives in the refcount
field. Moved the other bits into the hash code field.

Source/WebCore:

Reviewed by Anders Carlsson.

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateHashValue): Updated for string hashing changes in JavaScriptCore.

LayoutTests:

Reviewed by Anders Carlsson.

These tests depended on non-deterministic effects of hash order, so I
had to update them:

* fast/dom/prototype-inheritance-2-expected.txt: Updated for slightly
different order of discovering properties.

* fast/js/delete-syntax-expected.txt:
* fast/js/script-tests/delete-syntax.js: Updated not to depend on iteration
order, since that's not what this test is about.

* http/tests/inspector/inspector-test.js: Updated not to depend on
global function iteration order. This test setup is pretty spaghetti.
I think I avoided making it even more spaghetti.

* inspector/storage-panel-dom-storage-expected.txt: Updated for changed
iteration order.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@98199 268f45cc-cd09-0410-ab3c-d52691b4dbfc
13 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/dom/prototype-inheritance-2-expected.txt
LayoutTests/fast/js/delete-syntax-expected.txt
LayoutTests/fast/js/script-tests/delete-syntax.js
LayoutTests/http/tests/inspector/inspector-test.js
LayoutTests/inspector/storage-panel-dom-storage-expected.txt
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/create_hash_table
Source/JavaScriptCore/wtf/StringHasher.h
Source/JavaScriptCore/wtf/text/StringImpl.cpp
Source/JavaScriptCore/wtf/text/StringImpl.h
Source/WebCore/ChangeLog
Source/WebCore/bindings/scripts/CodeGeneratorJS.pm