Ignore:
Timestamp:
May 3, 2010, 4:03:37 PM (15 years ago)
Author:
[email protected]
Message:

Rolling out r58114 - this introduced memory leaks of
AtomicStrings then workers terminated.

Reviewed by NOBODY (reverting previous commit).

(JSC::ThunkHelpers::stringImplDataOffset):

  • runtime/Identifier.cpp:

(JSC::IdentifierTable::~IdentifierTable):
(JSC::IdentifierTable::add):
(JSC::IdentifierCStringTranslator::hash):
(JSC::IdentifierCStringTranslator::equal):
(JSC::IdentifierCStringTranslator::translate):
(JSC::Identifier::add):
(JSC::IdentifierUCharBufferTranslator::hash):
(JSC::IdentifierUCharBufferTranslator::equal):
(JSC::IdentifierUCharBufferTranslator::translate):
(JSC::Identifier::addSlowCase):

  • runtime/Identifier.h:
  • runtime/JSGlobalData.cpp:

(JSC::JSGlobalData::JSGlobalData):
(JSC::JSGlobalData::~JSGlobalData):

  • runtime/JSGlobalData.h:
  • wtf/WTFThreadData.cpp:

(WTF::WTFThreadData::WTFThreadData):
(WTF::WTFThreadData::~WTFThreadData):

  • wtf/WTFThreadData.h:

(JSC::IdentifierTable::remove):
(JSC::IdentifierTable::literalTable):
(WTF::WTFThreadData::atomicStringTable):

  • wtf/text/AtomicString.cpp:

(WebCore::AtomicStringTable::create):
(WebCore::AtomicStringTable::table):
(WebCore::AtomicStringTable::destroy):
(WebCore::stringTable):
(WebCore::CStringTranslator::hash):
(WebCore::CStringTranslator::equal):
(WebCore::CStringTranslator::translate):
(WebCore::operator==):
(WebCore::AtomicString::add):
(WebCore::equal):
(WebCore::UCharBufferTranslator::hash):
(WebCore::UCharBufferTranslator::equal):
(WebCore::UCharBufferTranslator::translate):
(WebCore::HashAndCharactersTranslator::hash):
(WebCore::HashAndCharactersTranslator::equal):
(WebCore::HashAndCharactersTranslator::translate):
(WebCore::AtomicString::find):
(WebCore::AtomicString::remove):

  • wtf/text/AtomicStringTable.h: Removed.
  • wtf/text/StringImpl.cpp:

(WebCore::StringImpl::~StringImpl):

  • wtf/text/StringImpl.h:

(WebCore::StringImpl::inTable):
(WebCore::StringImpl::setInTable):
(WebCore::equal):

  • wtf/text/StringImplBase.h:

(WTF::StringImplBase::StringImplBase):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/wtf/text/StringImpl.h

    r58392 r58712  
    4444// FIXME: This is a temporary layering violation while we move string code to WTF.
    4545// Landing the file moves in one patch, will follow on with patches to change the namespaces.
    46 namespace WTF {
    47 
    48 struct CStringTranslator;
    49 struct UCharBufferTranslator;
    50 struct HashAndCharactersTranslator;
     46namespace JSC {
     47
     48struct IdentifierCStringTranslator;
     49struct IdentifierUCharBufferTranslator;
    5150
    5251}
     
    5857class StringBuffer;
    5958
     59struct CStringTranslator;
     60struct HashAndCharactersTranslator;
    6061struct StringHash;
     62struct UCharBufferTranslator;
    6163
    6264enum TextCaseSensitivity { TextCaseSensitive, TextCaseInsensitive };
     
    6769
    6870class StringImpl : public StringImplBase {
    69     friend struct WTF::CStringTranslator;
    70     friend struct WTF::UCharBufferTranslator;
    71     friend struct WTF::HashAndCharactersTranslator;
     71    friend struct JSC::IdentifierCStringTranslator;
     72    friend struct JSC::IdentifierUCharBufferTranslator;
     73    friend struct CStringTranslator;
     74    friend struct HashAndCharactersTranslator;
     75    friend struct UCharBufferTranslator;
    7276    friend class AtomicStringImpl;
    7377private:
     
    220224    bool hasTerminatingNullCharacter() const { return m_refCountAndFlags & s_refCountFlagHasTerminatingNullCharacter; }
    221225
    222     bool isAtomic() const { return m_refCountAndFlags & s_refCountFlagIsAtomic; }
    223     void setIsAtomic(bool inTable)
    224     {
    225         ASSERT(!isStatic());
    226         if (inTable)
    227             m_refCountAndFlags |= s_refCountFlagIsAtomic;
    228         else
    229             m_refCountAndFlags &= s_refCountFlagIsAtomic;
    230     }
     226    bool inTable() const { return m_refCountAndFlags & s_refCountFlagInTable; }
     227    void setInTable() { m_refCountAndFlags |= s_refCountFlagInTable; }
    231228
    232229    unsigned hash() const { if (!m_hash) m_hash = computeHash(m_data, m_length); return m_hash; }
     
    336333bool equal(const StringImpl*, const char*);
    337334inline bool equal(const char* a, StringImpl* b) { return equal(b, a); }
    338 inline bool equal(StringImpl* string, const UChar* characters, unsigned length)
    339 {
    340     if (string->length() != length)
    341         return false;
    342 
    343     // FIXME: perhaps we should have a more abstract macro that indicates when
    344     // going 4 bytes at a time is unsafe
    345 #if CPU(ARM) || CPU(SH4)
    346     const UChar* stringCharacters = string->characters();
    347     for (unsigned i = 0; i != length; ++i) {
    348         if (*stringCharacters++ != *characters++)
    349             return false;
    350     }
    351     return true;
    352 #else
    353     /* Do it 4-bytes-at-a-time on architectures where it's safe */
    354 
    355     const uint32_t* stringCharacters = reinterpret_cast<const uint32_t*>(string->characters());
    356     const uint32_t* bufferCharacters = reinterpret_cast<const uint32_t*>(characters);
    357 
    358     unsigned halfLength = length >> 1;
    359     for (unsigned i = 0; i != halfLength; ++i) {
    360         if (*stringCharacters++ != *bufferCharacters++)
    361             return false;
    362     }
    363 
    364     if (length & 1 &&  *reinterpret_cast<const uint16_t*>(stringCharacters) != *reinterpret_cast<const uint16_t*>(bufferCharacters))
    365         return false;
    366 
    367     return true;
    368 #endif
    369 }
    370335
    371336bool equalIgnoringCase(StringImpl*, StringImpl*);
     
    410375
    411376using WebCore::equal;
    412 using WebCore::StringImpl;
    413377
    414378namespace WTF {
Note: See TracChangeset for help on using the changeset viewer.