On 3/28/15 11:08 PM, obastemur wrote:
"Use different JSNatives for different properties. Or a single JSNative,
but allocate the function yourself and use extra reserved slots on it to
store the property name... "
Unfortunately this may not be an option for many scenarios.
Which "this"? I offered two possible solutions, right?
SM also doesn't allow type changing + JS side objects doesn't have reserved
slots.
I'm not sure what you mean by "JS side objects" here. I'm specifically
suggesting that as long as you're willing to use jsfriendapi, any time
you're using a property with JSPropertyOp accessors you can instead use
a property with JSNative-backed accessors, where you create the
JSFunctions for those JSNatives yourself and do so using
js::NewFunctionWithReserved or js::NewFunctionByIdWithReserved. Those
Function objects will then have two extra reserved slots which you can
set via js::SetFunctionNativeReserved and read via
js::SetFunctionNativeReserved. You can then store the property name
involved in one of those slots.
Is it possible to keep this?
By which you mean JSPropertyOp accessors? It's _possible_, but not
exactly desirable. It adds a good bit of cognitive overhead for very
little gain.
-Boris
_______________________________________________
dev-tech-js-engine-internals mailing list
dev-tech-js-engine-internals@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-tech-js-engine-internals