[JSC] Clean up StructureStubClearingWatchpoint
Created attachment 348502 [details] Patch
Comment on attachment 348502 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=348502&action=review > Source/JavaScriptCore/bytecode/StructureStubClearingWatchpoint.h:-96 > - std::unique_ptr<StructureStubClearingWatchpoint> m_head; Was there a reason for the old code?
Comment on attachment 348502 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=348502&action=review >> Source/JavaScriptCore/bytecode/StructureStubClearingWatchpoint.h:-96 >> - std::unique_ptr<StructureStubClearingWatchpoint> m_head; > > Was there a reason for the old code? I can't see any reason. Vector<StructureStubClearingWatchpoint> is bad since each StructureStubClearingWatchpoint address can be changed. But Vector<std::unique_ptr<StructureStubClearingWatchpoint>> is enough.
Comment on attachment 348502 [details] Patch Maybe the linked list uses less memory on average for common programs?
(In reply to Saam Barati from comment #4) > Comment on attachment 348502 [details] > Patch > > Maybe the linked list uses less memory on average for common programs? In the Vector<> case, we can drop a link in StructureStubClearingWatchpoint instead of allocating storage for Vector. The memory consumption is so-so, larger in Vector case due to unused memory allocation for storages, or larger in linked-list case due to the representation of the enlarged objects in bmalloc (it depends on whether the given object size would fit to the bmalloc's segregated heap). We can use Bag<> here, it does not change memory usage. Changed.
(In reply to Yusuke Suzuki from comment #5) > (In reply to Saam Barati from comment #4) > > Comment on attachment 348502 [details] > > Patch > > > > Maybe the linked list uses less memory on average for common programs? > > In the Vector<> case, we can drop a link in StructureStubClearingWatchpoint > instead of allocating storage for Vector. > The memory consumption is so-so, larger in Vector case due to unused memory > allocation for storages, or larger in linked-list case due to the > representation of the enlarged objects in bmalloc (it depends on whether the > given object size would fit to the bmalloc's segregated heap). > We can use Bag<> here, it does not change memory usage. Changed. If allocations of this watchpoint in this vector/bag is so many, SegmentedVector<> can improve memory usage more. In the meantime, I'll use bag.
Created attachment 348708 [details] Patch
Ping?
Comment on attachment 348708 [details] Patch r=me
(In reply to Saam Barati from comment #9) > Comment on attachment 348708 [details] > Patch > > r=me Thanks!
Committed r235776: <https://trac.webkit.org/changeset/235776>
<rdar://problem/44211170>