jdk.nashorn.internal.ir.JoinPredecessorExpression Java Examples

The following examples show how to use jdk.nashorn.internal.ir.JoinPredecessorExpression. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Parser.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * ...IterationStatement :
 *           ...
 *           while ( Expression ) Statement
 *           ...
 *
 * See 12.6
 *
 * Parse while statement.
 */
private void whileStatement() {
    // Capture WHILE token.
    final long whileToken = token;
    // WHILE tested in caller.
    next();

    // Construct WHILE node.
    WhileNode whileNode = new WhileNode(line, whileToken, Token.descPosition(whileToken), false);
    lc.push(whileNode);

    try {
        expect(LPAREN);
        final int whileLine = line;
        final JoinPredecessorExpression test = joinPredecessorExpression();
        expect(RPAREN);
        final Block body = getStatement();
        appendStatement(whileNode =
            new WhileNode(whileLine, whileToken, finish, false).
                setTest(lc, test).
                setBody(lc, body));
    } finally {
        lc.pop(whileNode);
    }
}
 
Example #2
Source File: LocalVariableTypesCalculator.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean enterForNode(final ForNode forNode) {
    if(!reachable) {
        return false;
    }

    final Expression init = forNode.getInit();
    if(forNode.isForIn()) {
        final JoinPredecessorExpression iterable = forNode.getModify();
        visitExpression(iterable);
        enterTestFirstLoop(forNode, null, init,
                // If we're iterating over property names, and we can discern from the runtime environment
                // of the compilation that the object being iterated over must use strings for property
                // names (e.g., it is a native JS object or array), then we'll not bother trying to treat
                // the property names optimistically.
                !compiler.useOptimisticTypes() || (!forNode.isForEach() && compiler.hasStringPropertyIterator(iterable.getExpression())));
    } else {
        if(init != null) {
            visitExpressionOnEmptyStack(init);
        }
        enterTestFirstLoop(forNode, forNode.getModify(), null, false);
    }
    assertTypeStackIsEmpty();
    return false;
}
 
Example #3
Source File: LocalVariableTypesCalculator.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean enterForNode(final ForNode forNode) {
    if(!reachable) {
        return false;
    }

    final Expression init = forNode.getInit();
    if(forNode.isForInOrOf()) {
        final JoinPredecessorExpression iterable = forNode.getModify();
        visitExpression(iterable);
        enterTestFirstLoop(forNode, null, init,
                // If we're iterating over property names, and we can discern from the runtime environment
                // of the compilation that the object being iterated over must use strings for property
                // names (e.g., it is a native JS object or array), then we'll not bother trying to treat
                // the property names optimistically.
                !compiler.useOptimisticTypes() || (!forNode.isForEach() && compiler.hasStringPropertyIterator(iterable.getExpression())));
    } else {
        if(init != null) {
            visitExpressionOnEmptyStack(init);
        }
        enterTestFirstLoop(forNode, forNode.getModify(), null, false);
    }
    assertTypeStackIsEmpty();
    return false;
}
 
Example #4
Source File: Parser.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * ...IterationStatement :
 *           ...
 *           while ( Expression ) Statement
 *           ...
 *
 * See 12.6
 *
 * Parse while statement.
 */
private void whileStatement() {
    // Capture WHILE token.
    final long whileToken = token;
    // WHILE tested in caller.
    next();

    // Construct WHILE node.
    WhileNode whileNode = new WhileNode(line, whileToken, Token.descPosition(whileToken), false);
    lc.push(whileNode);

    try {
        expect(LPAREN);
        final int whileLine = line;
        final JoinPredecessorExpression test = joinPredecessorExpression();
        expect(RPAREN);
        final Block body = getStatement();
        appendStatement(whileNode =
            new WhileNode(whileLine, whileToken, finish, false).
                setTest(lc, test).
                setBody(lc, body));
    } finally {
        lc.pop(whileNode);
    }
}
 
