Java Code Examples for jdk.nashorn.internal.ir.UnaryNode#isTokenType()

The following examples show how to use jdk.nashorn.internal.ir.UnaryNode#isTokenType() . 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: IRTranslator.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean enterUnaryNode(final UnaryNode unaryNode) {
    if (unaryNode.isTokenType(TokenType.NEW)) {
        curExpr = new NewTreeImpl(unaryNode,
                translateExpr(unaryNode.getExpression()));
    } else if (unaryNode.isTokenType(TokenType.YIELD) ||
            unaryNode.isTokenType(TokenType.YIELD_STAR)) {
        curExpr = new YieldTreeImpl(unaryNode,
                translateExpr(unaryNode.getExpression()));
    } else if (unaryNode.isTokenType(TokenType.SPREAD_ARGUMENT) ||
            unaryNode.isTokenType(TokenType.SPREAD_ARRAY)) {
        curExpr = new SpreadTreeImpl(unaryNode,
                translateExpr(unaryNode.getExpression()));
    } else {
        curExpr = new UnaryTreeImpl(unaryNode,
                translateExpr(unaryNode.getExpression()));
    }
    return false;
}
 
Example 2
Source File: OptimisticTypesCalculator.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean enterUnaryNode(final UnaryNode unaryNode) {
    if(unaryNode.isTokenType(TokenType.NOT) || unaryNode.isTokenType(TokenType.NEW)) {
        // Operand of boolean negation is never optimistic (always coerced to boolean).
        // Operand of "new" is never optimistic (always coerced to Object).
        tagNeverOptimistic(unaryNode.getExpression());
    }
    return true;
}
 
Example 3
Source File: BranchOptimizer.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private void branchOptimizer(final UnaryNode unaryNode, final Label label, final boolean state) {
    if (unaryNode.isTokenType(NOT)) {
        branchOptimizer(unaryNode.getExpression(), label, !state);
    } else {
        loadTestAndJump(unaryNode, label, state);
    }
}
 
Example 4
Source File: OptimisticTypesCalculator.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean enterUnaryNode(final UnaryNode unaryNode) {
    if(unaryNode.isTokenType(TokenType.NOT) || unaryNode.isTokenType(TokenType.NEW)) {
        // Operand of boolean negation is never optimistic (always coerced to boolean).
        // Operand of "new" is never optimistic (always coerced to Object).
        tagNeverOptimistic(unaryNode.getExpression());
    }
    return true;
}
 
Example 5
Source File: BranchOptimizer.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private void branchOptimizer(final UnaryNode unaryNode, final Label label, final boolean state) {
    if (unaryNode.isTokenType(NOT)) {
        branchOptimizer(unaryNode.getExpression(), label, !state);
    } else {
        loadTestAndJump(unaryNode, label, state);
    }
}
 
Example 6
Source File: OptimisticTypesCalculator.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean enterUnaryNode(final UnaryNode unaryNode) {
    if(unaryNode.isTokenType(TokenType.NOT) || unaryNode.isTokenType(TokenType.NEW)) {
        // Operand of boolean negation is never optimistic (always coerced to boolean).
        // Operand of "new" is never optimistic (always coerced to Object).
        tagNeverOptimistic(unaryNode.getExpression());
    }
    return true;
}
 
Example 7
Source File: BranchOptimizer.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private void branchOptimizer(final UnaryNode unaryNode, final Label label, final boolean state) {
    if (unaryNode.isTokenType(NOT)) {
        branchOptimizer(unaryNode.getExpression(), label, !state);
    } else {
        loadTestAndJump(unaryNode, label, state);
    }
}
 
Example 8
Source File: OptimisticTypesCalculator.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean enterUnaryNode(final UnaryNode unaryNode) {
    if(unaryNode.isTokenType(TokenType.NOT) || unaryNode.isTokenType(TokenType.NEW)) {
        // Operand of boolean negation is never optimistic (always coerced to boolean).
        // Operand of "new" is never optimistic (always coerced to Object).
        tagNeverOptimistic(unaryNode.getExpression());
    }
    return true;
}
 
Example 9
Source File: BranchOptimizer.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private void branchOptimizer(final UnaryNode unaryNode, final Label label, final boolean state) {
    if (unaryNode.isTokenType(NOT)) {
        branchOptimizer(unaryNode.getExpression(), label, !state);
    } else {
        loadTestAndJump(unaryNode, label, state);
    }
}
 
Example 10
Source File: Lower.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean enterUnaryNode(final UnaryNode unaryNode) {
    if (es6) {
        if (unaryNode.isTokenType(TokenType.YIELD) ||
            unaryNode.isTokenType(TokenType.YIELD_STAR)) {
            throwNotImplementedYet("es6.yield", unaryNode);
        } else if (unaryNode.isTokenType(TokenType.SPREAD_ARGUMENT) ||
                   unaryNode.isTokenType(TokenType.SPREAD_ARRAY)) {
            throwNotImplementedYet("es6.spread", unaryNode);
        }
    }

    return super.enterUnaryNode(unaryNode);
}
 
Example 11
Source File: OptimisticTypesCalculator.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean enterUnaryNode(final UnaryNode unaryNode) {
    if(unaryNode.isTokenType(TokenType.NOT) || unaryNode.isTokenType(TokenType.NEW)) {
        // Operand of boolean negation is never optimistic (always coerced to boolean).
        // Operand of "new" is never optimistic (always coerced to Object).
        tagNeverOptimistic(unaryNode.getExpression());
    }
    return true;
}
 
Example 12
Source File: BranchOptimizer.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private void branchOptimizer(final UnaryNode unaryNode, final Label label, final boolean state) {
    if (unaryNode.isTokenType(NOT)) {
        branchOptimizer(unaryNode.getExpression(), label, !state);
    } else {
        loadTestAndJump(unaryNode, label, state);
    }
}
 
Example 13
Source File: OptimisticTypesCalculator.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean enterUnaryNode(final UnaryNode unaryNode) {
    if(unaryNode.isTokenType(TokenType.NOT) || unaryNode.isTokenType(TokenType.NEW)) {
        // Operand of boolean negation is never optimistic (always coerced to boolean).
        // Operand of "new" is never optimistic (always coerced to Object).
        tagNeverOptimistic(unaryNode.getExpression());
    }
    return true;
}
 
Example 14
Source File: BranchOptimizer.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private void branchOptimizer(final UnaryNode unaryNode, final Label label, final boolean state) {
    if (unaryNode.isTokenType(NOT)) {
        branchOptimizer(unaryNode.getExpression(), label, !state);
    } else {
        loadTestAndJump(unaryNode, label, state);
    }
}
 
Example 15
Source File: OptimisticTypesCalculator.java    From jdk8u_nashorn with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean enterUnaryNode(final UnaryNode unaryNode) {
    if(unaryNode.isTokenType(TokenType.NOT) || unaryNode.isTokenType(TokenType.NEW)) {
        // Operand of boolean negation is never optimistic (always coerced to boolean).
        // Operand of "new" is never optimistic (always coerced to Object).
        tagNeverOptimistic(unaryNode.getExpression());
    }
    return true;
}
 
Example 16
Source File: BranchOptimizer.java    From jdk8u_nashorn with GNU General Public License v2.0 5 votes vote down vote up
private void branchOptimizer(final UnaryNode unaryNode, final Label label, final boolean state) {
    if (unaryNode.isTokenType(NOT)) {
        branchOptimizer(unaryNode.getExpression(), label, !state);
    } else {
        loadTestAndJump(unaryNode, label, state);
    }
}