Changeset 178984 in webkit for trunk/Source/JavaScriptCore
- Timestamp:
- Jan 22, 2015, 11:04:05 PM (10 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r178954 r178984 1 2015-01-22 Mark Hahnenberg <[email protected]> 2 3 EdenCollections unnecessarily visit SmallStrings 4 https://bugs.webkit.org/show_bug.cgi?id=140762 5 6 Reviewed by Geoffrey Garen. 7 8 * heap/Heap.cpp: 9 (JSC::Heap::copyBackingStores): Also added a GCPhase for copying 10 backing stores, which is a significant portion of garbage collection. 11 (JSC::Heap::visitSmallStrings): Check to see if we need to visit 12 SmallStrings based on the collection type. 13 * runtime/SmallStrings.cpp: 14 (JSC::SmallStrings::SmallStrings): 15 (JSC::SmallStrings::visitStrongReferences): Set the fact that we have 16 visited the SmallStrings since the last modification. 17 * runtime/SmallStrings.h: 18 (JSC::SmallStrings::needsToBeVisited): If we're doing a 19 FullCollection, we need to visit. Otherwise, it depends on whether 20 we've been visited since the last modification/allocation. 21 1 22 2015-01-22 Ryosuke Niwa <[email protected]> 2 23 -
trunk/Source/JavaScriptCore/heap/Heap.cpp
r178884 r178984 548 548 void Heap::copyBackingStores() 549 549 { 550 GCPHASE(CopyBackingStores); 550 551 if (m_operationInProgress == EdenCollection) 551 552 m_storageSpace.startedCopying<EdenCollection>(); … … 612 613 { 613 614 GCPHASE(VisitSmallStrings); 615 if (!m_vm->smallStrings.needsToBeVisited(m_operationInProgress)) 616 return; 617 614 618 m_vm->smallStrings.visitStrongReferences(m_slotVisitor); 615 616 619 if (Options::logGC() == GCLogging::Verbose) 617 620 dataLog("Small strings:\n", m_slotVisitor); 618 619 621 m_slotVisitor.donateAndDrain(); 620 622 } -
trunk/Source/JavaScriptCore/runtime/SmallStrings.cpp
r177222 r178984 69 69 , m_nullObjectString(nullptr) 70 70 , m_undefinedObjectString(nullptr) 71 , m_needsToBeVisited(true) 71 72 { 72 73 COMPILE_ASSERT(singleCharacterStringCount == sizeof(m_singleCharacterStrings) / sizeof(m_singleCharacterStrings[0]), IsNumCharactersConstInSyncWithClassUsage); … … 90 91 void SmallStrings::visitStrongReferences(SlotVisitor& visitor) 91 92 { 93 m_needsToBeVisited = false; 92 94 visitor.appendUnbarrieredPointer(&m_emptyString); 93 95 for (unsigned i = 0; i <= maxSingleCharacterString; ++i) … … 108 110 ASSERT(!m_emptyString); 109 111 m_emptyString = JSString::createHasOtherOwner(*vm, StringImpl::empty()); 112 m_needsToBeVisited = true; 110 113 } 111 114 … … 116 119 ASSERT(!m_singleCharacterStrings[character]); 117 120 m_singleCharacterStrings[character] = JSString::createHasOtherOwner(*vm, PassRefPtr<StringImpl>(m_storage->rep(character))); 121 m_needsToBeVisited = true; 118 122 } 119 123 … … 125 129 } 126 130 127 void SmallStrings::initialize(VM* vm, JSString*& string, const char* value) const131 void SmallStrings::initialize(VM* vm, JSString*& string, const char* value) 128 132 { 129 133 string = JSString::create(*vm, StringImpl::create(value)); 134 m_needsToBeVisited = true; 130 135 } 131 136 -
trunk/Source/JavaScriptCore/runtime/SmallStrings.h
r176508 r178984 89 89 JSString* undefinedObjectString() const { return m_undefinedObjectString; } 90 90 91 bool needsToBeVisited(HeapOperation collectionType) const 92 { 93 if (collectionType == FullCollection) 94 return true; 95 return m_needsToBeVisited; 96 } 97 91 98 private: 92 99 static const unsigned singleCharacterStringCount = maxSingleCharacterString + 1; … … 95 102 JS_EXPORT_PRIVATE void createSingleCharacterString(VM*, unsigned char); 96 103 97 void initialize(VM*, JSString*&, const char* value) const;104 void initialize(VM*, JSString*&, const char* value); 98 105 99 106 JSString* m_emptyString; … … 105 112 JSString* m_singleCharacterStrings[singleCharacterStringCount]; 106 113 std::unique_ptr<SmallStringsStorage> m_storage; 114 bool m_needsToBeVisited; 107 115 }; 108 116
Note:
See TracChangeset
for help on using the changeset viewer.