Bug 168257 - Add JSC_sweepSynchronously and fix JSC_useZombieMode options.
Summary: Add JSC_sweepSynchronously and fix JSC_useZombieMode options.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Mark Lam
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-02-13 14:55 PST by Mark Lam
Modified: 2017-02-14 11:15 PST (History)
7 users (show)

See Also:


Attachments
proposed patch. (4.35 KB, patch)
2017-02-13 15:00 PST, Mark Lam
msaboff: review+
Details | Formatted Diff | Diff
proposed patch with fixes. (5.10 KB, patch)
2017-02-13 17:43 PST, Mark Lam
saam: review+
Details | Formatted Diff | Diff
proposed patch. (7.73 KB, patch)
2017-02-14 11:10 PST, Mark Lam
fpizlo: 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 2017-02-13 14:55:10 PST
Patch coming.
Comment 1 Mark Lam 2017-02-13 14:56:43 PST
<rdar://problem/30451496>
Comment 2 Mark Lam 2017-02-13 15:00:41 PST
Created attachment 301396 [details]
proposed patch.

Let's get some EWS testing on this.
Comment 3 Mark Lam 2017-02-13 16:59:34 PST
Comment on attachment 301396 [details]
proposed patch.

Looks ready for a review.
Comment 4 Michael Saboff 2017-02-13 17:14:09 PST
Comment on attachment 301396 [details]
proposed patch.

r=me
Comment 5 Mark Lam 2017-02-13 17:28:04 PST
Comment on attachment 301396 [details]
proposed patch.

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

> Source/JavaScriptCore/heap/Heap.cpp:1060
> +        sweepSynchronously();
> +        if (Options::useZombieMode())
> +            zombifyDeadObjects();

Turns out this is not needed because collectSync() above will take care of invoking sweepSynchronously() and zombifyDeadObjects() if needed.  I'll also add some GC logging when zombifying.  Updated patch coming soon.
Comment 6 Mark Lam 2017-02-13 17:32:42 PST
Comment on attachment 301396 [details]
proposed patch.

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

>> Source/JavaScriptCore/heap/Heap.cpp:1060
>> +            zombifyDeadObjects();
> 
> Turns out this is not needed because collectSync() above will take care of invoking sweepSynchronously() and zombifyDeadObjects() if needed.  I'll also add some GC logging when zombifying.  Updated patch coming soon.

Correction: sweepSyncronously is still needed if neither Options::sweepSynchronously() or Options::useZombieMode() are set because collectSync() does not sweep synchronously by default.  Will fix.
Comment 7 Mark Lam 2017-02-13 17:43:35 PST
Created attachment 301428 [details]
proposed patch with fixes.
Comment 8 Saam Barati 2017-02-13 17:48:13 PST
Comment on attachment 301428 [details]
proposed patch with fixes.

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

LGTM

> Source/JavaScriptCore/heap/Heap.cpp:1043
> +        dataLog("=> ", capacity() / 1024, "kb, ", after - before, "ms] ");

Why not put the "\n" here?

> Source/JavaScriptCore/heap/Heap.cpp:1980
> +        dataLog("=> ", capacity() / 1024, "kb, ", after - before, "ms] ");

ditto
Comment 9 Mark Lam 2017-02-13 17:55:56 PST
Comment on attachment 301428 [details]
proposed patch with fixes.

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

Thanks for the review.

>> Source/JavaScriptCore/heap/Heap.cpp:1043
>> +        dataLog("=> ", capacity() / 1024, "kb, ", after - before, "ms] ");
> 
> Why not put the "\n" here?

Because this function may be called from Heap::finalize() which has its own logging which wraps this line.  Putting a '\n' here will premature terminate the "[GC: finalize ...]" logging in Heap::finalize().

>> Source/JavaScriptCore/heap/Heap.cpp:1980
>> +        dataLog("=> ", capacity() / 1024, "kb, ", after - before, "ms] ");
> 
> ditto

Same as above.
Comment 10 Mark Lam 2017-02-14 11:10:16 PST
Created attachment 301526 [details]
proposed patch.

One more time: this time, re-define useZombieMode as the combination of sweepSynchronously + scribbleFreeCells.
Comment 11 Mark Lam 2017-02-14 11:15:28 PST
Thanks for the reviews.  Landed in r212310: <http://trac.webkit.org/r212310>.