Java 类jdk.nashorn.internal.ir.JumpStatement 实例源码

项目:OpenJSharp    文件:SplitIntoFunctions.java   
int getSplitStateIndex(final JumpStatement jump) {
    if (jump instanceof BreakNode && jump.getLabelName() == null) {
        // Unlabelled break is a special case
        hasBreak = true;
        return BREAK_STATE;
    }

    int i = 0;
    for(final JumpStatement exJump: jumpStatements) {
        if (jump.getClass() == exJump.getClass() && Objects.equals(jump.getLabelName(), exJump.getLabelName())) {
            return i + FIRST_JUMP_STATE;
        }
        ++i;
    }
    jumpStatements.add(jump);
    return i + FIRST_JUMP_STATE;
}
项目:openjdk-jdk10    文件:SplitIntoFunctions.java   
int getSplitStateIndex(final JumpStatement jump) {
    if (jump instanceof BreakNode && jump.getLabelName() == null) {
        // Unlabelled break is a special case
        hasBreak = true;
        return BREAK_STATE;
    }

    int i = 0;
    for(final JumpStatement exJump: jumpStatements) {
        if (jump.getClass() == exJump.getClass() && Objects.equals(jump.getLabelName(), exJump.getLabelName())) {
            return i + FIRST_JUMP_STATE;
        }
        ++i;
    }
    jumpStatements.add(jump);
    return i + FIRST_JUMP_STATE;
}
项目:openjdk9    文件:SplitIntoFunctions.java   
int getSplitStateIndex(final JumpStatement jump) {
    if (jump instanceof BreakNode && jump.getLabelName() == null) {
        // Unlabelled break is a special case
        hasBreak = true;
        return BREAK_STATE;
    }

    int i = 0;
    for(final JumpStatement exJump: jumpStatements) {
        if (jump.getClass() == exJump.getClass() && Objects.equals(jump.getLabelName(), exJump.getLabelName())) {
            return i + FIRST_JUMP_STATE;
        }
        ++i;
    }
    jumpStatements.add(jump);
    return i + FIRST_JUMP_STATE;
}
项目:kaziranga    文件:SplitIntoFunctions.java   
int getSplitStateIndex(final JumpStatement jump) {
    if (jump instanceof BreakNode && jump.getLabelName() == null) {
        // Unlabelled break is a special case
        hasBreak = true;
        return BREAK_STATE;
    }

    int i = 0;
    for(final JumpStatement exJump: jumpStatements) {
        if (jump.getClass() == exJump.getClass() && Objects.equals(jump.getLabelName(), exJump.getLabelName())) {
            return i + FIRST_JUMP_STATE;
        }
        ++i;
    }
    jumpStatements.add(jump);
    return i + FIRST_JUMP_STATE;
}
项目:lookaside_java-1.8.0-openjdk    文件:SplitIntoFunctions.java   
int getSplitStateIndex(final JumpStatement jump) {
    if (jump instanceof BreakNode && jump.getLabelName() == null) {
        // Unlabelled break is a special case
        hasBreak = true;
        return BREAK_STATE;
    }

    int i = 0;
    for(final JumpStatement exJump: jumpStatements) {
        if (jump.getClass() == exJump.getClass() && Objects.equals(jump.getLabelName(), exJump.getLabelName())) {
            return i + FIRST_JUMP_STATE;
        }
        ++i;
    }
    jumpStatements.add(jump);
    return i + FIRST_JUMP_STATE;
}
项目:jdk8u_nashorn    文件:SplitIntoFunctions.java   
int getSplitStateIndex(final JumpStatement jump) {
    if (jump instanceof BreakNode && jump.getLabelName() == null) {
        // Unlabelled break is a special case
        hasBreak = true;
        return BREAK_STATE;
    }

    int i = 0;
    for(final JumpStatement exJump: jumpStatements) {
        if (jump.getClass() == exJump.getClass() && Objects.equals(jump.getLabelName(), exJump.getLabelName())) {
            return i + FIRST_JUMP_STATE;
        }
        ++i;
    }
    jumpStatements.add(jump);
    return i + FIRST_JUMP_STATE;
}
项目:infobip-open-jdk-8    文件:SplitIntoFunctions.java   
int getSplitStateIndex(final JumpStatement jump) {
    if (jump instanceof BreakNode && jump.getLabelName() == null) {
        // Unlabelled break is a special case
        hasBreak = true;
        return BREAK_STATE;
    }

    int i = 0;
    for(final JumpStatement exJump: jumpStatements) {
        if (jump.getClass() == exJump.getClass() && Objects.equals(jump.getLabelName(), exJump.getLabelName())) {
            return i + FIRST_JUMP_STATE;
        }
        ++i;
    }
    jumpStatements.add(jump);
    return i + FIRST_JUMP_STATE;
}
项目:OpenJSharp    文件:SplitIntoFunctions.java   
private JumpStatement leaveJumpNode(final JumpStatement jump) {
    if (inSplitNode()) {
        final SplitState splitState = getCurrentSplitState();
        final SplitNode splitNode = splitState.splitNode;
        if (lc.isExternalTarget(splitNode, jump.getTarget(lc))) {
            appendSplitReturn(splitState.getSplitStateIndex(jump), jump.getLineNumber());
            return jump;
        }
    }
    appendStatement(jump);
    return jump;
}
项目:OpenJSharp    文件:LocalVariableTypesCalculator.java   
private boolean enterJumpStatement(final JumpStatement jump) {
    if(!reachable) {
        return false;
    }
    final BreakableNode target = jump.getTarget(lc);
    jumpToLabel(jump, jump.getTargetLabel(target), getBreakTargetTypes(target));
    doesNotContinueSequentially();
    return false;
}
项目:OpenJSharp    文件:CodeGenerator.java   
private boolean enterJumpStatement(final JumpStatement jump) {
    if(!method.isReachable()) {
        return false;
    }
    enterStatement(jump);

    method.beforeJoinPoint(jump);
    final BreakableNode target = jump.getTarget(lc);
    popScopesUntil(target);
    final Label targetLabel = jump.getTargetLabel(target);
    targetLabel.markAsBreakTarget();
    method._goto(targetLabel);

    return false;
}
项目:openjdk-jdk10    文件:SplitIntoFunctions.java   
private JumpStatement leaveJumpNode(final JumpStatement jump) {
    if (inSplitNode()) {
        final SplitState splitState = getCurrentSplitState();
        final SplitNode splitNode = splitState.splitNode;
        if (lc.isExternalTarget(splitNode, jump.getTarget(lc))) {
            appendSplitReturn(splitState.getSplitStateIndex(jump), jump.getLineNumber());
            return jump;
        }
    }
    appendStatement(jump);
    return jump;
}
项目:openjdk-jdk10    文件:LocalVariableTypesCalculator.java   
private boolean enterJumpStatement(final JumpStatement jump) {
    if(!reachable) {
        return false;
    }
    assertTypeStackIsEmpty();
    jumpToLabel(jump, jump.getTargetLabel(lc), getBreakTargetTypes(jump.getPopScopeLimit(lc)));
    doesNotContinueSequentially();
    return false;
}
项目:openjdk-jdk10    文件:CodeGenerator.java   
private boolean enterJumpStatement(final JumpStatement jump) {
    if(!method.isReachable()) {
        return false;
    }
    enterStatement(jump);

    method.beforeJoinPoint(jump);
    popScopesUntil(jump.getPopScopeLimit(lc));
    final Label targetLabel = jump.getTargetLabel(lc);
    targetLabel.markAsBreakTarget();
    method._goto(targetLabel);

    return false;
}
项目:openjdk9    文件:SplitIntoFunctions.java   
private JumpStatement leaveJumpNode(final JumpStatement jump) {
    if (inSplitNode()) {
        final SplitState splitState = getCurrentSplitState();
        final SplitNode splitNode = splitState.splitNode;
        if (lc.isExternalTarget(splitNode, jump.getTarget(lc))) {
            appendSplitReturn(splitState.getSplitStateIndex(jump), jump.getLineNumber());
            return jump;
        }
    }
    appendStatement(jump);
    return jump;
}
项目:openjdk9    文件:LocalVariableTypesCalculator.java   
private boolean enterJumpStatement(final JumpStatement jump) {
    if(!reachable) {
        return false;
    }
    assertTypeStackIsEmpty();
    jumpToLabel(jump, jump.getTargetLabel(lc), getBreakTargetTypes(jump.getPopScopeLimit(lc)));
    doesNotContinueSequentially();
    return false;
}
项目:openjdk9    文件:CodeGenerator.java   
private boolean enterJumpStatement(final JumpStatement jump) {
    if(!method.isReachable()) {
        return false;
    }
    enterStatement(jump);

    method.beforeJoinPoint(jump);
    popScopesUntil(jump.getPopScopeLimit(lc));
    final Label targetLabel = jump.getTargetLabel(lc);
    targetLabel.markAsBreakTarget();
    method._goto(targetLabel);

    return false;
}
项目:kaziranga    文件:SplitIntoFunctions.java   
private JumpStatement leaveJumpNode(final JumpStatement jump) {
    if (inSplitNode()) {
        final SplitState splitState = getCurrentSplitState();
        final SplitNode splitNode = splitState.splitNode;
        if (lc.isExternalTarget(splitNode, jump.getTarget(lc))) {
            appendSplitReturn(splitState.getSplitStateIndex(jump), jump.getLineNumber());
            return jump;
        }
    }
    appendStatement(jump);
    return jump;
}
项目:kaziranga    文件:LocalVariableTypesCalculator.java   
private boolean enterJumpStatement(final JumpStatement jump) {
    if(!reachable) {
        return false;
    }
    assertTypeStackIsEmpty();
    jumpToLabel(jump, jump.getTargetLabel(lc), getBreakTargetTypes(jump.getPopScopeLimit(lc)));
    doesNotContinueSequentially();
    return false;
}
项目:kaziranga    文件:CodeGenerator.java   
private boolean enterJumpStatement(final JumpStatement jump) {
    if(!method.isReachable()) {
        return false;
    }
    enterStatement(jump);

    method.beforeJoinPoint(jump);
    popScopesUntil(jump.getPopScopeLimit(lc));
    final Label targetLabel = jump.getTargetLabel(lc);
    targetLabel.markAsBreakTarget();
    method._goto(targetLabel);

    return false;
}
项目:lookaside_java-1.8.0-openjdk    文件:SplitIntoFunctions.java   
private JumpStatement leaveJumpNode(final JumpStatement jump) {
    if (inSplitNode()) {
        final SplitState splitState = getCurrentSplitState();
        final SplitNode splitNode = splitState.splitNode;
        if (lc.isExternalTarget(splitNode, jump.getTarget(lc))) {
            appendSplitReturn(splitState.getSplitStateIndex(jump), jump.getLineNumber());
            return jump;
        }
    }
    appendStatement(jump);
    return jump;
}
项目:lookaside_java-1.8.0-openjdk    文件:LocalVariableTypesCalculator.java   
private boolean enterJumpStatement(final JumpStatement jump) {
    if(!reachable) {
        return false;
    }
    assertTypeStackIsEmpty();
    jumpToLabel(jump, jump.getTargetLabel(lc), getBreakTargetTypes(jump.getPopScopeLimit(lc)));
    doesNotContinueSequentially();
    return false;
}
项目:lookaside_java-1.8.0-openjdk    文件:CodeGenerator.java   
private boolean enterJumpStatement(final JumpStatement jump) {
    if(!method.isReachable()) {
        return false;
    }
    enterStatement(jump);

    method.beforeJoinPoint(jump);
    popScopesUntil(jump.getPopScopeLimit(lc));
    final Label targetLabel = jump.getTargetLabel(lc);
    targetLabel.markAsBreakTarget();
    method._goto(targetLabel);

    return false;
}
项目:jdk8u_nashorn    文件:SplitIntoFunctions.java   
private JumpStatement leaveJumpNode(final JumpStatement jump) {
    if (inSplitNode()) {
        final SplitState splitState = getCurrentSplitState();
        final SplitNode splitNode = splitState.splitNode;
        if (lc.isExternalTarget(splitNode, jump.getTarget(lc))) {
            appendSplitReturn(splitState.getSplitStateIndex(jump), jump.getLineNumber());
            return jump;
        }
    }
    appendStatement(jump);
    return jump;
}
项目:jdk8u_nashorn    文件:LocalVariableTypesCalculator.java   
private boolean enterJumpStatement(final JumpStatement jump) {
    if(!reachable) {
        return false;
    }
    assertTypeStackIsEmpty();
    jumpToLabel(jump, jump.getTargetLabel(lc), getBreakTargetTypes(jump.getPopScopeLimit(lc)));
    doesNotContinueSequentially();
    return false;
}
项目:jdk8u_nashorn    文件:CodeGenerator.java   
private boolean enterJumpStatement(final JumpStatement jump) {
    if(!method.isReachable()) {
        return false;
    }
    enterStatement(jump);

    method.beforeJoinPoint(jump);
    popScopesUntil(jump.getPopScopeLimit(lc));
    final Label targetLabel = jump.getTargetLabel(lc);
    targetLabel.markAsBreakTarget();
    method._goto(targetLabel);

    return false;
}
项目:infobip-open-jdk-8    文件:SplitIntoFunctions.java   
private JumpStatement leaveJumpNode(final JumpStatement jump) {
    if (inSplitNode()) {
        final SplitState splitState = getCurrentSplitState();
        final SplitNode splitNode = splitState.splitNode;
        if (lc.isExternalTarget(splitNode, jump.getTarget(lc))) {
            appendSplitReturn(splitState.getSplitStateIndex(jump), jump.getLineNumber());
            return jump;
        }
    }
    appendStatement(jump);
    return jump;
}
项目:infobip-open-jdk-8    文件:LocalVariableTypesCalculator.java   
private boolean enterJumpStatement(final JumpStatement jump) {
    if(!reachable) {
        return false;
    }
    final BreakableNode target = jump.getTarget(lc);
    jumpToLabel(jump, jump.getTargetLabel(target), getBreakTargetTypes(target));
    doesNotContinueSequentially();
    return false;
}
项目:infobip-open-jdk-8    文件:CodeGenerator.java   
private boolean enterJumpStatement(final JumpStatement jump) {
    if(!method.isReachable()) {
        return false;
    }
    enterStatement(jump);

    method.beforeJoinPoint(jump);
    final BreakableNode target = jump.getTarget(lc);
    popScopesUntil(target);
    final Label targetLabel = jump.getTargetLabel(target);
    targetLabel.markAsBreakTarget();
    method._goto(targetLabel);

    return false;
}
项目:OpenJSharp    文件:SplitIntoFunctions.java   
private Block enblockAndVisit(final JumpStatement jump) {
    artificialBlock = true;
    final Block block = (Block)new Block(NO_TOKEN, NO_FINISH, jump).accept(this);
    artificialBlock = false;
    return block;
}
项目:openjdk-jdk10    文件:Lower.java   
/**
 * Constructor.
 */
