Em sex, 10 de abr de 2020 8:00 PM, 'Shu-yu Guo' via blink-dev <
[email protected]> escreveu:

> +v8-dev with right email address.
>
> On Fri, Apr 10, 2020 at 2:56 PM Shu-yu Guo <[email protected]> wrote:
>
>> Contact
>>
>> [email protected]
>>
>> [email protected]
>>
>> [email protected]
>>
>> Explainer
>>
>> https://v8.dev/features/weak-references
>>
>> https://github.com/tc39/proposal-weakrefs/blob/master/README.md
>>
>> https://github.com/tc39/proposal-weakrefs
>>
>> Spec
>>
>> https://tc39.es/proposal-weakrefs/
>>
>> https://github.com/w3ctag/design-reviews/issues/321
>>
>> Summary
>>
>> WeakRefs adds two fundamentally new capabilities to JavaScript:
>>
>>
>>    1.
>>
>>    Creating weak references to objects, with the WeakRef class
>>    2.
>>
>>    Running user-defined finalizers after objects are garbage-collected,
>>    with the FinalizationRegistry class
>>
>>
>> These two features are intended to be advanced, power user features. They
>> expose garbage collection (GC) behavior of the underlying implementation,
>> and using them correctly takes careful thought. The W3C Tag Design
>> Principles <https://w3ctag.github.io/design-principles/#js-gc> recommend
>> against APIs that expose GC, and the champions of this feature recommend
>> avoiding use of this feature if possible.
>>
>> At the same time, weak references and observing finalizations are
>> fundamental capabilities that cannot be expressed otherwise. This feature
>> is best recommended to be used to avoid excess memory use and as a backstop
>> against certain bugs, not as a normal way to clean up external resources
>> or to observe allocation.
>>
>> Notable semantics are as follows:
>>
>>
>>    -
>>
>>    The WeakRef class is tailored for the web’s event-loop based
>>    programming. A dereferenced WeakRef referent is guaranteed to be alive
>>    until the end of the current turn of the event loop.
>>    -
>>
>>    Finalization is post-mortem. Objects are not resurrectable.
>>    -
>>
>>    Finalization callbacks are by default processed in asynchronous tasks
>>    in batches.
>>    -
>>
>>    The ability to synchronously invoke finalizers is optional, and is pending
>>    discussion in HTML <https://github.com/whatwg/html/issues/5446>.
>>    WeakRefs will initially ship without this ability.
>>
>>
>> Please see the spec explainer <https://github.com/tc39/proposal-weakrefs>
>> and the V8 explainer <https://v8.dev/features/weak-references> for usage
>> examples of the WeakRef and FinalizationRegistry classes as well as in
>> depth semantics.
>>
>> Is this feature supported on all six Blink platforms (Windows, Mac,
>> Linux, Chrome OS, Android, and Android WebView)?
>>
>> Yes
>>
>> Debuggability
>>
>> WeakRefs and FinalizationRegistries are JS objects and are thus
>> inspectable. However, debugging weak references must be done very
>> carefully, as the act of debugging itself and observing objects alters the
>> garbage collection behavior. Debugging weak references and finalization is
>> intrinsically difficult, and the author must not depend e.g. an object
>> always being collected.
>>
>> Interoperability Risk
>>
>> This feature exposes garbage collection, and thus a degree of
>> interoperability risk is unavoidable. However, the V8 team at Google, the
>> JavaScriptCore team at Apple, and the SpiderMonkey team at Mozilla have
>> worked together on the design of the API to minimize risk where possible.
>>
>> This proposal reached Stage 3 at the June 2019 TC39.
>>
>> Firefox: Partially implemented
>> <https://bugzilla.mozilla.org/show_bug.cgi?id=1561074>
>>
>> Safari: Partially implemented
>> <https://bugs.webkit.org/show_bug.cgi?id=198710>
>>
>> Web / Framework developers: Positive. Many WebAssembly uses hinge on
>> being able to express weak references and finalization (e.g. vending
>> handles of wasm objects to JS). GSuite is also interested.
>>
>> Is this feature fully tested?
>>
>> Tests exist in Test262: WeakRef
>> <https://test262.report/browse/built-ins/WeakRef> and
>> FinalizationRegistry
>> <https://test262.report/browse/built-ins/FinalizationRegistry>. V8 has
>> also cctests and mjsunit tests.
>>
>> Preliminary web tests are in this CL
>> <https://chromium-review.googlesource.com/c/chromium/src/+/2145160>, and
>> Bocoup LLC is currently working on more comprehensive WPT tests for the
>> HTML integration.
>>
>> Note that any cross-implementation tests here are inherently
>> nondeterministic. They cannot test that an object must be collected, only
>> what must happen if an object is collected. An implementation that never
>> GCs is compliant.
>>
>> Tracking Bug
>>
>> https://bugs.chromium.org/p/v8/issues/detail?id=8179
>>
>> Feature Dashboard
>>
>> https://www.chromestatus.com/features/5892186633666560
>>
> --
> You received this message because you are subscribed to the Google Groups
> "blink-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAN-e9e8jxQHWDYjX3kURr1uKjLY9kXnhFR6ExCJBN3KtYeBhew%40mail.gmail.com
> <https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAN-e9e8jxQHWDYjX3kURr1uKjLY9kXnhFR6ExCJBN3KtYeBhew%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
-- 
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- 
You received this message because you are subscribed to the Google Groups 
"v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/v8-dev/CAAhy3EZYCrQLQ5FfX8cfDUgDR_zOVVzWAG_%3DKSEkzqctejWjaQ%40mail.gmail.com.

Reply via email to