Example #5
Source File: LocalVariableTypesCalculator.java    From jdk8u_nashorn with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean enterForNode(final ForNode forNode) {
    if(!reachable) {
        return false;
    }

    final Expression init = forNode.getInit();
    if(forNode.isForIn()) {
        final JoinPredecessorExpression iterable = forNode.getModify();
        visitExpression(iterable);
        enterTestFirstLoop(forNode, null, init,
                // If we're iterating over property names, and we can discern from the runtime environment
                // of the compilation that the object being iterated over must use strings for property
                // names (e.g., it is a native JS object or array), then we'll not bother trying to treat
                // the property names optimistically.
                !compiler.useOptimisticTypes() || (!forNode.isForEach() && compiler.hasStringPropertyIterator(iterable.getExpression())));
    } else {
        if(init != null) {
            visitExpressionOnEmptyStack(init);
        }
        enterTestFirstLoop(forNode, forNode.getModify(), null, false);
    }
    assertTypeStackIsEmpty();
    return false;
}
 
Example #6
Source File: Parser.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * ...IterationStatement :
 *           ...
 *           while ( Expression ) Statement
 *           ...
 *
 * See 12.6
 *
 * Parse while statement.
 */
private void whileStatement() {
    // Capture WHILE token.
    final long whileToken = token;
    // WHILE tested in caller.
    next();

    // Construct WHILE node.
    WhileNode whileNode = new WhileNode(line, whileToken, Token.descPosition(whileToken), false);
    lc.push(whileNode);

    try {
        expect(LPAREN);
        final int whileLine = line;
        final JoinPredecessorExpression test = joinPredecessorExpression();
        expect(RPAREN);
        final Block body = getStatement();
        appendStatement(whileNode =
            new WhileNode(whileLine, whileToken, finish, false).
                setTest(lc, test).
                setBody(lc, body));
    } finally {
        lc.pop(whileNode);
    }
}
 
Example #7
Source File: Parser.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * ...IterationStatement :
 *           ...
 *           while ( Expression ) Statement
 *           ...
 *
 * See 12.6
 *
 * Parse while statement.
 */
private void whileStatement() {
    // Capture WHILE token.
    final long whileToken = token;
    // WHILE tested in caller.
    next();

    // Construct WHILE node.
    WhileNode whileNode = new WhileNode(line, whileToken, Token.descPosition(whileToken), false);
    lc.push(whileNode);

    try {
        expect(LPAREN);
        final int whileLine = line;
        final JoinPredecessorExpression test = joinPredecessorExpression();
        expect(RPAREN);
        final Block body = getStatement();
        appendStatement(whileNode =
            new WhileNode(whileLine, whileToken, finish, false).
                setTest(lc, test).
                setBody(lc, body));
    } finally {
        lc.pop(whileNode);
    }
}
 
Example #8
Source File: LocalVariableTypesCalculator.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean enterForNode(final ForNode forNode) {
    if(!reachable) {
        return false;
    }

    final Expression init = forNode.getInit();
    if(forNode.isForIn()) {
        final JoinPredecessorExpression iterable = forNode.getModify();
        visitExpression(iterable);
        enterTestFirstLoop(forNode, null, init,
                // If we're iterating over property names, and we can discern from the runtime environment
                // of the compilation that the object being iterated over must use strings for property
                // names (e.g., it is a native JS object or array), then we'll not bother trying to treat
                // the property names optimistically.
                !compiler.useOptimisticTypes() || (!forNode.isForEach() && compiler.hasStringPropertyIterator(iterable.getExpression())));
    } else {
        if(init != null) {
            visitExpressionOnEmptyStack(init);
        }
        enterTestFirstLoop(forNode, forNode.getModify(), null, false);
    }
    assertTypeStackIsEmpty();
    return false;
}
 
Example #9
Source File: LocalVariableTypesCalculator.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean enterForNode(final ForNode forNode) {
    if(!reachable) {
        return false;
    }

    final Expression init = forNode.getInit();
    if(forNode.isForIn()) {
        final JoinPredecessorExpression iterable = forNode.getModify();
        visitExpression(iterable);
        enterTestFirstLoop(forNode, null, init,
                // If we're iterating over property names, and we can discern from the runtime environment
                // of the compilation that the object being iterated over must use strings for property
                // names (e.g., it is a native JS object or array), then we'll not bother trying to treat
                // the property names optimistically.
                !compiler.useOptimisticTypes() || (!forNode.isForEach() && compiler.hasStringPropertyIterator(iterable.getExpression())));
    } else {
        if(init != null) {
            visitExpressionOnEmptyStack(init);
        }
        enterTestFirstLoop(forNode, forNode.getModify(), null, false);
    }
    assertTypeStackIsEmpty();
    return false;
}
 
