Skip to content
  • ggaren@apple.com's avatar
    Separated string lifetime bits from character buffer state bits · 94ba3306
    ggaren@apple.com authored
    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: http://svn.webkit.org/repository/webkit/trunk@98199 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    94ba3306