Bug 166626 - DeferGC::~DeferGC should be super cheap
Summary: DeferGC::~DeferGC should be super cheap
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Filip Pizlo
URL:
Keywords: InRadar
Depends on:
Blocks: 166627
  Show dependency treegraph
 
Reported: 2016-12-30 17:11 PST by Filip Pizlo
Modified: 2017-01-06 15:26 PST (History)
7 users (show)

See Also:


Attachments
the patch (11.66 KB, patch)
2016-12-30 17:18 PST, Filip Pizlo
no flags Details | Formatted Diff | Diff
the patch (12.41 KB, patch)
2017-01-02 13:29 PST, Filip Pizlo
ggaren: review-
buildbot: commit-queue-
Details | Formatted Diff | Diff
Archive of layout-test-results from ews112 for mac-elcapitan (564.90 KB, application/zip)
2017-01-02 14:33 PST, Build Bot
no flags Details
the patch (13.54 KB, patch)
2017-01-05 16:18 PST, Filip Pizlo
buildbot: commit-queue-
Details | Formatted Diff | Diff
Archive of layout-test-results from ews116 for mac-elcapitan (757.77 KB, application/zip)
2017-01-05 17:24 PST, Build Bot
no flags Details
the patch (14.51 KB, patch)
2017-01-05 19:15 PST, Filip Pizlo
no flags Details | Formatted Diff | Diff
the patch (14.82 KB, patch)
2017-01-05 19:57 PST, Filip Pizlo
saam: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Filip Pizlo 2016-12-30 17:11:06 PST
Right now, it requires running the collector's full collectIfNecessaryOrDefer() hook, which is super big.

The right thing for it to do is to check a boolean to see if collectIfNecessaryOrDefer() had ever deferred.
Comment 1 Filip Pizlo 2016-12-30 17:18:57 PST
Created attachment 297864 [details]
the patch
Comment 2 Filip Pizlo 2017-01-02 13:29:23 PST
Created attachment 297908 [details]
the patch
Comment 3 Build Bot 2017-01-02 14:32:58 PST
Comment on attachment 297908 [details]
the patch

Attachment 297908 [details] did not pass mac-debug-ews (mac):
Output: http://webkit-queues.webkit.org/results/2819823

Number of test failures exceeded the failure limit.
Comment 4 Build Bot 2017-01-02 14:33:01 PST
Created attachment 297912 [details]
Archive of layout-test-results from ews112 for mac-elcapitan

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews112  Port: mac-elcapitan  Platform: Mac OS X 10.11.6
Comment 5 Geoffrey Garen 2017-01-03 11:01:22 PST
ASSERTION FAILED: m_didDeferGCWork == !!m_deferralDepth
/Volumes/Data/EWS/WebKit/Source/JavaScriptCore/heap/HeapInlines.h(332) : void JSC::Heap::decrementDeferralDepthAndGCIfNeeded()
1   0x101de0d70 WTFCrash
2   0x1009e031d JSC::Heap::decrementDeferralDepthAndGCIfNeeded()
3   0x1009e0278 JSC::DeferGC::~DeferGC()
4   0x1009e0205 JSC::DeferGC::~DeferGC()
5   0x1009e01b1 JSC::GCSafeConcurrentJSLocker::~GCSafeConcurrentJSLocker()
Comment 6 Filip Pizlo 2017-01-05 16:18:27 PST
Created attachment 298150 [details]
the patch
Comment 7 Filip Pizlo 2017-01-05 16:35:52 PST
Comment on attachment 298150 [details]
the patch

Still crashes on my machine.
Comment 8 Build Bot 2017-01-05 17:24:42 PST
Comment on attachment 298150 [details]
the patch

Attachment 298150 [details] did not pass mac-debug-ews (mac):
Output: http://webkit-queues.webkit.org/results/2840818

Number of test failures exceeded the failure limit.
Comment 9 Build Bot 2017-01-05 17:24:45 PST
Created attachment 298157 [details]
Archive of layout-test-results from ews116 for mac-elcapitan

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews116  Port: mac-elcapitan  Platform: Mac OS X 10.11.6
Comment 10 Filip Pizlo 2017-01-05 17:36:07 PST
It turns out that this assertion was just wrong!

I've replaced it with a comment explaining how all of the unexpected cases arise and why they are benign.
Comment 11 Filip Pizlo 2017-01-05 19:15:04 PST
Created attachment 298165 [details]
the patch
Comment 12 Filip Pizlo 2017-01-05 19:57:56 PST
Created attachment 298167 [details]
the patch
Comment 13 Saam Barati 2017-01-06 11:54:11 PST
Comment on attachment 298167 [details]
the patch

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

r=me

> Source/JavaScriptCore/heap/Heap.cpp:2092
> +void Heap::decrementDeferralDepthAndGCIfNeededSlow()

Name nit: This doesn't actually decrement the deferral depth, that's done by the caller. Maybe change the name accordingly?

> Source/JavaScriptCore/heap/HeapInlines.h:345
> +        // Only m_didDeferGCWork is true: Impossible. We stopped for GC and the GC did DeferGC.

If this is impossible why can't we assert this?
Comment 14 Filip Pizlo 2017-01-06 11:58:02 PST
(In reply to comment #13)
> Comment on attachment 298167 [details]
> the patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=298167&action=review
> 
> r=me
> 
> > Source/JavaScriptCore/heap/Heap.cpp:2092
> > +void Heap::decrementDeferralDepthAndGCIfNeededSlow()
> 
> Name nit: This doesn't actually decrement the deferral depth, that's done by
> the caller. Maybe change the name accordingly?

It's the slow path of decrementDeferralDepthAndGCIfNeeded(), so I think the name is right.

> 
> > Source/JavaScriptCore/heap/HeapInlines.h:345
> > +        // Only m_didDeferGCWork is true: Impossible. We stopped for GC and the GC did DeferGC.
> 
> If this is impossible why can't we assert this?

The word-sentence "Impossible." should not be there. I removed it.
Comment 15 Filip Pizlo 2017-01-06 12:24:42 PST
Landed in https://trac.webkit.org/changeset/210451
Comment 16 Radar WebKit Bug Importer 2017-01-06 15:26:31 PST
<rdar://problem/29909812>