Lower(final Compiler compiler) {
    super(new BlockLexicalContext() {

        @Override
        public List<Statement> popStatements() {
            final List<Statement> newStatements = new ArrayList<>();
            boolean terminated = false;

            final List<Statement> statements = super.popStatements();
            for (final Statement statement : statements) {
                if (!terminated) {
                    newStatements.add(statement);
                    if (statement.isTerminal() || statement instanceof JumpStatement) { //TODO hasGoto? But some Loops are hasGoto too - why?
                        terminated = true;
                    }
                } else {
                    FoldConstants.extractVarNodesFromDeadCode(statement, newStatements);
                }
            }
            return newStatements;
        }

        @Override
        protected Block afterSetStatements(final Block block) {
            final List<Statement> stmts = block.getStatements();
            for(final ListIterator<Statement> li = stmts.listIterator(stmts.size()); li.hasPrevious();) {
                final Statement stmt = li.previous();
                // popStatements() guarantees that the only thing after a terminal statement are uninitialized
                // VarNodes. We skip past those, and set the terminal state of the block to the value of the
                // terminal state of the first statement that is not an uninitialized VarNode.
                if(!(stmt instanceof VarNode && ((VarNode)stmt).getInit() == null)) {
                    return block.setIsTerminal(this, stmt.isTerminal());
                }
            }
            return block.setIsTerminal(this, false);
        }
    });

    this.log = initLogger(compiler.getContext());
    this.es6 = compiler.getScriptEnvironment()._es6;
    this.source = compiler.getSource();
}
项目:openjdk-jdk10    文件:SplitIntoFunctions.java   
private Block enblockAndVisit(final JumpStatement jump) {
    artificialBlock = true;
    final Block block = (Block)new Block(NO_TOKEN, NO_FINISH, jump).accept(this);
    artificialBlock = false;
    return block;
}
项目:openjdk9    文件:Lower.java   
/**
 * Constructor.
 */
