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.h

    r176508 r178984  
    8989    JSString* undefinedObjectString() const { return m_undefinedObjectString; }
    9090
     91    bool needsToBeVisited(HeapOperation collectionType) const
     92    {
     93        if (collectionType == FullCollection)
     94            return true;
     95        return m_needsToBeVisited;
     96    }
     97
    9198private:
    9299    static const unsigned singleCharacterStringCount = maxSingleCharacterString + 1;
     
    95102    JS_EXPORT_PRIVATE void createSingleCharacterString(VM*, unsigned char);
    96103
    97     void initialize(VM*, JSString*&, const char* value) const;
     104    void initialize(VM*, JSString*&, const char* value);
    98105
    99106    JSString* m_emptyString;
     
    105112    JSString* m_singleCharacterStrings[singleCharacterStringCount];
    106113    std::unique_ptr<SmallStringsStorage> m_storage;
     114    bool m_needsToBeVisited;
    107115};
    108116
Note: See TracChangeset for help on using the changeset viewer.