Two more ideas:
- V8 is using incremental marking for such wrappers which means that the
C++ graph should either (a) be immutable during marking or (b) should keep
the marking state consistent with e.g. write barriers.
- Specific issue: When creating an API object while marking is running, V8
may allocate the object as already marked (called black allocation). This
means that RegisterV8References() will not be called as the objects are not
discovered by the marker. In Blink, we thus issue a write barrier for such
objects when establishing a new link
<https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/bindings/v8_dom_wrapper.h?type=cs&q=SetNativeInfoInternal&sq=package:chromium&g=0&l=118>
.

We've some embedders that don't want to implement the incremental version
and they thus set the flag incremental_marking_wrappers
<https://cs.chromium.org/chromium/src/v8/src/flag-definitions.h?q=incremental_marking_wrappers&sq=package:chromium&g=0&l=712>
to false. You could try disabling that flag but also dropping predictable.

On Tue, Sep 25, 2018 at 6:36 PM 'Kenton Varda' via v8-users <
v8-users@googlegroups.com> wrote:

> Hi Michael,
>
> Thanks for commenting!
>
> On Tue, Sep 25, 2018 at 6:37 AM Michael Lippautz <mlippa...@chromium.org>
> wrote:
>
>> Looks like Isolate::VisitWeakHandles
>> <https://cs.chromium.org/chromium/src/v8/src/api.cc?q=Isolate::VisitWeakHandles&sq=package:chromium&g=0&l=8852>
>> only iterates over weak handles with a non-zero class id. Any chance that
>> this one is still 0?
>>
>
> No, I set class ID to 1 just before calling SetWeak() -- for no other
> purpose than this requirement. :)
>
>

Ack.


> The symptom described here hints to the Scavenger collecting objects. From
>> the above description it looks like you wanted to preserve those objects on
>> Scavenge.
>>
>> Some ideas:
>> - Maybe class id is 0 (see above)?
>> - Maybe the handle are not SetWeak
>> <https://cs.chromium.org/chromium/src/v8/include/v8.h?type=cs&q=v8::PersistentBase::SetWeak&sq=package:chromium&g=0&l=514>
>> immediately but only after some time where a Scavenge could've happened?
>>
>
> But before calling SetWeak(), the handle would be strong, and therefore
> not collected, right? Do I need to call MarkActive() at the same time as
> SetWeak() to make sure any currently-running scavenges don't collect it?
>
>
Yip, didn't think about this one. That all should work.

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to