Feng, Thanks for confirming that. I've already seen that the prototype is embedded inside the map. I', guessing that's why you said that I would "need to fix whole prototype chain for a cloned object". I'm doing some further digging on my own. Thanks.
Mark On Thu, Nov 13, 2008 at 8:58 AM, Feng Qian <[EMAIL PROTECTED]> wrote: > > After talking to other developers, I realized 'the hidden class' is map. > > JavaScript does not use static class info, but a lot of them are > created by a constructor function, and with the same set of > properties. A map is used to describe the set of objects with the same > set of properties. When one object is added a property that's > different from others, a new map is created. You can think the map is > copy on write thing. > > On Fri, Nov 7, 2008 at 10:21 AM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >> >> I'm referring to the hidden classes that is talked about here: >> http://code.google.com/apis/v8/design.html#prop_access >> >> So, are the hidden classes mentioned there actually the object >> Boilerplates, the __proto__, or something else? Is there perhaps some >> more detailed documentation about the design of v8 internals and data >> structures (particularly about object layout) that I can read to >> better understand this issue? >> >> Thanks. >> >> On Nov 7, 9:27 am, Feng Qian <[EMAIL PROTECTED]> wrote: >>> Do you mean 'hidden prototype object'? It is like a normal object >>> except that not accessible by JS code '__proto__'. >>> >>> I am not sure if object cloning can help much because you need to fix >>> whole prototype chain for a cloned object. V8 is doing something like >>> that for object literals (Boilerplate). >>> >>> On Thu, Nov 6, 2008 at 10:11 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> >>> wrote: >>> >>> > I've got a few questions regarding the representation of hidden >>> > classes: >>> >>> > 1. Which v8 data structure is the hidden class that the v8 literature >>> > talks about? >>> > 2. Are hidden classes supposed to be immutable? Or are they mutable >>> > like any JS Objects? >>> > 3. If immutable, is it possible to share the hidden classes across >>> > execution contexts? >>> > 4. If mutable and not shareable across execution contexts, are there >>> > any data structures that make up the object that is static meta-data >>> > that can be shared? >>> >>> > The reason for my asking is because I'm wondering if it is possible to >>> > use object cloning to speed up the process of populating a new context >>> > with objects. I'm looking for a mechanism (either an existing one or >>> > to write one myself) that is similar to snapshots. >>> >>> > The difference is that the snapshot mechanism seems to serialize the >>> > entire heap into a data stream that is later reloaded in entirety into >>> > a new launch of v8. What I want to do instead is to only clone one >>> > set of objects (as defined by a reference execution context) into a >>> > new context. Serializing/deserializing this set of objects can be >>> > done as an advanced exercise later. >>> >>> > I'm also hoping that the objects in the new context can reuse all the >>> > hidden classes from the reference context. This is why I'm asking if >>> > the hidden classes (which I presume are just collections of metadata) >>> > are immutable. >>> >>> > Please advise. Thanks. >> > >> > > > > --~--~---------~--~----~------------~-------~--~----~ v8-dev mailing list [email protected] http://groups.google.com/group/v8-dev -~----------~----~----~----~------~----~------~--~---
