Ignore:
Timestamp:
Jan 18, 2010, 11:22:51 PM (15 years ago)
Author:
[email protected]
Message:

Revert r53454, since it causes much sadness in this world.

Patch by Gavin Barraclough <[email protected]> on 2010-01-18
Reviewed by NOBODY (build fix).

  • runtime/UString.cpp:

(JSC::UString::spliceSubstringsWithSeparators):
(JSC::UString::replaceRange):

  • runtime/UStringImpl.cpp:

(JSC::UStringImpl::baseSharedBuffer):
(JSC::UStringImpl::sharedBuffer):
(JSC::UStringImpl::~UStringImpl):

  • runtime/UStringImpl.h:

(JSC::UntypedPtrAndBitfield::UntypedPtrAndBitfield):
(JSC::UntypedPtrAndBitfield::asPtr):
(JSC::UntypedPtrAndBitfield::operator&=):
(JSC::UntypedPtrAndBitfield::operator|=):
(JSC::UntypedPtrAndBitfield::operator&):
(JSC::UStringImpl::create):
(JSC::UStringImpl::cost):
(JSC::UStringImpl::isIdentifier):
(JSC::UStringImpl::setIsIdentifier):
(JSC::UStringImpl::ref):
(JSC::UStringImpl::deref):
(JSC::UStringImpl::checkConsistency):
(JSC::UStringImpl::UStringImpl):
(JSC::UStringImpl::bufferOwnerString):
(JSC::UStringImpl::bufferOwnership):
(JSC::UStringImpl::isStatic):

  • wtf/StringHashFunctions.h:

(WTF::stringHash):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/runtime/UStringImpl.cpp

    r53454 r53456  
    3636namespace JSC {
    3737 
     38SharedUChar* UStringImpl::baseSharedBuffer()
     39{
     40    ASSERT((bufferOwnership() == BufferShared)
     41        || ((bufferOwnership() == BufferOwned) && !m_dataBuffer.asPtr<void*>()));
     42
     43    if (bufferOwnership() != BufferShared)
     44        m_dataBuffer = UntypedPtrAndBitfield(SharedUChar::create(new OwnFastMallocPtr<UChar>(m_data)).releaseRef(), BufferShared);
     45
     46    return m_dataBuffer.asPtr<SharedUChar*>();
     47}
     48
    3849SharedUChar* UStringImpl::sharedBuffer()
    3950{
    40     if (m_length < s_minLengthToShare || isStatic())
     51    if (m_length < s_minLengthToShare)
     52        return 0;
     53    ASSERT(!isStatic());
     54
     55    UStringImpl* owner = bufferOwnerString();
     56    if (owner->bufferOwnership() == BufferInternal)
    4157        return 0;
    4258
    43     switch (bufferOwnership()) {
    44     case BufferInternal:
    45         return 0;
    46     case BufferOwned:
    47         m_bufferShared = SharedUChar::create(new OwnFastMallocPtr<UChar>(m_data)).releaseRef();
    48         m_refCountAndFlags &= ~s_refCountMaskBufferOwnership;
    49         m_refCountAndFlags |= BufferShared;
    50         return m_bufferShared;
    51     case BufferSubstring:
    52         return m_bufferSubstring->sharedBuffer();
    53     case BufferShared:
    54         return m_bufferShared;
    55     }
    56 
    57     ASSERT_NOT_REACHED();
    58     return 0;
     59    return owner->baseSharedBuffer();
    5960}
    6061
     
    6263{
    6364    ASSERT(!isStatic());
     65    checkConsistency();
    6466
    6567    if (isIdentifier())
    6668        Identifier::remove(this);
    6769
    68     switch (bufferOwnership()) {
    69     case BufferInternal:
    70         return;
    71     case BufferOwned:
    72         fastFree(m_data);
    73         return;
    74     case BufferSubstring:
    75         m_bufferSubstring->deref();
    76         return;
    77     case BufferShared:
    78         m_bufferSubstring->deref();
     70    if (bufferOwnership() != BufferInternal) {
     71        if (bufferOwnership() == BufferOwned)
     72            fastFree(m_data);
     73        else if (bufferOwnership() == BufferSubstring)
     74            m_dataBuffer.asPtr<UStringImpl*>()->deref();
     75        else {
     76            ASSERT(bufferOwnership() == BufferShared);
     77            m_dataBuffer.asPtr<SharedUChar*>()->deref();
     78        }
    7979    }
    8080}
    8181
    82 } // namespace JSC
     82}
Note: See TracChangeset for help on using the changeset viewer.