It's not about tight coupling, but about level of indirecton. v8 uses several moving gc algorithms. for example, sailfish (js engine in Safari, e.g.) doesn't use moving algorithms and thus doesn't need handles at all.
yours, anton. On Thu, Apr 1, 2010 at 5:31 PM, Evgeny Astigeevich <[email protected]> wrote: > Thanks a lot. > This explains the code completely. > For me it's strange to have an abstraction of handle with tight > coupling to the internal implementation of handles. Guess this is done > due to perfomance reasons. > > On Apr 1, 5:07 pm, Anton Muhin <[email protected]> wrote: >> Sorry about assert, it's in internal handles (v8::internal::Handle). >> >> Despite it's name val_ in v8::Handle is actually >> v8::internal::Object** ---it's a location where a pointer to actual v8 >> object is stored. v8's garbage collector is aware of all such handles >> and would update v8::internal::Object* pointers when object is moved. >> >> To see the problem you need the code like that (sorry, is not tested). >> >> Local handleA(some object); >> Local handleB(*handleA); >> >> with your change handleA != handleB (as they use different locations >> to store pointers---their val_ should be different). W/o handleA == >> handleB as both point to the same object. >> >> yours, >> anton. > > -- > v8-dev mailing list > [email protected] > http://groups.google.com/group/v8-dev > > To unsubscribe, reply using "remove me" as the subject. > -- v8-dev mailing list [email protected] http://groups.google.com/group/v8-dev