Lower(final Compiler compiler) {
    super(new BlockLexicalContext() {

        @Override
        public List<Statement> popStatements() {
            final List<Statement> newStatements = new ArrayList<>();
            boolean terminated = false;

            final List<Statement> statements = super.popStatements();
            for (final Statement statement : statements) {
                if (!terminated) {
                    newStatements.add(statement);
                    if (statement.isTerminal() || statement instanceof JumpStatement) { //TODO hasGoto? But some Loops are hasGoto too - why?
                        terminated = true;
                    }
                } else {
                    FoldConstants.extractVarNodesFromDeadCode(statement, newStatements);
                }
            }
            return newStatements;
        }

        @Override
        protected Block afterSetStatements(final Block block) {
            final List<Statement> stmts = block.getStatements();
            for(final ListIterator<Statement> li = stmts.listIterator(stmts.size()); li.hasPrevious();) {
                final Statement stmt = li.previous();
                // popStatements() guarantees that the only thing after a terminal statement are uninitialized
                // VarNodes. We skip past those, and set the terminal state of the block to the value of the
                // terminal state of the first statement that is not an uninitialized VarNode.
                if(!(stmt instanceof VarNode && ((VarNode)stmt).getInit() == null)) {
                    return block.setIsTerminal(this, stmt.isTerminal());
                }
            }
            return block.setIsTerminal(this, false);
        }
    });

    this.log = initLogger(compiler.getContext());
    this.es6 = compiler.getScriptEnvironment()._es6;
}
项目:openjdk9    文件:SplitIntoFunctions.java   
private Block enblockAndVisit(final JumpStatement jump) {
    artificialBlock = true;
    final Block block = (Block)new Block(NO_TOKEN, NO_FINISH, jump).accept(this);
    artificialBlock = false;
    return block;
}
项目:kaziranga    文件:Lower.java   
/**
 * Constructor.
 */
