Changeset 220322 in webkit
- Timestamp:
- Aug 5, 2017 9:43:37 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r220318 r220322 1 2017-08-05 Filip Pizlo <fpizlo@apple.com> 2 3 REGRESSION (r219895-219897): Number of leaks on Open Source went from 9240 to 235983 and is now at 302372 4 https://bugs.webkit.org/show_bug.cgi?id=175083 5 6 Reviewed by Oliver Hunt. 7 8 This fixes the leak by making MarkedBlock::specializedSweep call destructors when the block is empty, 9 even if we are using the pop path. 10 11 Also, this fixes HeapCellInlines.h to no longer include MarkedBlockInlines.h. That's pretty 12 important, since MarkedBlockInlines.h is the GC's internal guts - we don't want to have to recompile 13 the world just because we changed it. 14 15 Finally, this adds a new testing SPI for waiting for all VMs to finish destructing. This makes it 16 easier to debug leaks. 17 18 * bytecode/AccessCase.cpp: 19 * bytecode/PolymorphicAccess.cpp: 20 * heap/HeapCell.cpp: 21 (JSC::HeapCell::isLive): 22 * heap/HeapCellInlines.h: 23 (JSC::HeapCell::isLive): Deleted. 24 * heap/MarkedAllocator.cpp: 25 (JSC::MarkedAllocator::tryAllocateWithoutCollecting): 26 (JSC::MarkedAllocator::endMarking): 27 * heap/MarkedBlockInlines.h: 28 (JSC::MarkedBlock::Handle::specializedSweep): 29 * jit/AssemblyHelpers.cpp: 30 * jit/Repatch.cpp: 31 * runtime/TestRunnerUtils.h: 32 * runtime/VM.cpp: 33 (JSC::waitForVMDestruction): 34 (JSC::VM::~VM): 35 1 36 2017-08-05 Mark Lam <mark.lam@apple.com> 2 37 -
trunk/Source/JavaScriptCore/bytecode/AccessCase.cpp
r219981 r220322 47 47 #include "SlotVisitorInlines.h" 48 48 #include "StructureStubInfo.h" 49 #include "SuperSampler.h" 49 50 #include "ThunkGenerators.h" 50 51 -
trunk/Source/JavaScriptCore/bytecode/PolymorphicAccess.cpp
r218641 r220322 39 39 #include "StructureStubClearingWatchpoint.h" 40 40 #include "StructureStubInfo.h" 41 #include "SuperSampler.h" 41 42 #include <wtf/CommaPrinter.h> 42 43 #include <wtf/ListDump.h> -
trunk/Source/JavaScriptCore/heap/HeapCell.cpp
r213773 r220322 27 27 #include "HeapCell.h" 28 28 29 #include "HeapCellInlines.h" 30 #include "MarkedBlockInlines.h" 29 31 #include <wtf/PrintStream.h> 30 32 31 33 namespace JSC { 34 35 bool HeapCell::isLive() 36 { 37 if (isLargeAllocation()) 38 return largeAllocation().isLive(); 39 auto& markedBlockHandle = markedBlock().handle(); 40 if (markedBlockHandle.isFreeListed()) 41 return !markedBlockHandle.isFreeListedCell(this); 42 return markedBlockHandle.isLive(this); 43 } 32 44 33 45 #if !COMPILER(GCC_OR_CLANG) -
trunk/Source/JavaScriptCore/heap/HeapCellInlines.h
r217429 r220322 29 29 #include "HeapCell.h" 30 30 #include "LargeAllocation.h" 31 #include "MarkedBlockInlines.h"32 31 #include "VM.h" 33 32 34 33 namespace JSC { 35 36 ALWAYS_INLINE bool HeapCell::isLive()37 {38 if (isLargeAllocation())39 return largeAllocation().isLive();40 auto& markedBlockHandle = markedBlock().handle();41 if (markedBlockHandle.isFreeListed())42 return !markedBlockHandle.isFreeListedCell(this);43 return markedBlockHandle.isLive(this);44 }45 34 46 35 ALWAYS_INLINE bool HeapCell::isLargeAllocation() const -
trunk/Source/JavaScriptCore/heap/MarkedAllocator.cpp
r220291 r220322 40 40 namespace JSC { 41 41 42 static constexpr bool tradeDestructorBlocks = true; 43 42 44 MarkedAllocator::MarkedAllocator(Heap* heap, Subspace* subspace, size_t cellSize) 43 45 : m_freeList(cellSize) … … 103 105 } 104 106 105 if (Options::stealEmptyBlocksFromOtherAllocators()) { 107 if (Options::stealEmptyBlocksFromOtherAllocators() 108 && (tradeDestructorBlocks || !needsDestruction())) { 106 109 if (MarkedBlock::Handle* block = m_subspace->findEmptyBlockToSteal()) { 107 110 RELEASE_ASSERT(block->alignedMemoryAllocator() == m_subspace->alignedMemoryAllocator()); … … 382 385 // vectors. 383 386 384 m_empty = m_live & ~m_markingNotEmpty; 385 m_canAllocateButNotEmpty = m_live & m_markingNotEmpty & ~m_markingRetired; 387 if (!tradeDestructorBlocks && needsDestruction()) { 388 ASSERT(m_empty.isEmpty()); 389 m_canAllocateButNotEmpty = m_live & ~m_markingRetired; 390 } else { 391 m_empty = m_live & ~m_markingNotEmpty; 392 m_canAllocateButNotEmpty = m_live & m_markingNotEmpty & ~m_markingRetired; 393 } 394 386 395 if (needsDestruction()) { 387 396 // There are some blocks that we didn't allocate out of in the last cycle, but we swept them. This -
trunk/Source/JavaScriptCore/heap/MarkedBlockInlines.h
r220175 r220322 224 224 HeapCell* cell = reinterpret_cast_ptr<HeapCell*>(&block.atoms()[i]); 225 225 226 if (destructionMode != BlockHasNoDestructors && emptyMode == NotEmpty)226 if (destructionMode != BlockHasNoDestructors) 227 227 destroy(cell); 228 228 -
trunk/Source/JavaScriptCore/jit/AssemblyHelpers.cpp
r220219 r220322 33 33 #include "LinkBuffer.h" 34 34 #include "MaxFrameExtentForSlowPathCall.h" 35 #include "SuperSampler.h" 35 36 #include "ThunkGenerators.h" 36 37 -
trunk/Source/JavaScriptCore/jit/Repatch.cpp
r219981 r220322 59 59 #include "StructureStubClearingWatchpoint.h" 60 60 #include "StructureStubInfo.h" 61 #include "SuperSampler.h" 61 62 #include "ThunkGenerators.h" 62 63 #include <wtf/CommaPrinter.h> -
trunk/Source/JavaScriptCore/runtime/TestRunnerUtils.h
r206525 r220322 1 1 /* 2 * Copyright (C) 2013-201 6Apple Inc. All rights reserved.2 * Copyright (C) 2013-2017 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 55 55 JS_EXPORT_PRIVATE void finalizeStatsAtEndOfTesting(); 56 56 57 JS_EXPORT_PRIVATE void waitForVMDestruction(); 58 57 59 } // namespace JSC -
trunk/Source/JavaScriptCore/runtime/VM.cpp
r220291 r220322 102 102 #include "StrongInlines.h" 103 103 #include "StructureInlines.h" 104 #include "TestRunnerUtils.h" 104 105 #include "ThunkGenerators.h" 105 106 #include "TypeProfiler.h" … … 114 115 #include <wtf/CurrentTime.h> 115 116 #include <wtf/ProcessID.h> 117 #include <wtf/ReadWriteLock.h> 116 118 #include <wtf/SimpleStats.h> 117 119 #include <wtf/StringPrintStream.h> … … 342 344 } 343 345 346 static StaticReadWriteLock s_destructionLock; 347 348 void waitForVMDestruction() 349 { 350 auto locker = holdLock(s_destructionLock.write()); 351 } 352 344 353 VM::~VM() 345 354 { 355 auto destructionLocker = holdLock(s_destructionLock.read()); 356 346 357 Gigacage::removeDisableCallback(gigacageDisabledCallback, this); 347 358 promiseDeferredTimer->stopRunningTasks(); -
trunk/Source/WTF/ChangeLog
r220279 r220322 1 2017-08-05 Filip Pizlo <fpizlo@apple.com> 2 3 REGRESSION (r219895-219897): Number of leaks on Open Source went from 9240 to 235983 and is now at 302372 4 https://bugs.webkit.org/show_bug.cgi?id=175083 5 6 Reviewed by Oliver Hunt. 7 8 Adds a classic ReadWriteLock class. I wrote my own because I can never remember if the pthread one is 9 guaranted to bias in favor of writers or not. 10 11 * WTF.xcodeproj/project.pbxproj: 12 * wtf/Condition.h: 13 (WTF::ConditionBase::construct): 14 (WTF::Condition::Condition): 15 * wtf/Lock.h: 16 (WTF::LockBase::construct): 17 (WTF::Lock::Lock): 18 * wtf/ReadWriteLock.cpp: Added. 19 (WTF::ReadWriteLockBase::construct): 20 (WTF::ReadWriteLockBase::readLock): 21 (WTF::ReadWriteLockBase::readUnlock): 22 (WTF::ReadWriteLockBase::writeLock): 23 (WTF::ReadWriteLockBase::writeUnlock): 24 * wtf/ReadWriteLock.h: Added. 25 (WTF::ReadWriteLockBase::ReadLock::tryLock): 26 (WTF::ReadWriteLockBase::ReadLock::lock): 27 (WTF::ReadWriteLockBase::ReadLock::unlock): 28 (WTF::ReadWriteLockBase::WriteLock::tryLock): 29 (WTF::ReadWriteLockBase::WriteLock::lock): 30 (WTF::ReadWriteLockBase::WriteLock::unlock): 31 (WTF::ReadWriteLockBase::read): 32 (WTF::ReadWriteLockBase::write): 33 (WTF::ReadWriteLock::ReadWriteLock): 34 1 35 2017-08-04 Matt Lewis <jlewis3@apple.com> 2 36 -
trunk/Source/WTF/WTF.xcodeproj/project.pbxproj
r220214 r220322 39 39 0FE1646A1B6FFC9600400E7C /* Lock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FE164681B6FFC9600400E7C /* Lock.cpp */; }; 40 40 0FE4479C1B7AAA03009498EB /* WordLock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FE4479A1B7AAA03009498EB /* WordLock.cpp */; }; 41 0FEC3C5E1F368A9700F59B6C /* ReadWriteLock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FEC3C5C1F368A9700F59B6C /* ReadWriteLock.cpp */; }; 41 42 0FFF19DC1BB334EB00886D91 /* ParallelHelperPool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FFF19DA1BB334EB00886D91 /* ParallelHelperPool.cpp */; }; 42 43 14022F4118F5C3FC007FF0EB /* libbmalloc.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 14022F4018F5C3FC007FF0EB /* libbmalloc.a */; }; … … 226 227 0FEB3DD01BB7366B009D7AAD /* ParallelVectorIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ParallelVectorIterator.h; sourceTree = "<group>"; }; 227 228 0FEC3C4F1F323C6800F59B6C /* CagedPtr.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CagedPtr.h; sourceTree = "<group>"; }; 229 0FEC3C5C1F368A9700F59B6C /* ReadWriteLock.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ReadWriteLock.cpp; sourceTree = "<group>"; }; 230 0FEC3C5D1F368A9700F59B6C /* ReadWriteLock.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ReadWriteLock.h; sourceTree = "<group>"; }; 228 231 0FEC84AE1BD825310080FF74 /* GraphNodeWorklist.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GraphNodeWorklist.h; sourceTree = "<group>"; }; 229 232 0FEC84B01BDACD390080FF74 /* ScopedLambda.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScopedLambda.h; sourceTree = "<group>"; }; … … 910 913 0F725CAB1C50461600AD943A /* RangeSet.h */, 911 914 0F87105916643F190090B0AD /* RawPointer.h */, 915 0FEC3C5C1F368A9700F59B6C /* ReadWriteLock.cpp */, 916 0FEC3C5D1F368A9700F59B6C /* ReadWriteLock.h */, 912 917 0FDE87F61DFD07CC0064C390 /* RecursiveLockAdapter.h */, 913 918 A8A472FE151A825B004123FF /* RedBlackTree.h */, … … 1338 1343 0FE1646A1B6FFC9600400E7C /* Lock.cpp in Sources */, 1339 1344 0F60F32F1DFCBD1B00416D6C /* LockedPrintStream.cpp in Sources */, 1345 0FEC3C5E1F368A9700F59B6C /* ReadWriteLock.cpp in Sources */, 1340 1346 53534F2A1EC0E10E00141B2F /* MachExceptions.defs in Sources */, 1341 1347 A8A473E5151A825B004123FF /* MainThread.cpp in Sources */, -
trunk/Source/WTF/wtf/CMakeLists.txt
r220214 r220322 111 111 RangeSet.h 112 112 RawPointer.h 113 ReadWriteLock.h 113 114 RecursiveLockAdapter.h 114 115 RedBlackTree.h … … 242 243 RandomDevice.cpp 243 244 RandomNumber.cpp 245 ReadWriteLock.cpp 244 246 RefCountedLeakCounter.cpp 245 247 RunLoop.cpp -
trunk/Source/WTF/wtf/Condition.h
r218464 r220322 50 50 // are unlikely to be affected by the cost of conversions, it is better to use MonotonicTime. 51 51 typedef ParkingLot::Time Time; 52 53 void construct() 54 { 55 m_hasWaiters.store(false); 56 } 52 57 53 58 // Wait on a parking queue while releasing the given lock. It will unlock the lock just before … … 169 174 } 170 175 171 pr otected:176 private: 172 177 Atomic<bool> m_hasWaiters; 173 178 }; … … 178 183 Condition() 179 184 { 180 m_hasWaiters.store(false);185 construct(); 181 186 } 182 187 }; -
trunk/Source/WTF/wtf/Lock.h
r209570 r220322 53 53 // Use Lock in instance variables. 54 54 struct LockBase { 55 void construct() 56 { 57 m_byte.store(0, std::memory_order_relaxed); 58 } 59 55 60 void lock() 56 61 { … … 111 116 } 112 117 113 pr otected:118 private: 114 119 friend struct TestWebKitAPI::LockInspector; 115 120 … … 137 142 Lock() 138 143 { 139 m_byte.store(0, std::memory_order_relaxed);144 construct(); 140 145 } 141 146 }; -
trunk/Tools/ChangeLog
r220321 r220322 1 2017-08-05 Filip Pizlo <fpizlo@apple.com> 2 3 REGRESSION (r219895-219897): Number of leaks on Open Source went from 9240 to 235983 and is now at 302372 4 https://bugs.webkit.org/show_bug.cgi?id=175083 5 6 Reviewed by Oliver Hunt. 7 8 Leaks results are super confusing if leaks runs while some VMs are destructing. This calls a new SPI 9 to wait for VM destructions to finish before running the next test. This makes it easier to 10 understand leaks results from workers tests, and leads to fewer reported leaks. 11 12 * DumpRenderTree/mac/DumpRenderTree.mm: 13 (runTest): 14 1 15 2017-08-05 Yoshiaki Jitsukawa <Yoshiaki.Jitsukawa@sony.com> 2 16 -
trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm
r220311 r220322 2089 2089 if (gcBetweenTests) 2090 2090 [WebCoreStatistics garbageCollectJavaScriptObjects]; 2091 2092 JSC::waitForVMDestruction(); 2091 2093 2092 2094 fputs("#EOF\n", stderr);
Note: See TracChangeset
for help on using the changeset viewer.