On Wed, Jul 24, 2013 at 9:19 PM, Nicholas Nethercote <[email protected]> wrote: > > "what exactly is a native object"?
sfink wrote about this in https://bugzilla.mozilla.org/show_bug.cgi?id=896759#c2. I've quoted it below. Nick In my mind, isNative()'s meaning is a gooey gob of stuff, one piece of which is "the objects' slots are Values that can hold strong pointers to gc things." So I figured that you could audit all of the flag tests, and see which of them used that aspect of the isNative() meaning. I was naively thinking that it would be a small number of places that would depend on this particular part of the meaning -- specifically, the ones that decided whether to mark the slots or not. I could be totally wrong, and this aspect of the meaning is too tangled up with the other aspects. For the record, my understanding of isNative() is based largely on guesswork and only a little on reading actual code. But I think of isNative() as meaning "native to the spidermonkey VM -- a 'normal' object, where we understand and control exactly how this object is going to accessed and updated, so we can make lots of assumptions about how it will behave." So, for example, a native Shape tells you everything you need to know about its layout. A NON_NATIVE object would be free to update multiple slots when you change one, change its layout, store raw data into the slots area, or in general break all kinds of invariants that most other objects can rely upon. As a result, it cannot use any of the fast paths unless its specific Class is checked for by some optimization that is aware that the NON_NATIVEness doesn't matter for that particular optimization. FWIW, my understanding of JSFunction::isNative() is the direct *opposite* of JSObject::isNative(). JSFunction::isNative() is "native to the host environment" and therefore alien to spidermonkey's regular way of doing things. A JSFunction::isNative() object has a function pointer (of type JSNative) that can do arbitrarily unexpected things and so can't use the usual fast paths. Assuming I am correct, one or the other or both of these really ought to be renamed. _______________________________________________ dev-tech-js-engine-internals mailing list [email protected] https://lists.mozilla.org/listinfo/dev-tech-js-engine-internals

