Essential speedup when reading fields FasterSieve
authorJaroslav Tulach <jaroslav.tulach@apidesign.org>
Sun, 24 Jan 2016 17:00:17 +0100
branchFasterSieve
changeset 19513781fd782472
parent 1950 71e5cd5b29bc
Essential speedup when reading fields
rt/vm/src/main/java/org/apidesign/vm4brwsr/ByteCodeToJavaScript.java
     1.1 --- a/rt/vm/src/main/java/org/apidesign/vm4brwsr/ByteCodeToJavaScript.java	Sun Jan 24 14:31:36 2016 +0100
     1.2 +++ b/rt/vm/src/main/java/org/apidesign/vm4brwsr/ByteCodeToJavaScript.java	Sun Jan 24 17:00:17 2016 +0100
     1.3 @@ -1427,10 +1427,9 @@
     1.4                      final int type = VarType.fromFieldType(fi[2].charAt(0));
     1.5                      final String mangleClass = mangleClassName(fi[0]);
     1.6                      final String mangleClassAccess = accessClassFalse(mangleClass);
     1.7 -                    smapper.replace(this, type, "@2.call(@1)",
     1.8 -                         smapper.getA(0),
     1.9 -                         accessField(mangleClassAccess,
    1.10 -                                     "_" + fi[1], fi)
    1.11 +                    emit(smapper, this, "var @2 = @1.fld_@4_@3 || @5.call(@1);",
    1.12 +                         smapper.popA(), smapper.pushT(type), fi[1], mangleClass,
    1.13 +                         accessField(mangleClassAccess, "_" + fi[1], fi)
    1.14                      );
    1.15                      i += 2;
    1.16                      addReference(fi[0]);