Example #10
Source File: LocalVariableTypesCalculator.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean enterForNode(final ForNode forNode) {
    if(!reachable) {
        return false;
    }

    final Expression init = forNode.getInit();
    if(forNode.isForIn()) {
        final JoinPredecessorExpression iterable = forNode.getModify();
        visitExpression(iterable);
        enterTestFirstLoop(forNode, null, init,
                // If we're iterating over property names, and we can discern from the runtime environment
                // of the compilation that the object being iterated over must use strings for property
                // names (e.g., it is a native JS object or array), then we'll not bother trying to treat
                // the property names optimistically.
                !compiler.useOptimisticTypes() || (!forNode.isForEach() && compiler.hasStringPropertyIterator(iterable.getExpression())));
    } else {
        if(init != null) {
            visitExpressionOnEmptyStack(init);
        }
        enterTestFirstLoop(forNode, forNode.getModify(), null, false);
    }
    assertTypeStackIsEmpty();
    return false;
}
 
Example #11
Source File: Parser.java    From jdk8u_nashorn with GNU General Public License v2.0 6 votes vote down vote up
/**
 * ...IterationStatement :
 *           ...
 *           while ( Expression ) Statement
 *           ...
 *
 * See 12.6
 *
 * Parse while statement.
 */
private void whileStatement() {
    // Capture WHILE token.
    final long whileToken = token;
    // WHILE tested in caller.
    next();

    // Construct WHILE node.
    WhileNode whileNode = new WhileNode(line, whileToken, Token.descPosition(whileToken), false);
    lc.push(whileNode);

    try {
        expect(LPAREN);
        final int whileLine = line;
        final JoinPredecessorExpression test = joinPredecessorExpression();
        expect(RPAREN);
        final Block body = getStatement();
        appendStatement(whileNode =
            new WhileNode(whileLine, whileToken, finish, false).
                setTest(lc, test).
                setBody(lc, body));
    } finally {
        lc.pop(whileNode);
    }
}
 
Example #12
Source File: LocalVariableTypesCalculator.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean enterForNode(final ForNode forNode) {
    if(!reachable) {
        return false;
    }

    final Expression init = forNode.getInit();
    if(forNode.isForIn()) {
        final JoinPredecessorExpression iterable = forNode.getModify();
        visitExpression(iterable);
        enterTestFirstLoop(forNode, null, init,
                // If we're iterating over property names, and we can discern from the runtime environment
                // of the compilation that the object being iterated over must use strings for property
                // names (e.g., it is a native JS object or array), then we'll not bother trying to treat
                // the property names optimistically.
                !compiler.useOptimisticTypes() || (!forNode.isForEach() && compiler.hasStringPropertyIterator(iterable.getExpression())));
    } else {
        if(init != null) {
            visitExpressionOnEmptyStack(init);
        }
        enterTestFirstLoop(forNode, forNode.getModify(), null, false);
    }
    assertTypeStackIsEmpty();
    return false;
}
 
Example #13
Source File: Parser.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * ...IterationStatement :
 *           ...
 *           while ( Expression ) Statement
 *           ...
 *
 * See 12.6
 *
 * Parse while statement.
 */
private void whileStatement() {
    // Capture WHILE token.
    final long whileToken = token;
    // WHILE tested in caller.
    next();

    // Construct WHILE node.
    WhileNode whileNode = new WhileNode(line, whileToken, Token.descPosition(whileToken), false);
    lc.push(whileNode);

    try {
        expect(LPAREN);
        final int whileLine = line;
        final JoinPredecessorExpression test = joinPredecessorExpression();
        expect(RPAREN);
        final Block body = getStatement();
        appendStatement(whileNode =
            new WhileNode(whileLine, whileToken, finish, false).
                setTest(lc, test).
                setBody(lc, body));
    } finally {
        lc.pop(whileNode);
    }
}
 
Example #14
Source File: BranchOptimizer.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private void optimizeLogicalOperand(final Expression expr, final Label label, final boolean state, final boolean isRhs) {
    final JoinPredecessorExpression jpexpr = (JoinPredecessorExpression)expr;
    if(LocalVariableConversion.hasLiveConversion(jpexpr)) {
        final Label after = new Label("after");
        branchOptimizer(jpexpr.getExpression(), after, !state);
        method.beforeJoinPoint(jpexpr);
        method._goto(label);
        method.label(after);
        if(isRhs) {
            method.beforeJoinPoint(jpexpr);
        }
    } else {
        branchOptimizer(jpexpr.getExpression(), label, state);
    }
}
 
