On 7/15/14, 12:08 AM, Nicholas Nethercote wrote:
And there are another 360-odd just like that. Lots of different
generated DOM bindings classes that have an isTrusted method,
basically. It's a little frustrating that we have so much generated
code that is really similar.
This case is a bit weird because there are tons of Event subclasses (115
to be exact) and "isTrusted" is marked unforgeable on Event, so each
Event instance gets an own property named isTrusted whose value is a new
Function object. That said, I'd think since shape doesn't cover
function values events that are the same event type would share the same
shape, no?
The actual generated code for isTrusted looks like this:
static bool
get_isTrusted(JSContext* cx, JS::Handle<JSObject*> obj,
mozilla::dom::MouseEvent* self, JSJitGetterCallArgs args)
{
bool result;
result = self->IsTrusted();
MOZ_ASSERT(!JS_IsExceptionPending(cx));
args.rval().setBoolean(result);
return true;
}
(with different types of the "self" argument for different event types).
So it doesn't compile to very much code, even with self->IsTrusted
(whose implementation is just "return mEvent->mFlags.mIsTrusted;")
getting inlined into the codegenned function.
We could try to share this function by generating it only once (for
Event) and then using it directly in the other binding classes. That
would mean making it non-static, but would be doable.
-Boris
_______________________________________________
dev-tech-js-engine-internals mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-internals