jdk.nashorn.internal.ir.JumpStatement Java Examples
The following examples show how to use
jdk.nashorn.internal.ir.JumpStatement.
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: SplitIntoFunctions.java From jdk8u_nashorn with GNU General Public License v2.0 | 6 votes |
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; }
Example #2
Source File: SplitIntoFunctions.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
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; }
Example #3
Source File: SplitIntoFunctions.java From hottub with GNU General Public License v2.0 | 6 votes |
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; }
Example #4
Source File: SplitIntoFunctions.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
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; }
Example #5
Source File: SplitIntoFunctions.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
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; }
Example #6
Source File: SplitIntoFunctions.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
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; }
Example #7
Source File: SplitIntoFunctions.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
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; }
Example #8
Source File: SplitIntoFunctions.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
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; }
Example #9
Source File: LocalVariableTypesCalculator.java From jdk8u_nashorn with GNU General Public License v2.0 | 5 votes |
private boolean enterJumpStatement(final JumpStatement jump) { if(!reachable) { return false; } assertTypeStackIsEmpty(); jumpToLabel(jump, jump.getTargetLabel(lc), getBreakTargetTypes(jump.getPopScopeLimit(lc))); doesNotContinueSequentially(); return false; }
Example #10
Source File: SplitIntoFunctions.java From jdk8u_nashorn with GNU General Public License v2.0 | 5 votes |
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; }
Example #11
Source File: LocalVariableTypesCalculator.java From hottub with GNU General Public License v2.0 | 5 votes |
private boolean enterJumpStatement(final JumpStatement jump) { if(!reachable) { return false; } assertTypeStackIsEmpty(); jumpToLabel(jump, jump.getTargetLabel(lc), getBreakTargetTypes(jump.getPopScopeLimit(lc))); doesNotContinueSequentially(); return false; }
Example #12
Source File: SplitIntoFunctions.java From hottub with GNU General Public License v2.0 | 5 votes |
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; }
Example #13
Source File: LocalVariableTypesCalculator.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private boolean enterJumpStatement(final JumpStatement jump) { if(!reachable) { return false; } assertTypeStackIsEmpty(); jumpToLabel(jump, jump.getTargetLabel(lc), getBreakTargetTypes(jump.getPopScopeLimit(lc))); doesNotContinueSequentially(); return false; }
Example #14
Source File: SplitIntoFunctions.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
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; }
Example #15
Source File: LocalVariableTypesCalculator.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private boolean enterJumpStatement(final JumpStatement jump) { if(!reachable) { return false; } assertTypeStackIsEmpty(); jumpToLabel(jump, jump.getTargetLabel(lc), getBreakTargetTypes(jump.getPopScopeLimit(lc))); doesNotContinueSequentially(); return false; }
Example #16
Source File: SplitIntoFunctions.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
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; }
Example #17
Source File: LocalVariableTypesCalculator.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private boolean enterJumpStatement(final JumpStatement jump) { if(!reachable) { return false; } assertTypeStackIsEmpty(); jumpToLabel(jump, jump.getTargetLabel(lc), getBreakTargetTypes(jump.getPopScopeLimit(lc))); doesNotContinueSequentially(); return false; }
Example #18
Source File: SplitIntoFunctions.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
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; }
Example #19
Source File: LocalVariableTypesCalculator.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private boolean enterJumpStatement(final JumpStatement jump) { if(!reachable) { return false; } assertTypeStackIsEmpty(); jumpToLabel(jump, jump.getTargetLabel(lc), getBreakTargetTypes(jump.getPopScopeLimit(lc))); doesNotContinueSequentially(); return false; }
Example #20
Source File: LocalVariableTypesCalculator.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
private boolean enterJumpStatement(final JumpStatement jump) { if(!reachable) { return false; } assertTypeStackIsEmpty(); jumpToLabel(jump, jump.getTargetLabel(lc), getBreakTargetTypes(jump.getPopScopeLimit(lc))); doesNotContinueSequentially(); return false; }
Example #21
Source File: SplitIntoFunctions.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
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; }
Example #22
Source File: Lower.java From hottub with GNU General Public License v2.0 | 4 votes |
/** * 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()); }
Example #23
Source File: SplitIntoFunctions.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
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; }
Example #24
Source File: SplitIntoFunctions.java From jdk8u_nashorn with GNU General Public License v2.0 | 4 votes |
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; }
Example #25
Source File: Lower.java From jdk8u_nashorn with GNU General Public License v2.0 | 4 votes |
/** * 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()); }
Example #26
Source File: Lower.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
/** * 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()); }
Example #27
Source File: SplitIntoFunctions.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
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; }
Example #28
Source File: SplitIntoFunctions.java From hottub with GNU General Public License v2.0 | 4 votes |
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; }
Example #29
Source File: Lower.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
/** * 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()); }
Example #30
Source File: Lower.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
/** * 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()); }