Lower(final Compiler compiler) {
    super(new BlockLexicalContext() {

        @Override
        public List<Statement> popStatements() {
            final List<Statement> newStatements = new ArrayList<>();
            boolean terminated = false;

            final List<Statement> statements = super.popStatements();
            for (final Statement statement : statements) {
                if (!terminated) {
                    newStatements.add(statement);
                    if (statement.isTerminal() || statement instanceof JumpStatement) { //TODO hasGoto? But some Loops are hasGoto too - why?
                        terminated = true;
                    }
                } else {
                    statement.accept(new NodeVisitor<LexicalContext>(new LexicalContext()) {
                        @Override
                        public boolean enterVarNode(final VarNode varNode) {
                            newStatements.add(varNode.setInit(null));
                            return false;
                        }
                    });
                }
            }
            return newStatements;
        }

        @Override
        protected Block afterSetStatements(final Block block) {
            final List<Statement> stmts = block.getStatements();
            for(final ListIterator<Statement> li = stmts.listIterator(stmts.size()); li.hasPrevious();) {
                final Statement stmt = li.previous();
                // popStatements() guarantees that the only thing after a terminal statement are uninitialized
                // VarNodes. We skip past those, and set the terminal state of the block to the value of the
                // terminal state of the first statement that is not an uninitialized VarNode.
                if(!(stmt instanceof VarNode && ((VarNode)stmt).getInit() == null)) {
                    return block.setIsTerminal(this, stmt.isTerminal());
                }
            }
            return block.setIsTerminal(this, false);
        }
    });

    this.log = initLogger(compiler.getContext());
}
项目:kaziranga    文件:SplitIntoFunctions.java   
private Block enblockAndVisit(final JumpStatement jump) {
    artificialBlock = true;
    final Block block = (Block)new Block(NO_TOKEN, NO_FINISH, jump).accept(this);
    artificialBlock = false;
    return block;
}
项目:lookaside_java-1.8.0-openjdk    文件:Lower.java   
/**
 * Constructor.
 */
