Author: kpro...@google.com
Date: Mon Dec 15 18:47:24 2008
New Revision: 4344

Modified:
     
trunk/dev/core/src/com/google/gwt/core/ext/linker/CompilationAnalysis.java
     
trunk/dev/core/src/com/google/gwt/core/ext/linker/impl/StandardCompilationAnalysis.java
    trunk/dev/core/src/com/google/gwt/core/linker/soyc/SoycReportLinker.java
    trunk/dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java
    trunk/dev/core/src/com/google/gwt/dev/jjs/ast/JProgram.java
    trunk/dev/core/src/com/google/gwt/dev/jjs/impl/ReplaceRunAsyncs.java

Log:
Added functionality to map runAsync split points and fragment numbers to  
the methods that they are placed in.  This information is accessed by SOYC  
and displayed in the SOYC dashboard.



Modified:  
trunk/dev/core/src/com/google/gwt/core/ext/linker/CompilationAnalysis.java
==============================================================================
---  
trunk/dev/core/src/com/google/gwt/core/ext/linker/CompilationAnalysis.java      
 
(original)
+++  
trunk/dev/core/src/com/google/gwt/core/ext/linker/CompilationAnalysis.java      
 
Mon Dec 15 18:47:24 2008
@@ -21,6 +21,7 @@
  import com.google.gwt.core.ext.soyc.Range;
  import com.google.gwt.core.ext.soyc.Story;

+import java.util.Map;
  import java.util.SortedSet;

  /**
@@ -74,6 +75,11 @@
     * Ranges, plus the overhead of constructing an ordered Map.
     */
    public abstract Iterable<Snippet> getSnippets(int fragmentNumber);
