[[Invoke]] and implicit method calls

Boris Zbarsky bzbarsky at MIT.EDU
Wed Sep 18 20:58:06 PDT 2013

On 9/18/13 10:11 PM, Brendan Eich wrote:
> Boris is working on Proxy-based form objects.

Not working on.  They've been shipping for multiple Firefox releases now.

Of more interest than forms is the fact that "window" and "document" are 
both proxies.  So document.getElementById is a method call on a proxy, 
for example.

Also, foo.style is a proxy.  Method calls on that are rare, but 
getter/setter invocations are common, of course.

Now in practice SpiderMonkey has some special-casing already for these 
proxies internally.  For example, we know, with just a shape guard on 
the "target" that foo.style.display will in fact end up calling a getter 
on the proto and just bypass the proxy hooks altogether for that get. 
We have similar things for the Document object.  Invoking DOM methods on 
it still has about 2x the overhead of invoking them on normal DOM 
objects, but I expect we'll be able to fix that.

For non-built-in stuff ("expandos"), of course, things are slow on document.

And "window" is a special snowflake in all sorts of ways, of course...

> Your CPython argument is suspect, but the real data we seek is a
> JS-specific perf bake-off, more than Shumway but at least that: some
> significant macro-benchmark suite that exercises method calls and
> methods as funargs, and that is not synthetic or based on old/rare real
> world code.

Sure would be nice.  ;)


More information about the es-discuss mailing list