On Thu, Feb 17, 2011 at 6:43 PM, Ray Cromwell <[email protected]>wrote:

> So your proposal is something like this:
>
> setupVtable(castableTypeMap, someSuperCtor, ctor1, ctor2);
>
>
> function setupVtable(ctm, supCtor) {
>     var newProto = {};
>     copyProtoFields(someSuperCtor.prototype, newProto);
>     for(var i = 2; i < arguments.length; i++) {
>      arguments[i].prototype = newProto;
>    }
>    newProto.castableTypeMap = ctm;
>    newProto.getClass = getLazyLiteral(...n);
> }
>

Something like that, yep.  Just need to figure out what to do if there
aren't any super ctors (maybe they got inlined?).
- Use ids after all?
- Make a synthetic super ctor just for this purpose?
- Just attach super symbols directly to concrete type.

Actually, #3 might be a reasonable speed vs. size tradeoff, maybe we should
get rid of even virtual proto chaining.


> One of the other things I want to do is eliminate global class literal
> fields in favor of lazily constructed ones, so that Foo.class is replaced
> with getLazyLiteral(someToken), and Object.getClass() is setup dynamically
> as well. Class literals are responsible for enormous bloat currently.
>

SG.


> However, my fear is copying prototype fields might hurt V8 optimizations,
> or be atrociously slow on mobile browsers.
>

Will need to test and find out.  It might actually be better than having to
go through a multi-level lookup chain.

-- 
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to