Bug 189156 - [JSC] Clean up StructureStubClearingWatchpoint
Summary: [JSC] Clean up StructureStubClearingWatchpoint
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Yusuke Suzuki
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-08-30 09:02 PDT by Yusuke Suzuki
Modified: 2018-09-06 21:25 PDT (History)
6 users (show)

See Also:


Attachments
Patch (5.13 KB, patch)
2018-08-30 09:03 PDT, Yusuke Suzuki
no flags Details | Formatted Diff | Diff
Patch (5.06 KB, patch)
2018-08-31 23:20 PDT, Yusuke Suzuki
saam: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yusuke Suzuki 2018-08-30 09:02:32 PDT
[JSC] Clean up StructureStubClearingWatchpoint
Comment 1 Yusuke Suzuki 2018-08-30 09:03:52 PDT
Created attachment 348502 [details]
Patch
Comment 2 Saam Barati 2018-08-30 13:23:57 PDT
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 3 Yusuke Suzuki 2018-08-31 02:21:29 PDT
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 4 Saam Barati 2018-08-31 11:44:48 PDT
Comment on attachment 348502 [details]
Patch

Maybe the linked list uses less memory on average for common programs?
Comment 5 Yusuke Suzuki 2018-08-31 23:16:23 PDT
(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.
Comment 6 Yusuke Suzuki 2018-08-31 23:19:50 PDT
(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.
Comment 7 Yusuke Suzuki 2018-08-31 23:20:12 PDT
Created attachment 348708 [details]
Patch
Comment 8 Yusuke Suzuki 2018-09-06 12:00:47 PDT
Ping?
Comment 9 Saam Barati 2018-09-06 12:50:21 PDT
Comment on attachment 348708 [details]
Patch

r=me
Comment 10 Yusuke Suzuki 2018-09-06 21:23:55 PDT
(In reply to Saam Barati from comment #9)
> Comment on attachment 348708 [details]
> Patch
> 
> r=me

Thanks!
Comment 11 Yusuke Suzuki 2018-09-06 21:24:24 PDT
Committed r235776: <https://trac.webkit.org/changeset/235776>
Comment 12 Radar WebKit Bug Importer 2018-09-06 21:25:32 PDT
<rdar://problem/44211170>