Example #15
Source File: Parser.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * ...IterationStatement :
 *           ...
 *           do Statement while( Expression ) ;
 *           ...
 *
 * See 12.6
 *
 * Parse DO WHILE statement.
 */
private void doStatement() {
    // Capture DO token.
    final long doToken = token;
    // DO tested in the caller.
    next();

    WhileNode doWhileNode = new WhileNode(-1, doToken, Token.descPosition(doToken), true);
    lc.push(doWhileNode);

    try {
       // Get DO body.
        final Block body = getStatement();

        expect(WHILE);
        expect(LPAREN);
        final int doLine = line;
        final JoinPredecessorExpression test = joinPredecessorExpression();
        expect(RPAREN);

        if (type == SEMICOLON) {
            endOfLine();
        }
        doWhileNode.setFinish(finish);

        //line number is last
        appendStatement(doWhileNode =
            new WhileNode(doLine, doToken, finish, true).
                setBody(lc, body).
                setTest(lc, test));
    } finally {
        lc.pop(doWhileNode);
    }
}
 
Example #16
Source File: Parser.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * ...IterationStatement :
 *           ...
 *           do Statement while( Expression ) ;
 *           ...
 *
 * See 12.6
 *
 * Parse DO WHILE statement.
 */
private void doStatement() {
    // Capture DO token.
    final long doToken = token;
    // DO tested in the caller.
    next();

    WhileNode doWhileNode = new WhileNode(-1, doToken, Token.descPosition(doToken), true);
    lc.push(doWhileNode);

    try {
       // Get DO body.
        final Block body = getStatement();

        expect(WHILE);
        expect(LPAREN);
        final int doLine = line;
        final JoinPredecessorExpression test = joinPredecessorExpression();
        expect(RPAREN);

        if (type == SEMICOLON) {
            endOfLine();
        }
        doWhileNode.setFinish(finish);

        //line number is last
        appendStatement(doWhileNode =
            new WhileNode(doLine, doToken, finish, true).
                setBody(lc, body).
                setTest(lc, test));
    } finally {
        lc.pop(doWhileNode);
    }
}
 
Example #17
Source File: Parser.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * ...IterationStatement :
 *           ...
 *           do Statement while( Expression ) ;
 *           ...
 *
 * See 12.6
 *
 * Parse DO WHILE statement.
 */
private void doStatement() {
    // Capture DO token.
    final long doToken = token;
    // DO tested in the caller.
    next();

    WhileNode doWhileNode = new WhileNode(-1, doToken, Token.descPosition(doToken), true);
    lc.push(doWhileNode);

    try {
       // Get DO body.
        final Block body = getStatement();

        expect(WHILE);
        expect(LPAREN);
        final int doLine = line;
        final JoinPredecessorExpression test = joinPredecessorExpression();
        expect(RPAREN);

        if (type == SEMICOLON) {
            endOfLine();
        }
        doWhileNode.setFinish(finish);

        //line number is last
        appendStatement(doWhileNode =
            new WhileNode(doLine, doToken, finish, true).
                setBody(lc, body).
                setTest(lc, test));
    } finally {
        lc.pop(doWhileNode);
    }
}
 
Example #18
Source File: JSONWriter.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean enterJoinPredecessorExpression(final JoinPredecessorExpression joinPredecessorExpression) {
    final Expression expr = joinPredecessorExpression.getExpression();
    if(expr != null) {
        expr.accept(this);
    } else {
        nullValue();
    }
    return false;
}
 
Example #19
Source File: LocalVariableTypesCalculator.java    From jdk8u_nashorn with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean enterJoinPredecessorExpression(final JoinPredecessorExpression joinExpr) {
    final Expression expr = joinExpr.getExpression();
    if (expr != null) {
        expr.accept(this);
    } else {
        typeStack.push(LvarType.UNDEFINED);
    }
    return false;
}
 
