Bug 180906 - [JSC] Number of SlotVisitors can increase after setting up m_visitCounters
Summary: [JSC] Number of SlotVisitors can increase after setting up m_visitCounters
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: 179934
Blocks: 180907
  Show dependency treegraph
 
Reported: 2017-12-16 06:10 PST by Yusuke Suzuki
Modified: 2017-12-17 02:57 PST (History)
8 users (show)

See Also:


Attachments
Patch (3.78 KB, patch)
2017-12-16 06:15 PST, Yusuke Suzuki
fpizlo: 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 2017-12-16 06:10:31 PST
[JSC] Number of SlotVisitors can increase after setting up m_visitCounters
Comment 1 Yusuke Suzuki 2017-12-16 06:15:22 PST
Created attachment 329573 [details]
Patch
Comment 2 Yusuke Suzuki 2017-12-16 07:15:37 PST
Comment on attachment 329573 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=329573&action=review

> Source/JavaScriptCore/heap/HeapInlines.h:274
> +    auto locker = holdLock(m_parallelSlotVisitorLock);

In this patch, we keep this lock and the current mechanism.
But I think we should create all SlotVisitors in Heap's constructor based on HeapHelperPool's # of threads.
The size of m_parallelSlotVisitors is capped with this value, and it should not be so large.
At that time, we can remove this m_parallelSlotVisitorLock in this function and forEachSlotVisitor function.
I opened a bug for this, which is separated from this bug.
https://bugs.webkit.org/show_bug.cgi?id=180907
Comment 3 Filip Pizlo 2017-12-16 15:02:56 PST
Comment on attachment 329573 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=329573&action=review

Nice!

>> Source/JavaScriptCore/heap/HeapInlines.h:274
>> +    auto locker = holdLock(m_parallelSlotVisitorLock);
> 
> In this patch, we keep this lock and the current mechanism.
> But I think we should create all SlotVisitors in Heap's constructor based on HeapHelperPool's # of threads.
> The size of m_parallelSlotVisitors is capped with this value, and it should not be so large.
> At that time, we can remove this m_parallelSlotVisitorLock in this function and forEachSlotVisitor function.
> I opened a bug for this, which is separated from this bug.
> https://bugs.webkit.org/show_bug.cgi?id=180907

I think it's safe to assume that Vector::size() doesn't need locking.  On the other hand, it's also OK to be paranoid.  Up to you!
Comment 4 Yusuke Suzuki 2017-12-17 02:08:35 PST
Comment on attachment 329573 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=329573&action=review

Thank you for your review!

>>> Source/JavaScriptCore/heap/HeapInlines.h:274
>>> +    auto locker = holdLock(m_parallelSlotVisitorLock);
>> 
>> In this patch, we keep this lock and the current mechanism.
>> But I think we should create all SlotVisitors in Heap's constructor based on HeapHelperPool's # of threads.
>> The size of m_parallelSlotVisitors is capped with this value, and it should not be so large.
>> At that time, we can remove this m_parallelSlotVisitorLock in this function and forEachSlotVisitor function.
>> I opened a bug for this, which is separated from this bug.
>> https://bugs.webkit.org/show_bug.cgi?id=180907
> 
> I think it's safe to assume that Vector::size() doesn't need locking.  On the other hand, it's also OK to be paranoid.  Up to you!

I would like to keep this for a while. Once bug 180907 is fixed, we can remove this checking :)
Comment 5 Yusuke Suzuki 2017-12-17 02:53:56 PST
Committed r226010: <https://trac.webkit.org/changeset/226010>
Comment 6 Radar WebKit Bug Importer 2017-12-17 02:54:17 PST
<rdar://problem/36094575>