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);
}
?
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.
However, my fear is copying prototype fields might hurt V8 optimizations, or
be atrociously slow on mobile browsers.
On Thu, Feb 17, 2011 at 3:27 PM, <[email protected]> wrote:
> High level, I think we should get rid of __newSeed__ and abolish the
> idea of seed functions entirely... we don't need them.
>
> Instead, we only setup prototypes on actual real live constructors. We
> also get rid of super-prototype-chaining. Instead, we just manually
> copy all the fields from the super-proto onto the sub proto. Setup is
> slightly slower, but then lookups throughout the program life cycle are
> faster.
>
>
> http://gwt-code-reviews.appspot.com/1360802/diff/1/4
> File dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaScriptAST.java
> (right):
>
> http://gwt-code-reviews.appspot.com/1360802/diff/1/4#newcode523
> dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaScriptAST.java:523:
> private int nextSeedId;
> Just assign it inline.
>
> http://gwt-code-reviews.appspot.com/1360802/diff/1/5
> File dev/core/src/com/google/gwt/dev/jjs/impl/SeedUtil.java (right):
>
> http://gwt-code-reviews.appspot.com/1360802/diff/1/5#newcode44
> dev/core/src/com/google/gwt/dev/jjs/impl/SeedUtil.java:44: private
> static final String DEFINE_SEED = "function
> __defineSeed__(id,superSeed,castableTypeMap,classLiteral) {\n"
> Would it be a huge pain to extern this into a .js file in the same
> package, and use getClass().getResource() one time to statically
> initialize?
>
> http://gwt-code-reviews.appspot.com/1360802/diff/1/5#newcode51
> dev/core/src/com/google/gwt/dev/jjs/impl/SeedUtil.java:51: + " _." +
> _CASTABLE_TYPE_MAP_MARKER + "=castableTypeMap;\n"
> If the castable type map optional? Should be optional for abstract
> types.
>
> http://gwt-code-reviews.appspot.com/1360802/diff/1/6
> File dev/core/src/com/google/gwt/dev/js/JsStackEmulator.java (right):
>
> http://gwt-code-reviews.appspot.com/1360802/diff/1/6#newcode566
> dev/core/src/com/google/gwt/dev/js/JsStackEmulator.java:566: private
> boolean inDefineSeedCall = false;
> Instead of doing this explicitly, what if emulation simply ignored any
> code that is SourceOrigin.UNKNOWN?
>
>
> http://gwt-code-reviews.appspot.com/1360802/show
>
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors