On Wed, Jan 30, 2019 at 9:15 PM 'Kenton Varda' via v8-users <
v8-users@googlegroups.com> wrote:

> One more low-level question (where it seems like implementation details
> matter to embedders):
>
> Based on what you've said, an object may or may not be "black" on
> allocation. It seems, though, that I need to do different things depending
> on the color. If it is allocated black, then I need to arrange to trace the
> object myself to register all its outgoing references. If it is white, then
> I need to call RegisterExternalReference(), and V8 will trace it later. If
> it's gray, I don't need to do anything.
>
> But if I don't know the color, it seems I need to *both* call
> RegisterExternalReference() and initiate my own trace to cover all bases.
> But in the case that it's not already-black, this will result in a
> redundant trace later on.
>
>
The redundant trace can be avoided by having a color marker on the C++
object itself so that it only traces through it once.

Ultimately, solving all those issues leads to having a fully trace-based
system with marking colors on the C++ side too. We went that way because we
need a system to collect reference cycles and the easiest way to do so is
by basing the whole system on tracing.


> Is it best to live with this potential redundant trace, or is there some
> way I can detect the color after allocation?
>

There's no way to detect the color as we have changed the internal
implementation in the past and may do so in future.

-Michael

-- 
-- 
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