Example #20
Source File: LocalVariableTypesCalculator.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean enterJoinPredecessorExpression(final JoinPredecessorExpression joinExpr) {
    final Expression expr = joinExpr.getExpression();
    if (expr != null) {
        expr.accept(this);
    } else {
        typeStack.push(LvarType.UNDEFINED);
    }
    return false;
}
 
Example #21
Source File: Parser.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * ...IterationStatement :
 *           ...
 *           do Statement while( Expression ) ;
 *           ...
 *
 * See 12.6
 *
 * Parse DO WHILE statement.
 */
private void doStatement() {
    // Capture DO token.
    final long doToken = token;
    // DO tested in the caller.
    next();

    WhileNode doWhileNode = new WhileNode(-1, doToken, Token.descPosition(doToken), true);
    lc.push(doWhileNode);

    try {
       // Get DO body.
        final Block body = getStatement();

        expect(WHILE);
        expect(LPAREN);
        final int doLine = line;
        final JoinPredecessorExpression test = joinPredecessorExpression();
        expect(RPAREN);

        if (type == SEMICOLON) {
            endOfLine();
        }
        doWhileNode.setFinish(finish);

        //line number is last
        appendStatement(doWhileNode =
            new WhileNode(doLine, doToken, finish, true).
                setBody(lc, body).
                setTest(lc, test));
    } finally {
        lc.pop(doWhileNode);
    }
}
 
Example #22
Source File: BranchOptimizer.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private void optimizeLogicalOperand(final Expression expr, final Label label, final boolean state, final boolean isRhs) {
    final JoinPredecessorExpression jpexpr = (JoinPredecessorExpression)expr;
    if(LocalVariableConversion.hasLiveConversion(jpexpr)) {
        final Label after = new Label("after");
        branchOptimizer(jpexpr.getExpression(), after, !state);
        method.beforeJoinPoint(jpexpr);
        method._goto(label);
        method.label(after);
        if(isRhs) {
            method.beforeJoinPoint(jpexpr);
        }
    } else {
        branchOptimizer(jpexpr.getExpression(), label, state);
    }
}
 
Example #23
Source File: LocalVariableTypesCalculator.java    From jdk8u_nashorn with GNU General Public License v2.0 5 votes vote down vote up
private void enterDoWhileLoop(final WhileNode loopNode) {
    assertTypeStackIsEmpty();
    final JoinPredecessorExpression test = loopNode.getTest();
    final Block body = loopNode.getBody();
    final Label continueLabel = loopNode.getContinueLabel();
    final Label breakLabel = loopNode.getBreakLabel();
    final Map<Symbol, LvarType> beforeLoopTypes = localVariableTypes;
    final Label repeatLabel = new Label("");
    for(;;) {
        jumpToLabel(loopNode, repeatLabel, beforeLoopTypes);
        final Map<Symbol, LvarType> beforeRepeatTypes = localVariableTypes;
        body.accept(this);
        if(reachable) {
            jumpToLabel(body, continueLabel);
        }
        joinOnLabel(continueLabel);
        if(!reachable) {
            break;
        }
        visitExpressionOnEmptyStack(test);
        jumpToLabel(test, breakLabel);
        if(isAlwaysFalse(test)) {
            break;
        }
        jumpToLabel(test, repeatLabel);
        joinOnLabel(repeatLabel);
        if(localVariableTypes.equals(beforeRepeatTypes)) {
            break;
        }
        resetJoinPoint(continueLabel);
        resetJoinPoint(breakLabel);
        resetJoinPoint(repeatLabel);
    }

    if(isAlwaysTrue(test)) {
        doesNotContinueSequentially();
    }

    leaveBreakable(loopNode);
}
 
Example #24
Source File: BranchOptimizer.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private void optimizeLogicalOperand(final Expression expr, final Label label, final boolean state, final boolean isRhs) {
    final JoinPredecessorExpression jpexpr = (JoinPredecessorExpression)expr;
    if(LocalVariableConversion.hasLiveConversion(jpexpr)) {
        final Label after = new Label("after");
        branchOptimizer(jpexpr.getExpression(), after, !state);
        method.beforeJoinPoint(jpexpr);
        method._goto(label);
        method.label(after);
        if(isRhs) {
            method.beforeJoinPoint(jpexpr);
        }
    } else {
        branchOptimizer(jpexpr.getExpression(), label, state);
    }
}
 
