v8/test/mjsunit/harmony/weakrefs
Sathya Gunasekaran 743ce7726d [WeakRefs] Make cleanup callback run as a task
Previously, this was run as a microtask and this CL changes it to run
as a separate task as mandated by the current WeakRef spec.

This CL also introduces a FinalizationGroup type to the V8 API
representing the JSFinalizationGroup. This has a `Cleanup`
function that runs the cleanup callback associated with it.

SetHostCleanupFinalizationGroupCallback is added to set
the embedder defined HostCleanupFinalizationGroupCallback.

ClearKeptObject is exposed on the v8::Isolate to reset the strongly
held set of objects.

The general workflow is the following:

(a) When the GC notices that a given finalization group has dirty
    cells, it calls HostCleanupFinalizationGroupCallback with the given
    finalization group.

(b) As part of HostCleanupFinalizationGroupCallback, the embedder
    enqueues a task that at some point later calls
    FinalizationGroup::Cleanup.

(c) At some point in the future, FinalizationGroup::Cleanup is called,
    which runs the cleanup callback of the finalization group.

This patch also includes d8 changes to use these new APIs. Currently,
d8 cycles through the enqueued finalization groups after a synchronous
turn (and it's microtask checkpoint) and runs the cleanup callbacks.

Change-Id: I06eb4da2c103b2792a9c62bc4b98fd4e5c4892fc
Bug: v8:8179
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1655655
Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Hannes Payer <hpayer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62984}
2019-07-30 12:19:39 +00:00
..
basics.js [WeakRefs] Make unregister spec compliant 2019-06-13 08:48:16 +00:00
cleanup-doesnt-iterate-all-holdings.js [WeakRefs] Make cleanup callback run as a task 2019-07-30 12:19:39 +00:00
cleanup-from-different-realm.js [js weak refs] Update to new API 2019-01-30 13:47:18 +00:00
cleanup-is-not-a-microtask.js [WeakRefs] Make cleanup callback run as a task 2019-07-30 12:19:39 +00:00
cleanup-on-detached-realm.js [WeakRefs] Make cleanup callback run as a task 2019-07-30 12:19:39 +00:00
cleanup-proxy-from-different-realm.js [js weak refs] Update to new API 2019-01-30 13:47:18 +00:00
cleanupsome-2.js [WeakRefs] Update cleanupSome to be spec compliant 2019-06-12 16:10:35 +00:00
cleanupsome-after-unregister.js [tests] Fix two tests to be --gc-interval robust 2019-05-17 16:59:37 +00:00
cleanupsome.js [WeakRefs] Update cleanupSome to be spec compliant 2019-06-12 16:10:35 +00:00
finalization-group-keeps-holdings-alive.js [js weak refs] Update to new API 2019-01-30 13:47:18 +00:00
finalizationgroup-and-weakref.js [WeakRefs] Make cleanup callback run as a task 2019-07-30 12:19:39 +00:00
finalizationgroup-scheduled-for-cleanup-multiple-times.js [js weak refs] Update to new API 2019-01-30 13:47:18 +00:00
iterating-in-cleanup.js [js weak refs] Update to new API 2019-01-30 13:47:18 +00:00
multiple-dirty-finalization-groups.js [js weak refs] Update to new API 2019-01-30 13:47:18 +00:00
two-weakrefs.js [WeakRefs] Make cleanup callback run as a task 2019-07-30 12:19:39 +00:00
undefined-holdings.js [js weak refs] Update to new API 2019-01-30 13:47:18 +00:00
unregister-after-cleanup.js [WeakRefs] Make unregister spec compliant 2019-06-13 08:48:16 +00:00
unregister-before-cleanup.js [WeakRefs] Make unregister spec compliant 2019-06-13 08:48:16 +00:00
unregister-called-twice.js [WeakRefs] Make unregister spec compliant 2019-06-13 08:48:16 +00:00
unregister-inside-cleanup1.js [WeakRefs] Make unregister spec compliant 2019-06-13 08:48:16 +00:00
unregister-inside-cleanup2.js [WeakRefs] Make unregister spec compliant 2019-06-13 08:48:16 +00:00
unregister-inside-cleanup3.js [WeakRefs] Make unregister spec compliant 2019-06-13 08:48:16 +00:00
unregister-inside-cleanup4.js [WeakRefs] Make unregister spec compliant 2019-06-13 08:48:16 +00:00
unregister-inside-cleanup5.js [WeakRefs] Make unregister spec compliant 2019-06-13 08:48:16 +00:00
unregister-many.js [WeakRefs] Make unregister spec compliant 2019-06-13 08:48:16 +00:00
unregister-when-cleanup-already-scheduled.js [WeakRefs] Make unregister spec compliant 2019-06-13 08:48:16 +00:00
weak-cell-basics.js [js weak refs] Update to new API 2019-01-30 13:47:18 +00:00
weakref-creation-keeps-alive.js [WeakRefs] Make cleanup callback run as a task 2019-07-30 12:19:39 +00:00
weakref-deref-keeps-alive.js [WeakRefs] Make cleanup callback run as a task 2019-07-30 12:19:39 +00:00