Lower(final Compiler compiler) {
    super(new BlockLexicalContext() {

        @Override
        public List<Statement> popStatements() {
            final List<Statement> newStatements = new ArrayList<>();
            boolean terminated = false;

            final List<Statement> statements = super.popStatements();
            for (final Statement statement : statements) {
                if (!terminated) {
                    newStatements.add(statement);
                    if (statement.isTerminal() || statement instanceof JumpStatement) { //TODO hasGoto? But some Loops are hasGoto too - why?
                        terminated = true;
                    }
                } else {
                    FoldConstants.extractVarNodesFromDeadCode(statement, newStatements);
                }
            }
            return newStatements;
        }

        @Override
        protected Block afterSetStatements(final Block block) {
            final List<Statement> stmts = block.getStatements();
            for(final ListIterator<Statement> li = stmts.listIterator(stmts.size()); li.hasPrevious();) {
                final Statement stmt = li.previous();
                // popStatements() guarantees that the only thing after a terminal statement are uninitialized
                // VarNodes. We skip past those, and set the terminal state of the block to the value of the
                // terminal state of the first statement that is not an uninitialized VarNode.
                if(!(stmt instanceof VarNode && ((VarNode)stmt).getInit() == null)) {
                    return block.setIsTerminal(this, stmt.isTerminal());
                }
            }
            return block.setIsTerminal(this, false);
        }
    });

    this.log = initLogger(compiler.getContext());
}
项目:lookaside_java-1.8.0-openjdk    文件:SplitIntoFunctions.java   
private Block enblockAndVisit(final JumpStatement jump) {
    artificialBlock = true;
    final Block block = (Block)new Block(NO_TOKEN, NO_FINISH, jump).accept(this);
    artificialBlock = false;
    return block;
}
项目:jdk8u_nashorn    文件:Lower.java   
/**
 * Constructor.
 */