+
+  /**
+   * Returns splitPointMap.
+   */
+  public abstract Map<Integer, String> getSplitPointMap();

    /**
     * Returns all Stories.

Modified:  
trunk/dev/core/src/com/google/gwt/core/ext/linker/impl/StandardCompilationAnalysis.java
==============================================================================
---  
trunk/dev/core/src/com/google/gwt/core/ext/linker/impl/StandardCompilationAnalysis.java
  
(original)
+++  
trunk/dev/core/src/com/google/gwt/core/ext/linker/impl/StandardCompilationAnalysis.java
  
Mon Dec 15 18:47:24 2008
@@ -55,6 +55,7 @@
  import java.util.Set;
  import java.util.SortedSet;
  import java.util.Stack;
+import java.util.TreeMap;
  import java.util.TreeSet;

  /**
@@ -115,17 +116,25 @@
    private transient Map<Correlation, Member> membersByCorrelation = new  
IdentityHashMap<Correlation, Member>();

    /**
+   * Map from split point numbers to the method where they were set
+   */
+  private Map<Integer, String> splitPointMap = new TreeMap<Integer,  
String>();
+
+  /**
     * Constructed by PermutationCompiler.
     */
    public StandardCompilationAnalysis(TreeLogger logger,
-      List<Map<Range, SourceInfo>> sourceInfoMaps)
+      List<Map<Range, SourceInfo>> sourceInfoMaps,
+      Map<Integer, String> splitPointMap)
        throws UnableToCompleteException {
      super(StandardLinkerContext.class);
      logger = logger.branch(TreeLogger.INFO,
          "Creating CompilationAnalysis (this may take some time)");

      data = new Data();
-
+
+    this.splitPointMap = splitPointMap;
+
      /*
       * Don't retain beyond the constructor to avoid lingering references  
to AST
       * nodes.
@@ -197,6 +206,11 @@
      };
    }

+  @Override
+  public Map<Integer, String> getSplitPointMap(){
+    return splitPointMap;
+  }
+
    @Override
    public SortedSet<Story> getStories() {
      return data.stories;

Modified:  
trunk/dev/core/src/com/google/gwt/core/linker/soyc/SoycReportLinker.java
==============================================================================
---  
trunk/dev/core/src/com/google/gwt/core/linker/soyc/SoycReportLinker.java        
 
(original)
+++  
trunk/dev/core/src/com/google/gwt/core/linker/soyc/SoycReportLinker.java        
 
Mon Dec 15 18:47:24 2008
@@ -65,7 +65,6 @@
  @LinkerOrder(Order.PRE)
  public class SoycReportLinker extends AbstractLinker {

-  int curNumIndents = 0;

    public String escapeXml(String unescaped) {
      String escaped = unescaped.replaceAll("\\&", "&amp;");
@@ -161,32 +160,29 @@
      if (methodAliases.size() > 0) {
        htmlOut.indentIn();
        htmlOut.indentIn();
-      curNumIndents++;

        curLine = "<aliases>";
-      htmlOut.printRawOpt(curLine);
-      htmlOut.newlineOpt();
+      htmlOut.printRaw(curLine);
+      htmlOut.newline();
        htmlOut.indentIn();
        htmlOut.indentIn();
-      curNumIndents++;
      }

      for (String methodAlias : methodAliases) {
        curLine = "<alias jsName=\"" + methodAlias + "\"/>";
-      htmlOut.printRawOpt(curLine);
-      htmlOut.newlineOpt();
+      htmlOut.printRaw(curLine);
+      htmlOut.newline();
      }
      if (methodAliases.size() > 0) {
        htmlOut.indentOut();
        htmlOut.indentOut();
-      curNumIndents--;
-
+
        curLine = "</aliases>";
-      htmlOut.printRawOpt(curLine);
-      htmlOut.newlineOpt();
+      htmlOut.printRaw(curLine);
+      htmlOut.newline();
        htmlOut.indentOut();
        htmlOut.indentOut();
-      curNumIndents--;
+
      }
    }

@@ -205,7 +201,7 @@
      for (String className : sortedClasses.keySet()) {
        ClassMember classMember = sortedClasses.get(className);
        curLine = "<class id=\"" + className + "\" ";
-      htmlOut.printRawOpt(curLine);
+      htmlOut.printRaw(curLine);

        String jsName = classMember.getJsName();
        String name = className.substring(className.lastIndexOf('.') + 1);
@@ -221,8 +217,8 @@
        emitFields(htmlOut, classMember);

        curLine = "</class>";
-      htmlOut.printRawOpt(curLine);
-      htmlOut.newlineOpt();
+      htmlOut.printRaw(curLine);
+      htmlOut.newline();
      }
    }

@@ -232,31 +228,30 @@
      if (dependencies.size() > 0) {
        htmlOut.indentIn();
        htmlOut.indentIn();
-      curNumIndents++;

        curLine = "<depends>";
-      htmlOut.printRawOpt(curLine);
-      htmlOut.newlineOpt();
+      htmlOut.printRaw(curLine);
+      htmlOut.newline();
        htmlOut.indentIn();
        htmlOut.indentIn();
-      curNumIndents++;
+
      }
      for (Member dependency : dependencies) {
        curLine = "<on idref=\"" + dependency.getSourceName() + "\"/>";
-      htmlOut.printRawOpt(curLine);
-      htmlOut.newlineOpt();
+      htmlOut.printRaw(curLine);
+      htmlOut.newline();
      }
      if (dependencies.size() > 0) {
        htmlOut.indentOut();
        htmlOut.indentOut();
-      curNumIndents--;
+

        curLine = "</depends>";
-      htmlOut.printRawOpt(curLine);
-      htmlOut.newlineOpt();
+      htmlOut.printRaw(curLine);
+      htmlOut.newline();
        htmlOut.indentOut();
        htmlOut.indentOut();
-      curNumIndents--;
+
      }
    }

@@ -266,7 +261,7 @@
      if (fields.size() > 0) {
        htmlOut.indentIn();
        htmlOut.indentIn();
-      curNumIndents++;
+
      }
      for (FieldMember field : fields) {
        curLine = "<field id=\"" + field.getSourceName() + "\" jsName=\""
@@ -275,13 +270,13 @@
        if (curJsName == null) {
          curLine = "<field id=\"" + field.getSourceName() + "\"/>";
        }
-      htmlOut.printRawOpt(curLine);
-      htmlOut.newlineOpt();
+      htmlOut.printRaw(curLine);
+      htmlOut.newline();
      }
      if (fields.size() > 0) {
        htmlOut.indentOut();
        htmlOut.indentOut();
-      curNumIndents--;
+
      }
    }

@@ -291,7 +286,7 @@
      Set<FunctionMember> functions = report.getFunctions();
      for (FunctionMember function : functions) {
        curLine = "<function ";
-      htmlOut.printRawOpt(curLine);
+      htmlOut.printRaw(curLine);

        String sourceName = function.getSourceName();
        String jsName = function.getJsName();
@@ -301,45 +296,44 @@
          if (jsName == null) {
            curLine = "id=\"" + sourceName + "\"/>";
          }
-        htmlOut.printRawOpt(curLine);
+        htmlOut.printRaw(curLine);
          htmlOut.newline();
        } else {
          curLine = "id=\"" + sourceName + "\" jsName=\"" + jsName + "\">";
          if (jsName == null) {
            curLine = "id=\"" + sourceName + "\">";
          }
-        htmlOut.printRawOpt(curLine);
+        htmlOut.printRaw(curLine);
          htmlOut.newline();
          htmlOut.indentIn();
          htmlOut.indentIn();
-        curNumIndents++;

          curLine = "<depends>";
-        htmlOut.printRawOpt(curLine);
+        htmlOut.printRaw(curLine);
          htmlOut.newline();
          htmlOut.indentIn();
          htmlOut.indentIn();
-        curNumIndents++;
+
        }
        for (Member dependency : dependencies) {
          curLine = "<on idref=\"" + dependency.getSourceName() + "\"/>";
-        htmlOut.printRawOpt(curLine);
+        htmlOut.printRaw(curLine);
          htmlOut.newline();
        }
        if (dependencies.size() > 0) {
          htmlOut.indentOut();
          htmlOut.indentOut();
-        curNumIndents--;
+
          curLine = "</depends>";
-        htmlOut.printRawOpt(curLine);
+        htmlOut.printRaw(curLine);
          htmlOut.newline();
          htmlOut.indentOut();
          htmlOut.indentOut();
-        curNumIndents--;
+

          curLine = "</function>";
-        htmlOut.printRawOpt(curLine);
-        htmlOut.newlineOpt();
+        htmlOut.printRaw(curLine);
+        htmlOut.newline();
        }
      }
    }
@@ -351,12 +345,11 @@
      int fragment = 0;
      for (String contents : report.getCompilationResult().getJavaScript()) {
        curLine = "<js fragment=\"" + fragment + "\">";
-      htmlOut.printRawOpt(curLine);
-      htmlOut.newlineOpt();
-
+      htmlOut.printRaw(curLine);
+      htmlOut.newline();
        htmlOut.indentIn();
        htmlOut.indentIn();
-      curNumIndents++;
+

        for (Snippet snippet : report.getSnippets(fragment)) {
          Range range = snippet.getRange();
@@ -373,17 +366,17 @@
            curLine = "<storyref idref=\"story" + Integer.toString(storyId)
                + "\">" + jsCode + "</storyref>";
          }
-        htmlOut.printRawOpt(curLine);
-        htmlOut.newlineOpt();
+        htmlOut.printRaw(curLine);
+        htmlOut.newline();
        }

        htmlOut.indentOut();
        htmlOut.indentOut();
-      curNumIndents--;
+

        curLine = "</js>";
-      htmlOut.printRawOpt(curLine);
-      htmlOut.newlineOpt();
+      htmlOut.printRaw(curLine);
+      htmlOut.newline();
        fragment++;
      }
    }
@@ -406,69 +399,69 @@
      HtmlTextOutput htmlOut = new HtmlTextOutput(pw, false);

      String curLine = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
-    htmlOut.printRawOpt(curLine);
+    htmlOut.printRaw(curLine);
      htmlOut.newline();
      curLine = "<soyc-manifest>";
-    htmlOut.printRawOpt(curLine);
+    htmlOut.printRaw(curLine);
      htmlOut.newline();
      htmlOut.indentIn();
      htmlOut.indentIn();
-    curNumIndents++;
+

      for (Map.Entry<CompilationResult, String> entry :  
partialPathsByResult.entrySet()) {
        curLine = "<report href=\"" + entry.getValue() + "\">";
-      htmlOut.printRawOpt(curLine);
+      htmlOut.printRaw(curLine);
        htmlOut.newline();
        htmlOut.indentIn();
        htmlOut.indentIn();
-      curNumIndents++;
+

        for (Map<SelectionProperty, String> map :  
entry.getKey().getPropertyMap()) {

          if (map.size() > 0) {
            curLine = "<permutation>";
-          htmlOut.printRawOpt(curLine);
+          htmlOut.printRaw(curLine);
            htmlOut.newline();
            htmlOut.indentIn();
            htmlOut.indentIn();
-          curNumIndents++;
+

          } else {
            curLine = "<permutation/>";
-          htmlOut.printRawOpt(curLine);
+          htmlOut.printRaw(curLine);
            htmlOut.newline();
          }
          for (Map.Entry<SelectionProperty, String> propertyEntry :  
map.entrySet()) {
            curLine = "<property name=\"" + propertyEntry.getKey().getName()
                + "\" value=\"" + propertyEntry.getValue() + "\"/>";
-          htmlOut.printRawOpt(curLine);
+          htmlOut.printRaw(curLine);
            htmlOut.newline();
          }
          if (map.size() > 0) {
            htmlOut.indentOut();
            htmlOut.indentOut();
-          curNumIndents--;
+

            curLine = "</permutation>";
-          htmlOut.printRawOpt(curLine);
+          htmlOut.printRaw(curLine);
            htmlOut.newline();
          }
        }
        htmlOut.indentOut();
        htmlOut.indentOut();
-      curNumIndents--;
+

        curLine = "</report>";
-      htmlOut.printRawOpt(curLine);
+      htmlOut.printRaw(curLine);
        htmlOut.newline();
      }

      htmlOut.indentOut();
      htmlOut.indentOut();
-    curNumIndents--;
+

      curLine = "</soyc-manifest>";
-    htmlOut.printRawOpt(curLine);
+    htmlOut.printRaw(curLine);
      htmlOut.newline();

      pw.close();
@@ -480,16 +473,13 @@
    }

    private void emitMembers(CompilationAnalysis report, HtmlTextOutput  
htmlOut) {
-    String curLine;
-
-    curLine = "<members>";
-
-    htmlOut.printRawOpt(curLine);
-    htmlOut.newlineOpt();
+
+    String curLine = "<members>";
+    htmlOut.printRaw(curLine);
+    htmlOut.newline();
      htmlOut.indentIn();
      htmlOut.indentIn();
-    curNumIndents++;
-
+
      SortedMap<String, Set<ClassMember>> packageToClasses = new  
TreeMap<String, Set<ClassMember>>();

      emitPackages(report, htmlOut, packageToClasses);
@@ -497,11 +487,9 @@

      htmlOut.indentOut();
      htmlOut.indentOut();
-    curNumIndents--;
-
      curLine = "</members>";
-    htmlOut.printRawOpt(curLine);
-    htmlOut.newlineOpt();
+    htmlOut.printRaw(curLine);
+    htmlOut.newline();
    }

    private void emitMethodDependencies(HtmlTextOutput htmlOut,
@@ -510,65 +498,58 @@
      if (methodDependencies.size() > 0) {
        htmlOut.indentIn();
        htmlOut.indentIn();
-      curNumIndents++;
-
+
        curLine = "<depends>";
-      htmlOut.printRawOpt(curLine);
-      htmlOut.newlineOpt();
+      htmlOut.printRaw(curLine);
+      htmlOut.newline();
        htmlOut.indentIn();
        htmlOut.indentIn();
-      curNumIndents++;
+

        for (Member methodDependency : methodDependencies) {
          curLine = "<on idref=\"" + methodDependency.getSourceName()  
+ "\"/>";
-        htmlOut.printRawOpt(curLine);
-        htmlOut.newlineOpt();
+        htmlOut.printRaw(curLine);
+        htmlOut.newline();
        }

        htmlOut.indentOut();
        htmlOut.indentOut();
-      curNumIndents--;

        curLine = "</depends>";
-      htmlOut.printRawOpt(curLine);
-      htmlOut.newlineOpt();
+      htmlOut.printRaw(curLine);
+      htmlOut.newline();
        htmlOut.indentOut();
        htmlOut.indentOut();
-      curNumIndents--;
      }
    }

-  private void emitMethodOverrides(HtmlTextOutput htmlOut,
-      Set<MethodMember> methodOverrides) {
+  private void emitMethodOverrides(HtmlTextOutput htmlOut,  
Set<MethodMember> methodOverrides) {
      String curLine;
      if (methodOverrides.size() > 0) {
        htmlOut.indentIn();
        htmlOut.indentIn();
-      curNumIndents++;
-
+
        curLine = "<override>";
-      htmlOut.printRawOpt(curLine);
-      htmlOut.newlineOpt();
+      htmlOut.printRaw(curLine);
+      htmlOut.newline();
        htmlOut.indentIn();
        htmlOut.indentIn();
-      curNumIndents++;
+
      }
      for (MethodMember overrideMethodMember : methodOverrides) {
        curLine = "<of idref=\"" + overrideMethodMember.getSourceName()  
+ "\"/>";
-      htmlOut.printRawOpt(curLine);
-      htmlOut.newlineOpt();
+      htmlOut.printRaw(curLine);
+      htmlOut.newline();
      }
      if (methodOverrides.size() > 0) {
        htmlOut.indentOut();
        htmlOut.indentOut();
-      curNumIndents--;
-
+
        curLine = "</override>";
-      htmlOut.printRawOpt(curLine);
-      htmlOut.newlineOpt();
+      htmlOut.printRaw(curLine);
+      htmlOut.newline();
        htmlOut.indentOut();
        htmlOut.indentOut();
-      curNumIndents--;
      }
    }

@@ -578,11 +559,11 @@
      if (methods.size() > 0) {
        htmlOut.indentIn();
        htmlOut.indentIn();
-      curNumIndents++;
+
      }
      for (MethodMember method : methods) {
        curLine = "<method ";
-      htmlOut.printRawOpt(curLine);
+      htmlOut.printRaw(curLine);

        String jsAtt = " jsName=\"" + method.getJsName() + "\"";
        String curJsName = method.getJsName();
@@ -598,12 +579,12 @@
        if ((methodOverrides.size() > 0) || (methodDependencies.size() > 0)
            || (methodAliases.size() > 0)) {
          curLine = "id=\"" + method.getSourceName() + "\"" + jsAtt + ">";
-        htmlOut.printRawOpt(curLine);
-        htmlOut.newlineOpt();
+        htmlOut.printRaw(curLine);
+        htmlOut.newline();
        } else {
          curLine = "id=\"" + method.getSourceName() + "\"" + jsAtt + "/>";
-        htmlOut.printRawOpt(curLine);
-        htmlOut.newlineOpt();
+        htmlOut.printRaw(curLine);
+        htmlOut.newline();
        }

        emitAliases(htmlOut, methodAliases);
@@ -613,50 +594,50 @@
        if ((methodOverrides.size() > 0) || (methodDependencies.size() > 0)
            || (methodAliases.size() > 0)) {
          curLine = "</method>";
-        htmlOut.printRawOpt(curLine);
-        htmlOut.newlineOpt();
+        htmlOut.printRaw(curLine);
+        htmlOut.newline();
        }
      }

      if (methods.size() > 0) {
        htmlOut.indentOut();
        htmlOut.indentOut();
-      curNumIndents--;
+
      }
    }

    private void emitOverrides(HtmlTextOutput htmlOut, String curLine,
        ClassMember classMember) {
-    htmlOut.printRawOpt(curLine);
-    htmlOut.newlineOpt();
+    htmlOut.printRaw(curLine);
+    htmlOut.newline();
      Set<ClassMember> overrides = classMember.getOverrides();
      if (overrides.size() > 0) {
        htmlOut.indentIn();
        htmlOut.indentIn();
-      curNumIndents++;
+
        curLine = "<override>";
-      htmlOut.printRawOpt(curLine);
-      htmlOut.newlineOpt();
+      htmlOut.printRaw(curLine);
+      htmlOut.newline();
        htmlOut.indentIn();
        htmlOut.indentIn();
-      curNumIndents++;
+
      }
      for (ClassMember overrideClassMember : overrides) {
        curLine = "<of idref=\"" + overrideClassMember.getSourceName()  
+ "\"/>";
-      htmlOut.printRawOpt(curLine);
-      htmlOut.newlineOpt();
+      htmlOut.printRaw(curLine);
+      htmlOut.newline();
      }
      if (overrides.size() > 0) {
        htmlOut.indentOut();
        htmlOut.indentOut();
-      curNumIndents--;
+

        curLine = "</override>";
-      htmlOut.printRawOpt(curLine);
-      htmlOut.newlineOpt();
+      htmlOut.printRaw(curLine);
+      htmlOut.newline();
        htmlOut.indentOut();
        htmlOut.indentOut();
-      curNumIndents--;
+
      }
    }

@@ -678,24 +659,23 @@
      for (String packageName : packageToClasses.keySet()) {

        curLine = "<package id=\"" + packageName + "\">";
-      htmlOut.printRawOpt(curLine);
-      htmlOut.newlineOpt();
+      htmlOut.printRaw(curLine);
+      htmlOut.newline();

        if (packageToClasses.get(packageName).size() > 0) {
          htmlOut.indentIn();
          htmlOut.indentIn();
-        curNumIndents++;
+
        }
        emitClasses(htmlOut, packageToClasses, packageName);
        if (packageToClasses.get(packageName).size() > 0) {
          htmlOut.indentOut();
          htmlOut.indentOut();
-        curNumIndents--;
        }

        curLine = "</package>";
-      htmlOut.printRawOpt(curLine);
-      htmlOut.newlineOpt();
+      htmlOut.printRaw(curLine);
+      htmlOut.newline();
      }
    }

@@ -715,15 +695,35 @@
      PrintWriter pw = new PrintWriter(out);
      HtmlTextOutput htmlOut = new HtmlTextOutput(pw, false);

+
      String curLine = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
-    htmlOut.printRawOpt(curLine);
-    htmlOut.newlineOpt();
+    htmlOut.printRaw(curLine);
+    htmlOut.newline();
      curLine = "<soyc>";
-    htmlOut.printRawOpt(curLine);
-    htmlOut.newlineOpt();
+    htmlOut.printRaw(curLine);
+    htmlOut.newline();
      htmlOut.indentIn();
      htmlOut.indentIn();
-    curNumIndents++;
+
+
+    Map<Integer, String> splitPointMap = new TreeMap<Integer,  
String>(report.getSplitPointMap());
+    if (splitPointMap.size() > 0){
+      curLine = "<splitpoints>";
+      htmlOut.printRaw(curLine);
+      htmlOut.newline();
+      htmlOut.indentIn();
+      htmlOut.indentIn();
+      for (Integer splitPointCount : splitPointMap.keySet()){
+        curLine = "<splitpoint id=\"" + splitPointCount + "\" location=\""  
+ splitPointMap.get(splitPointCount) + "\"/>";
+        htmlOut.printRaw(curLine);
+        htmlOut.newline();
+      }
+      htmlOut.indentOut();
+      htmlOut.indentOut();
+      curLine = "</splitpoints>";
+      htmlOut.printRaw(curLine);
+      htmlOut.newline();
+    }

      emitMembers(report, htmlOut);
      Map<Story, Integer> storyIds = emitStories(report, htmlOut);
@@ -731,11 +731,9 @@

      htmlOut.indentOut();
      htmlOut.indentOut();
-    curNumIndents--;
-
      curLine = "</soyc>";
-    htmlOut.printRawOpt(curLine);
-    htmlOut.newlineOpt();
+    htmlOut.printRaw(curLine);
+    htmlOut.newline();

      pw.close();
      Utility.close(out);
@@ -752,13 +750,13 @@
      Map<Story, Integer> storyIds = new HashMap<Story, Integer>();
      Set<Story> stories = report.getStories();
      curLine = "<stories>";
-    htmlOut.printRawOpt(curLine);
-    htmlOut.newlineOpt();
+    htmlOut.printRaw(curLine);
+    htmlOut.newline();

      if (stories.size() > 0) {
        htmlOut.indentIn();
        htmlOut.indentIn();
-      curNumIndents++;
+
      }
      for (Story story : stories) {

@@ -770,88 +768,85 @@
          curLine = curLine + " literal=\"" + story.getLiteralTypeName()  
+ "\"";
        }
        curLine = curLine + ">";
-      htmlOut.printRawOpt(curLine);
-      htmlOut.newlineOpt();
+      htmlOut.printRaw(curLine);
+      htmlOut.newline();

        Set<Origin> origins = story.getSourceOrigin();
        if (origins.size() > 0) {
          htmlOut.indentIn();
          htmlOut.indentIn();
-        curNumIndents++;
+

          curLine = "<origins>";
-        htmlOut.printRawOpt(curLine);
-        htmlOut.newlineOpt();
+        htmlOut.printRaw(curLine);
+        htmlOut.newline();
          htmlOut.indentIn();
          htmlOut.indentIn();
-        curNumIndents++;
+
        }
        for (Origin origin : origins) {
          curLine = "<origin lineNumber=\""
              + Integer.toString(origin.getLineNumber()) + "\" location=\""
              + origin.getLocation() + "\"/>";
-        htmlOut.printRawOpt(curLine);
-        htmlOut.newlineOpt();
+        htmlOut.printRaw(curLine);
+        htmlOut.newline();
        }
        if (origins.size() > 0) {
          htmlOut.indentOut();
          htmlOut.indentOut();
-        curNumIndents--;
+

          curLine = "</origins>";
-        htmlOut.printRawOpt(curLine);
-        htmlOut.newlineOpt();
+        htmlOut.printRaw(curLine);
+        htmlOut.newline();

          htmlOut.indentOut();
          htmlOut.indentOut();
-        curNumIndents--;
        }

        Set<Member> correlations = story.getMembers();
        if (correlations.size() > 0) {
          htmlOut.indentIn();
          htmlOut.indentIn();
-        curNumIndents++;

          curLine = "<correlations>";
-        htmlOut.printRawOpt(curLine);
-        htmlOut.newlineOpt();
+        htmlOut.printRaw(curLine);
+        htmlOut.newline();

          htmlOut.indentIn();
          htmlOut.indentIn();
-        curNumIndents++;
+
        }
        for (Member correlation : correlations) {
          curLine = "<by idref=\"" + correlation.getSourceName() + "\"/>";
-        htmlOut.printRawOpt(curLine);
-        htmlOut.newlineOpt();
+        htmlOut.printRaw(curLine);
+        htmlOut.newline();
        }
        if (correlations.size() > 0) {
          htmlOut.indentOut();
          htmlOut.indentOut();
-        curNumIndents--;
+

          curLine = "</correlations>";
-        htmlOut.printRawOpt(curLine);
-        htmlOut.newlineOpt();
+        htmlOut.printRaw(curLine);
+        htmlOut.newline();

          htmlOut.indentOut();
          htmlOut.indentOut();
-        curNumIndents--;
        }

        curLine = "</story>";
-      htmlOut.printRawOpt(curLine);
-      htmlOut.newlineOpt();
+      htmlOut.printRaw(curLine);
+      htmlOut.newline();
      }
      if (stories.size() > 0) {
        htmlOut.indentOut();
        htmlOut.indentOut();
-      curNumIndents--;
+
      }
      curLine = "</stories>";
-    htmlOut.printRawOpt(curLine);
-    htmlOut.newlineOpt();
+    htmlOut.printRaw(curLine);
+    htmlOut.newline();

      return storyIds;
    }

Modified:  
trunk/dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java
==============================================================================
--- trunk/dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java     
 
(original)
+++ trunk/dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java     
 
Mon Dec 15 18:47:24 2008
@@ -261,7 +261,8 @@
        PermutationResult toReturn = new PermutationResultImpl(js);
        if (sourceInfoMaps != null) {
          toReturn.getArtifacts().add(
-            new StandardCompilationAnalysis(logger, sourceInfoMaps));
+            new StandardCompilationAnalysis(logger, sourceInfoMaps,
+                jprogram.getSplitPointMap()));
        }

        return toReturn;

Modified: trunk/dev/core/src/com/google/gwt/dev/jjs/ast/JProgram.java
==============================================================================
--- trunk/dev/core/src/com/google/gwt/dev/jjs/ast/JProgram.java (original)
+++ trunk/dev/core/src/com/google/gwt/dev/jjs/ast/JProgram.java Mon Dec 15  
18:47:24 2008
@@ -37,6 +37,7 @@
  import java.util.List;
  import java.util.Map;
  import java.util.Set;
+import java.util.TreeMap;
  import java.util.TreeSet;

  /**
@@ -164,10 +165,10 @@
    public final List<JClassType> codeGenTypes = new ArrayList<JClassType>();

    /**
-   * There is a list containing the main entry methods as well as the  
entry methods for
-   * each split point.  The main entry methods are at entry 0 of this  
list.  Split
-   * points are numbered sequentially from 1, and the entry methods for  
split point
-   * <em>i</em> are at entry <em>i</em> of this list.
+   * There is a list containing the main entry methods as well as the entry
+   * methods for each split point. The main entry methods are at entry 0  
of this
+   * list. Split points are numbered sequentially from 1, and the entry  
methods
+   * for split point <em>i</em> are at entry <em>i</em> of this list.
     */
    public final List<List<JMethod>> entryMethods = new  
ArrayList<List<JMethod>>();

@@ -236,6 +237,8 @@

    private Map<JReferenceType, Integer> queryIds;

+  private Map<Integer, String> splitPointMap = new TreeMap<Integer,  
String>();
+
    private final Map<JMethod, JMethod> staticToInstanceMap = new  
IdentityHashMap<JMethod, JMethod>();

    private final JPrimitiveType typeBoolean = new JPrimitiveType(this,
@@ -769,6 +772,10 @@
      return integer.intValue();
    }

+  public Map<Integer, String> getSplitPointMap() {
+    return splitPointMap;
+  }
+
    public JMethod getStaticImpl(JMethod method) {
      return instanceToStaticMap.get(method);
    }
@@ -914,10 +921,14 @@
      this.queryIds = queryIds;
    }

