Examples of JMultiExpression


Examples of com.google.gwt.dev.jjs.ast.js.JMultiExpression

      // Convert into a comma operation, such as:
      // (t = x, x += 1, t)

      // First, replace the arg with a non-side-effect causing one.
      enterTempUsageScope();
      JMultiExpression multi = new JMultiExpression(x.getSourceInfo());
      ReplaceSideEffectsInLvalue replacer = new ReplaceSideEffectsInLvalue(
          multi);
      JExpression newArg = replacer.accept(x.getArg());

      JExpression expressionReturn = expressionToReturn(newArg);
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.js.JMultiExpression

     * ensures that clinits maintain the same execution order relative to
     * parameters in deeply-inlined scenarios.
     */
    // (a, b).foo() --> (a, foo(b))
    if (x.getInstance() instanceof JMultiExpression) {
      JMultiExpression multi = (JMultiExpression) x.getInstance();
      int lastIndex = multi.exprs.size() - 1;
      newCall.addArg(multi.exprs.get(lastIndex));
      newCall.addArgs(x.getArgs());
      multi.exprs.set(lastIndex, newCall);
      return multi;
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.js.JMultiExpression

       * okay as the children will already be flattened.
       */
      for (int i = 0; i < exprs.size(); ++i) {
        JExpression expr = (JExpression) exprs.get(i);
        if (expr instanceof JMultiExpression) {
          JMultiExpression sub = (JMultiExpression) expr;
          exprs.addAll(i + 1, sub.exprs);
          didChange = true;
        }
      }

View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.js.JMultiExpression

     */
    private void tryInlineEmptyMethodCall(JMethodCall x, Context ctx) {
      if (checkClinitViolation(x, null)) {
        return;
      }
      JMultiExpression multi = new JMultiExpression(program, x.getSourceInfo());
      JExpression instance = x.getInstance();
      if (instance != null && instance.hasSideEffects()) {
        multi.exprs.add(x.getInstance());
      }
      for (int i = 0, c = x.getArgs().size(); i < c; ++i) {
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.js.JMultiExpression

      }

      // the argument that is returned by the inlined method
      int iMagicArg = magicArg[0];

      JMultiExpression multi = new JMultiExpression(program, x.getSourceInfo());

      // Evaluate the instance argument (we can have one even with static calls)
      JExpression instance = x.getInstance();
      if (instance != null && instance.hasSideEffects()) {
        multi.exprs.add(x.getInstance());
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.js.JMultiExpression

      }

      if (countSideEffectsBeforeLast == 0) {
        ctx.replaceMe((JExpression) x.exprs.get(c - 1));
      } else {
        JMultiExpression newMulti = new JMultiExpression(program,
            x.getSourceInfo());
        for (int i = 0; i < c - 1; ++i) {
          JExpression expr = (JExpression) exprs.get(i);
          if (expr.hasSideEffects()) {
            newMulti.exprs.add(expr);
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.js.JMultiExpression

         * the left hand size must be computed twice, we have to replace any
         * left-hand side expressions that could have side effects with
         * temporaries, so that they are only run once.
         */
        final int pushUsedLocals = localIndex;
        JMultiExpression multi = new JMultiExpression(program,
            x.getSourceInfo());
        ReplaceSideEffectsInLvalue replacer = new ReplaceSideEffectsInLvalue(
            multi);
        JExpression newLhs = replacer.accept(x.getLhs());
        localIndex = pushUsedLocals;

        JNullLiteral litNull = program.getLiteralNull();
        JBinaryOperation operation = new JBinaryOperation(program,
            x.getSourceInfo(), newLhs.getType(), JBinaryOperator.DIV, newLhs,
            x.getRhs());
        JBinaryOperation asg = new JBinaryOperation(program, x.getSourceInfo(),
            newLhs.getType(), JBinaryOperator.ASG, newLhs, operation);

        JMultiExpression multiExpr = replacer.getMultiExpr();
        if (multiExpr.exprs.isEmpty()) {
          // just use the split assignment expression
          ctx.replaceMe(asg);
        } else {
          // add the assignment as the last item in the multi
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.js.JMultiExpression

       * irrelevant. We can inline the constant, if any, but we might also need
       * to evaluate an instance and run a clinit.
       */
      // We can inline the constant, but we might also need to evaluate an
      // instance and run a clinit.
      JMultiExpression multi = new JMultiExpression(program, x.getSourceInfo());

      JExpression instance = x.getInstance();
      if (instance != null) {
        multi.exprs.add(instance);
      }
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.js.JMultiExpression

          possibleToInline = false;
        } else if (!body.locals.isEmpty()) {
          // methods with local variables cannot be inlined
          possibleToInline = false;
        } else {
          JMultiExpression multi = createMultiExpressionFromBody(body,
              ignoringReturnValueFor == x);
          if (multi != null) {
            possibleToInline = tryInlineExpression(x, ctx, multi);
          }
        }
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.js.JMultiExpression

     * possible clinit. This is a precursor for inlining the remainder of a
     * method.
     */
    private JMultiExpression createMultiExpressionForInstanceAndClinit(
        JMethodCall x) {
      JMultiExpression multi = new JMultiExpression(program, x.getSourceInfo());

      // Any instance expression goes first (this can happen even with statics).
      if (x.getInstance() != null) {
        multi.exprs.add(x.getInstance());
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.