Lower(final Compiler compiler) {
    super(new BlockLexicalContext() {

        @Override
        public List<Statement> popStatements() {
            final List<Statement> newStatements = new ArrayList<>();
            boolean terminated = false;

            final List<Statement> statements = super.popStatements();
            for (final Statement statement : statements) {
                if (!terminated) {
                    newStatements.add(statement);
                    if (statement.isTerminal() || statement instanceof JumpStatement) { //TODO hasGoto? But some Loops are hasGoto too - why?
                        terminated = true;
                    }
                } else {
                    FoldConstants.extractVarNodesFromDeadCode(statement, newStatements);
                }
            }
            return newStatements;
        }

        @Override
        protected Block afterSetStatements(final Block block) {
            final List<Statement> stmts = block.getStatements();
            for(final ListIterator<Statement> li = stmts.listIterator(stmts.size()); li.hasPrevious();) {
                final Statement stmt = li.previous();
                // popStatements() guarantees that the only thing after a terminal statement are uninitialized
                // VarNodes. We skip past those, and set the terminal state of the block to the value of the
                // terminal state of the first statement that is not an uninitialized VarNode.
                if(!(stmt instanceof VarNode && ((VarNode)stmt).getInit() == null)) {
                    return block.setIsTerminal(this, stmt.isTerminal());
                }
            }
            return block.setIsTerminal(this, false);
        }
    });

    this.log = initLogger(compiler.getContext());
}
项目:jdk8u_nashorn    文件:SplitIntoFunctions.java   
private Block enblockAndVisit(final JumpStatement jump) {
    artificialBlock = true;
    final Block block = (Block)new Block(NO_TOKEN, NO_FINISH, jump).accept(this);
    artificialBlock = false;
    return block;
}
项目:infobip-open-jdk-8    文件:SplitIntoFunctions.java   
private Block enblockAndVisit(final JumpStatement jump) {
    artificialBlock = true;
    final Block block = (Block)new Block(NO_TOKEN, NO_FINISH, jump).accept(this);
    artificialBlock = false;
    return block;
}