Ignore:
Timestamp:
Jan 22, 2015, 11:04:05 PM (10 years ago)
Author:
[email protected]
Message:

EdenCollections unnecessarily visit SmallStrings
https://bugs.webkit.org/show_bug.cgi?id=140762

Reviewed by Geoffrey Garen.

  • heap/Heap.cpp:

(JSC::Heap::copyBackingStores): Also added a GCPhase for copying
backing stores, which is a significant portion of garbage collection.
(JSC::Heap::visitSmallStrings): Check to see if we need to visit
SmallStrings based on the collection type.

  • runtime/SmallStrings.cpp:

(JSC::SmallStrings::SmallStrings):
(JSC::SmallStrings::visitStrongReferences): Set the fact that we have
visited the SmallStrings since the last modification.

  • runtime/SmallStrings.h:

(JSC::SmallStrings::needsToBeVisited): If we're doing a
FullCollection, we need to visit. Otherwise, it depends on whether
we've been visited since the last modification/allocation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/SmallStrings.cpp

    r177222 r178984  
    6969    , m_nullObjectString(nullptr)
    7070    , m_undefinedObjectString(nullptr)
     71    , m_needsToBeVisited(true)
    7172{
    7273    COMPILE_ASSERT(singleCharacterStringCount == sizeof(m_singleCharacterStrings) / sizeof(m_singleCharacterStrings[0]), IsNumCharactersConstInSyncWithClassUsage);
     
    9091void SmallStrings::visitStrongReferences(SlotVisitor& visitor)
    9192{
     93    m_needsToBeVisited = false;
    9294    visitor.appendUnbarrieredPointer(&m_emptyString);
    9395    for (unsigned i = 0; i <= maxSingleCharacterString; ++i)
     
    108110    ASSERT(!m_emptyString);
    109111    m_emptyString = JSString::createHasOtherOwner(*vm, StringImpl::empty());
     112    m_needsToBeVisited = true;
    110113}
    111114
     
    116119    ASSERT(!m_singleCharacterStrings[character]);
    117120    m_singleCharacterStrings[character] = JSString::createHasOtherOwner(*vm, PassRefPtr<StringImpl>(m_storage->rep(character)));
     121    m_needsToBeVisited = true;
    118122}
    119123
     
    125129}
    126130
    127 void SmallStrings::initialize(VM* vm, JSString*& string, const char* value) const
     131void SmallStrings::initialize(VM* vm, JSString*& string, const char* value)
    128132{
    129133    string = JSString::create(*vm, StringImpl::create(value));
     134    m_needsToBeVisited = true;
    130135}
    131136
Note: See TracChangeset for help on using the changeset viewer.