+  public void setSplitPointMap(Map<Integer, String> splitPointMap) {
+    this.splitPointMap = splitPointMap;
+  }
+
    /**
-   * If <code>method</code> is a static impl method, returns the instance
-   * method that <code>method</code> is the implementation of. Otherwise,
-   * returns <code>null</code>.
+   * If <code>method</code> is a static impl method, returns the instance  
method
+   * that <code>method</code> is the implementation of. Otherwise, returns
+   * <code>null</code>.
     */
    public JMethod staticImplFor(JMethod method) {
      return staticToInstanceMap.get(method);

Modified:  
trunk/dev/core/src/com/google/gwt/dev/jjs/impl/ReplaceRunAsyncs.java
==============================================================================
--- trunk/dev/core/src/com/google/gwt/dev/jjs/impl/ReplaceRunAsyncs.java        
 
(original)
+++ trunk/dev/core/src/com/google/gwt/dev/jjs/impl/ReplaceRunAsyncs.java        
 
Mon Dec 15 18:47:24 2008
@@ -26,6 +26,10 @@
  import com.google.gwt.dev.jjs.ast.JProgram;
  import com.google.gwt.dev.jjs.ast.JType;

+import java.util.HashMap;
+import java.util.Map;
+import java.util.TreeMap;
+
  /**
   * Replaces calls to
   * {...@link  
com.google.gwt.core.client.GWT#runAsync(com.google.gwt.core.client.RunAsyncCallback)}"
@@ -34,6 +38,8 @@
  public class ReplaceRunAsyncs {
    private class AsyncCreateVisitor extends JModVisitor {
      private JMethod currentMethod;
+    private Map<Integer, String> splitPointMap = new TreeMap<Integer,  
String>();
+    private Map<String, Integer> methodCount = new HashMap<String,  
Integer>();
      private int entryCount = 1;

      @Override
@@ -46,7 +52,17 @@
          int entryNumber = entryCount++;
          logger.log(TreeLogger.INFO, "Assigning split point #" + entryNumber
              + " in method " + fullMethodDescription(currentMethod));
-
+
+        String methodDescription = fullMethodDescription(currentMethod);
+        if (methodCount.containsKey(methodDescription)){
+          methodCount.put(methodDescription,  
methodCount.get(methodDescription)+1);
+          methodDescription += "#" +  
Integer.toString(methodCount.get(methodDescription));
+        }
+        else{
+          methodCount.put(methodDescription, 1);
+        }
+        splitPointMap.put(entryNumber, methodDescription);
+
          JClassType loader = getFragmentLoader(entryNumber);
          JMethod loadMethod = getRunAsyncMethod(loader);
          assert loadMethod != null;
@@ -89,6 +105,9 @@
      AsyncCreateVisitor visitor = new AsyncCreateVisitor();
      visitor.accept(program);
      setNumEntriesInAsyncFragmentLoader(visitor.entryCount);
+    program.setSplitPointMap(visitor.splitPointMap);
+
+
      return visitor.entryCount;
    }


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

Reply via email to