Reviewers: acleung,

Description:
Adds extra optimization pass to eliminate more types in draftCompile.
This is needed for some libraries that depend on JSO devirtualization to
always be resolved from an interface to a SingleJsoImpl.


Please review this at http://gwt-code-reviews.appspot.com/1599803/

Affected files:
  M dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java
  M dev/core/src/com/google/gwt/dev/jjs/impl/DeadCodeElimination.java


Index: dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java
===================================================================
--- dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java (revision 10760) +++ dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java (working copy)
@@ -668,7 +668,10 @@
     Finalizer.exec(jprogram);
     MakeCallsStatic.exec(jprogram);
     jprogram.typeOracle.recomputeAfterOptimizations();
+    // needed for certain libraries that depend on dead stripping to work
     DeadCodeElimination.exec(jprogram);
+    Pruner.exec(jprogram, true);
+    jprogram.typeOracle.recomputeAfterOptimizations();
     draftOptimizeEvent.end();
   }

Index: dev/core/src/com/google/gwt/dev/jjs/impl/DeadCodeElimination.java
===================================================================
--- dev/core/src/com/google/gwt/dev/jjs/impl/DeadCodeElimination.java (revision 10760) +++ dev/core/src/com/google/gwt/dev/jjs/impl/DeadCodeElimination.java (working copy)
@@ -120,6 +120,8 @@
      */
private final Set<JExpression> ignoringExpressionOutput = new HashSet<JExpression>();

+ private final JMethod isScriptMethod = program.getIndexedMethod("GWT.isScript");
+
     /**
      * Expressions being used as lvalues.
      */
@@ -414,6 +416,9 @@
           // Tighten the target.
ctx.replaceMe(createClinitCall(x.getSourceInfo(), targetType.getClinitTarget()));
         }
+      } else if (target == isScriptMethod) {
+        // optimize out in draftCompiles that don't do inlining
+        ctx.replaceMe(JBooleanLiteral.TRUE);
       }
     }



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

Reply via email to