Package com.google.gwt.dev.jjs.impl.gflow.cfg

Examples of com.google.gwt.dev.jjs.impl.gflow.cfg.Cfg


    };
  }

  @Override
  public Cfg getNewSubgraph() {
    Cfg newSubgraph = new Cfg();
    CfgNode<?> newNode = new CfgNopNode(node.getParent(), node.getJNode());
    newSubgraph.addNode(newNode);

    // Add all incoming edges.
    for (int i = 0; i < graph.getInEdges(node).size(); ++i) {
      CfgEdge edge = new CfgEdge();
      newSubgraph.addIn(newNode, edge);
      newSubgraph.addGraphInEdge(edge);
    }

    for (CfgEdge e : graph.getOutEdges(node)) {
      CfgEdge edge = new CfgEdge(e.getRole());
      newSubgraph.addGraphOutEdge(edge);

      if (e.getRole() != null
          && ((e.getRole().equals(CfgConditionalNode.ELSE) && conditionValue) ||
              (e.getRole().equals(CfgConditionalNode.THEN) && !conditionValue))) {
        // Do not connect this edge due to constant condition.
      } else {
        newSubgraph.addOut(newNode, edge);
      }
    }

    return newSubgraph;
  }
View Full Code Here


  protected AnalysisResult analyzeWithParams(String returnType, String params,
      String... codeSnippet) throws UnableToCompleteException {
    JProgram program = compileSnippet(returnType, params, Joiner.on("\n").join(codeSnippet), true);
    JMethodBody body = (JMethodBody) findMainMethod(program).getBody();
    Cfg cfgGraph = CfgBuilder.build(program, body.getBlock());

    assertNotNull(cfgGraph);

    Map<CfgEdge, A> map = AnalysisSolver.solve(cfgGraph, createAnalysis(), forward);
    return new AnalysisResult(cfgGraph, map);
View Full Code Here

  protected boolean forward = true;

  @Override
  protected boolean optimizeMethod(JProgram program, JMethod method) {
    JMethodBody body = (JMethodBody) method.getBody();
    Cfg cfgGraph = CfgBuilder.build(program, body.getBlock());

    assertNotNull(cfgGraph);

    return AnalysisSolver.solveIntegrated(cfgGraph, createIntegratedAnalysis(), forward);
  }
View Full Code Here

  private class DataflowOptimizerVisitor extends JModVisitor {

    @Override
    public boolean visit(JMethodBody methodBody, Context ctx) {
      Cfg cfg = CfgBuilder.build(program, methodBody.getBlock());

      JMethod method = methodBody.getMethod();
      JDeclaredType enclosingType = method.getEnclosingType();
      String methodName = enclosingType.getName() + "." + method.getName();
View Full Code Here

TOP

Related Classes of com.google.gwt.dev.jjs.impl.gflow.cfg.Cfg

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.