Example #25
Source File: LocalVariableTypesCalculator.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private void enterDoWhileLoop(final WhileNode loopNode) {
    assertTypeStackIsEmpty();
    final JoinPredecessorExpression test = loopNode.getTest();
    final Block body = loopNode.getBody();
    final Label continueLabel = loopNode.getContinueLabel();
    final Label breakLabel = loopNode.getBreakLabel();
    final Map<Symbol, LvarType> beforeLoopTypes = localVariableTypes;
    final Label repeatLabel = new Label("");
    for(;;) {
        jumpToLabel(loopNode, repeatLabel, beforeLoopTypes);
        final Map<Symbol, LvarType> beforeRepeatTypes = localVariableTypes;
        body.accept(this);
        if(reachable) {
            jumpToLabel(body, continueLabel);
        }
        joinOnLabel(continueLabel);
        if(!reachable) {
            break;
        }
        visitExpressionOnEmptyStack(test);
        jumpToLabel(test, breakLabel);
        if(isAlwaysFalse(test)) {
            break;
        }
        jumpToLabel(test, repeatLabel);
        joinOnLabel(repeatLabel);
        if(localVariableTypes.equals(beforeRepeatTypes)) {
            break;
        }
        resetJoinPoint(continueLabel);
        resetJoinPoint(breakLabel);
        resetJoinPoint(repeatLabel);
    }

    if(isAlwaysTrue(test)) {
        doesNotContinueSequentially();
    }

    leaveBreakable(loopNode);
}
 
Example #26
Source File: JSONWriter.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean enterJoinPredecessorExpression(final JoinPredecessorExpression joinPredecessorExpression) {
    final Expression expr = joinPredecessorExpression.getExpression();
    if(expr != null) {
        expr.accept(this);
    } else {
        nullValue();
    }
    return false;
}
 
Example #27
Source File: JSONWriter.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean enterJoinPredecessorExpression(final JoinPredecessorExpression joinPredecessorExpression) {
    final Expression expr = joinPredecessorExpression.getExpression();
    if(expr != null) {
        expr.accept(this);
    } else {
        nullValue();
    }
    return false;
}
 
Example #28
Source File: LocalVariableTypesCalculator.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean enterJoinPredecessorExpression(final JoinPredecessorExpression joinExpr) {
    final Expression expr = joinExpr.getExpression();
    if (expr != null) {
        expr.accept(this);
    } else {
        typeStack.push(LvarType.UNDEFINED);
    }
    return false;
}
 
Example #29
Source File: JSONWriter.java    From jdk8u_nashorn with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean enterJoinPredecessorExpression(final JoinPredecessorExpression joinPredecessorExpression) {
    final Expression expr = joinPredecessorExpression.getExpression();
    if(expr != null) {
        expr.accept(this);
    } else {
        nullValue();
    }
    return false;
}
 
Example #30
Source File: LocalVariableTypesCalculator.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private void enterDoWhileLoop(final WhileNode loopNode) {
    assertTypeStackIsEmpty();
    final JoinPredecessorExpression test = loopNode.getTest();
    final Block body = loopNode.getBody();
    final Label continueLabel = loopNode.getContinueLabel();
    final Label breakLabel = loopNode.getBreakLabel();
    final Map<Symbol, LvarType> beforeLoopTypes = localVariableTypes;
    final Label repeatLabel = new Label("");
    for(;;) {
        jumpToLabel(loopNode, repeatLabel, beforeLoopTypes);
        final Map<Symbol, LvarType> beforeRepeatTypes = localVariableTypes;
        body.accept(this);
        if(reachable) {
            jumpToLabel(body, continueLabel);
        }
        joinOnLabel(continueLabel);
        if(!reachable) {
            break;
        }
        visitExpressionOnEmptyStack(test);
        jumpToLabel(test, breakLabel);
        if(isAlwaysFalse(test)) {
            break;
        }
        jumpToLabel(test, repeatLabel);
        joinOnLabel(repeatLabel);
        if(localVariableTypes.equals(beforeRepeatTypes)) {
            break;
        }
        resetJoinPoint(continueLabel);
        resetJoinPoint(breakLabel);
        resetJoinPoint(repeatLabel);
    }

    if(isAlwaysTrue(test)) {
        doesNotContinueSequentially();
    }

    leaveBreakable(loopNode);
}