Ignore:
Timestamp:
May 5, 2010, 6:08:53 PM (15 years ago)
Author:
[email protected]
Message:

Bug 38604 - workers-gc2 crashing on Qt

Reviewed by Darin Adler.

This appears to be due to a couple of issues.
(1) When the atomic string table is deleted it does not clear the 'inTable' bit
on AtomicStrings - it implicitly assumes that all AtomicStrings have already
been deleted at this point (otherwise they will crash in their destructor when
they try to remove themselves from the atomic string table).
(2) We don't fix the ordering in which WTF::WTFThreadData and
WebCore::ThreadGlobalData are destructed.

We should make sure that ThreadGlobalData is cleaned up before worker threads
terminate and WTF::WTFThreadData is destroyed, and we should clear the inTable
bit of members on atomic string table destruction.

JavaScriptCore:

WTF changes (fix issue 1, above) - ensure inTable property is cleared when the
atomic string table is destroyed (also, rename InTable to IsAtomic, to make it
clear which table we are refering to!)

  • wtf/text/AtomicString.cpp:

(WebCore::AtomicStringTable::destroy):
(WebCore::CStringTranslator::translate):
(WebCore::UCharBufferTranslator::translate):
(WebCore::HashAndCharactersTranslator::translate):
(WebCore::AtomicString::add):

  • wtf/text/StringImpl.cpp:

(WebCore::StringImpl::~StringImpl):

  • wtf/text/StringImpl.h:

(WebCore::StringImpl::isAtomic):
(WebCore::StringImpl::setIsAtomic):

  • wtf/text/StringImplBase.h:

WebCore:

WTF changes (fix issue 2, above) - clean up the thread data on worker termination.

  • platform/ThreadGlobalData.cpp:

(WebCore::ThreadGlobalData::~ThreadGlobalData):
(WebCore::ThreadGlobalData::destroy):

  • platform/ThreadGlobalData.h:
  • workers/WorkerThread.cpp:

(WebCore::WorkerThread::workerThread):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/wtf/text/AtomicString.cpp

    r58712 r58851  
    5656    static void destroy(AtomicStringTable* table)
    5757    {
     58        HashSet<StringImpl*>::iterator end = table->m_table.end();
     59        for (HashSet<StringImpl*>::iterator iter = table->m_table.begin(); iter != end; ++iter)
     60            (*iter)->setIsAtomic(false);
    5861        delete table;
    5962    }
     
    9396        location = StringImpl::create(c).releaseRef();
    9497        location->setHash(hash);
    95         location->setInTable();
     98        location->setIsAtomic(true);
    9699    }
    97100};
     
    172175        location = StringImpl::create(buf.s, buf.length).releaseRef();
    173176        location->setHash(hash);
    174         location->setInTable();
     177        location->setIsAtomic(true);
    175178    }
    176179};
     
    198201        location = StringImpl::create(buffer.characters, buffer.length).releaseRef();
    199202        location->setHash(hash);
    200         location->setInTable();
     203        location->setIsAtomic(true);
    201204    }
    202205};
     
    255258PassRefPtr<StringImpl> AtomicString::add(StringImpl* r)
    256259{
    257     if (!r || r->inTable())
     260    if (!r || r->isAtomic())
    258261        return r;
    259262
     
    263266    StringImpl* result = *stringTable().add(r).first;
    264267    if (result == r)
    265         r->setInTable();
     268        r->setIsAtomic(true);
    266269    return result;
    267270}
Note: See TracChangeset for help on using the changeset viewer.