Bug 194911 - Add more doesGC() assertions.
Summary: Add more doesGC() assertions.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Mark Lam
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-02-21 12:15 PST by Mark Lam
Modified: 2019-02-21 18:03 PST (History)
8 users (show)

See Also:


Attachments
proposed patch. (13.63 KB, patch)
2019-02-21 14:17 PST, Mark Lam
sbarati: review+
Details | Formatted Diff | Diff
proposed patch after applying Saam's and Yusuke's feedback. (17.86 KB, patch)
2019-02-21 17:54 PST, Mark Lam
ysuzuki: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Lam 2019-02-21 12:15:01 PST
Patch coming.
Comment 1 Radar WebKit Bug Importer 2019-02-21 12:16:44 PST
<rdar://problem/48285723>
Comment 2 Mark Lam 2019-02-21 14:17:57 PST
Created attachment 362645 [details]
proposed patch.
Comment 3 Saam Barati 2019-02-21 14:24:31 PST
Comment on attachment 362645 [details]
proposed patch.

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

> Source/JavaScriptCore/ChangeLog:47
> +        (JSC::Heap::collectAsync):

I wonder if it's correct for this one.

> Source/JavaScriptCore/heap/DeferGC.h:49
> +            if (m_heap.deferralDepth() == 1)

Why would we not always assert this? We generally don't know if we're the outmost or not.

> Source/JavaScriptCore/heap/Heap.cpp:1033
> +        RELEASE_ASSERT(expectDoesGC());

I wonder if this should be based on synchronousness
Comment 4 Mark Lam 2019-02-21 16:12:15 PST
Comment on attachment 362645 [details]
proposed patch.

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

>> Source/JavaScriptCore/ChangeLog:47
>> +        (JSC::Heap::collectAsync):
> 
> I wonder if it's correct for this one.

collectAsync can GC synchronously as well because:
- collectAsync() calls requestCollection()
- requestCollection() calls stopIfNecessary()
- stopIfNecessary() can calls collectInMutatorThread().

>> Source/JavaScriptCore/heap/DeferGC.h:49
>> +            if (m_heap.deferralDepth() == 1)
> 
> Why would we not always assert this? We generally don't know if we're the outmost or not.

You're right.  This check is not needed.  I'll make the assertion unconditional.

>> Source/JavaScriptCore/heap/Heap.cpp:1033
>> +        RELEASE_ASSERT(expectDoesGC());
> 
> I wonder if this should be based on synchronousness

Async can GC in mutator thread as well (as explained above).
Comment 5 Mark Lam 2019-02-21 17:54:00 PST
Created attachment 362679 [details]
proposed patch after applying Saam's and Yusuke's feedback.
Comment 6 Yusuke Suzuki 2019-02-21 17:58:16 PST
Comment on attachment 362679 [details]
proposed patch after applying Saam's and Yusuke's feedback.

r=me
Comment 7 Mark Lam 2019-02-21 18:03:25 PST
Thanks for the reviews.  Landed in r241927: <http://trac.webkit.org/r241927>.