Java Code Examples for jdk.nashorn.internal.ir.CallNode#getArgs()
The following examples show how to use
jdk.nashorn.internal.ir.CallNode#getArgs() .
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: Lower.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * Check whether a call node may be a call to eval. In that case we * clone the args in order to create the following construct in * {@link CodeGenerator} * * <pre> * if (calledFuntion == buildInEval) { * eval(cloned arg); * } else { * cloned arg; * } * </pre> * * @param callNode call node to check if it's an eval */ private CallNode checkEval(final CallNode callNode) { if (callNode.getFunction() instanceof IdentNode) { final List<Expression> args = callNode.getArgs(); final IdentNode callee = (IdentNode)callNode.getFunction(); // 'eval' call with at least one argument if (args.size() >= 1 && EVAL.symbolName().equals(callee.getName())) { final List<Expression> evalArgs = new ArrayList<>(args.size()); for(final Expression arg: args) { evalArgs.add((Expression)ensureUniqueNamesIn(arg).accept(this)); } return callNode.setEvalArgs(new CallNode.EvalArgs(evalArgs, evalLocation(callee))); } } return callNode; }
Example 2
Source File: Lower.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * Check whether a call node may be a call to eval. In that case we * clone the args in order to create the following construct in * {@link CodeGenerator} * * <pre> * if (calledFuntion == buildInEval) { * eval(cloned arg); * } else { * cloned arg; * } * </pre> * * @param callNode call node to check if it's an eval */ private CallNode checkEval(final CallNode callNode) { if (callNode.getFunction() instanceof IdentNode) { final List<Expression> args = callNode.getArgs(); final IdentNode callee = (IdentNode)callNode.getFunction(); // 'eval' call with at least one argument if (args.size() >= 1 && EVAL.symbolName().equals(callee.getName())) { final List<Expression> evalArgs = new ArrayList<>(args.size()); for(final Expression arg: args) { evalArgs.add((Expression)ensureUniqueNamesIn(arg).accept(this)); } return callNode.setEvalArgs(new CallNode.EvalArgs(evalArgs, evalLocation(callee))); } } return callNode; }
Example 3
Source File: Lower.java From nashorn with GNU General Public License v2.0 | 6 votes |
/** * Check whether a call node may be a call to eval. In that case we * clone the args in order to create the following construct in * {@link CodeGenerator} * * <pre> * if (calledFuntion == buildInEval) { * eval(cloned arg); * } else { * cloned arg; * } * </pre> * * @param callNode call node to check if it's an eval */ private CallNode checkEval(final CallNode callNode) { if (callNode.getFunction() instanceof IdentNode) { final List<Expression> args = callNode.getArgs(); final IdentNode callee = (IdentNode)callNode.getFunction(); // 'eval' call with at least one argument if (args.size() >= 1 && EVAL.symbolName().equals(callee.getName())) { final FunctionNode currentFunction = lc.getCurrentFunction(); return callNode.setEvalArgs( new CallNode.EvalArgs( (Expression)ensureUniqueNamesIn(args.get(0)).accept(this), compilerConstant(THIS), evalLocation(callee), currentFunction.isStrict())); } } return callNode; }
Example 4
Source File: Lower.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * Check whether a call node may be a call to eval. In that case we * clone the args in order to create the following construct in * {@link CodeGenerator} * * <pre> * if (calledFuntion == buildInEval) { * eval(cloned arg); * } else { * cloned arg; * } * </pre> * * @param callNode call node to check if it's an eval */ private CallNode checkEval(final CallNode callNode) { if (callNode.getFunction() instanceof IdentNode) { final List<Expression> args = callNode.getArgs(); final IdentNode callee = (IdentNode)callNode.getFunction(); // 'eval' call with at least one argument if (args.size() >= 1 && EVAL.symbolName().equals(callee.getName())) { final List<Expression> evalArgs = new ArrayList<>(args.size()); for(final Expression arg: args) { evalArgs.add((Expression)ensureUniqueNamesIn(arg).accept(this)); } return callNode.setEvalArgs(new CallNode.EvalArgs(evalArgs, evalLocation(callee))); } } return callNode; }
Example 5
Source File: Lower.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * Check whether a call node may be a call to eval. In that case we * clone the args in order to create the following construct in * {@link CodeGenerator} * * <pre> * if (calledFuntion == buildInEval) { * eval(cloned arg); * } else { * cloned arg; * } * </pre> * * @param callNode call node to check if it's an eval */ private CallNode checkEval(final CallNode callNode) { if (callNode.getFunction() instanceof IdentNode) { final List<Expression> args = callNode.getArgs(); final IdentNode callee = (IdentNode)callNode.getFunction(); // 'eval' call with at least one argument if (args.size() >= 1 && EVAL.symbolName().equals(callee.getName())) { final List<Expression> evalArgs = new ArrayList<>(args.size()); for(final Expression arg: args) { evalArgs.add((Expression)ensureUniqueNamesIn(arg).accept(this)); } return callNode.setEvalArgs(new CallNode.EvalArgs(evalArgs, evalLocation(callee))); } } return callNode; }
Example 6
Source File: Lower.java From jdk8u_nashorn with GNU General Public License v2.0 | 6 votes |
/** * Check whether a call node may be a call to eval. In that case we * clone the args in order to create the following construct in * {@link CodeGenerator} * * <pre> * if (calledFuntion == buildInEval) { * eval(cloned arg); * } else { * cloned arg; * } * </pre> * * @param callNode call node to check if it's an eval */ private CallNode checkEval(final CallNode callNode) { if (callNode.getFunction() instanceof IdentNode) { final List<Expression> args = callNode.getArgs(); final IdentNode callee = (IdentNode)callNode.getFunction(); // 'eval' call with at least one argument if (args.size() >= 1 && EVAL.symbolName().equals(callee.getName())) { final List<Expression> evalArgs = new ArrayList<>(args.size()); for(final Expression arg: args) { evalArgs.add((Expression)ensureUniqueNamesIn(arg).accept(this)); } return callNode.setEvalArgs(new CallNode.EvalArgs(evalArgs, evalLocation(callee))); } } return callNode; }
Example 7
Source File: Lower.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * Check whether a call node may be a call to eval. In that case we * clone the args in order to create the following construct in * {@link CodeGenerator} * * <pre> * if (calledFuntion == buildInEval) { * eval(cloned arg); * } else { * cloned arg; * } * </pre> * * @param callNode call node to check if it's an eval */ private CallNode checkEval(final CallNode callNode) { if (callNode.getFunction() instanceof IdentNode) { final List<Expression> args = callNode.getArgs(); final IdentNode callee = (IdentNode)callNode.getFunction(); // 'eval' call with at least one argument if (args.size() >= 1 && EVAL.symbolName().equals(callee.getName())) { final List<Expression> evalArgs = new ArrayList<>(args.size()); for(final Expression arg: args) { evalArgs.add((Expression)ensureUniqueNamesIn(arg).accept(this)); } return callNode.setEvalArgs(new CallNode.EvalArgs(evalArgs, evalLocation(callee))); } } return callNode; }
Example 8
Source File: Lower.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * Check whether a call node may be a call to eval. In that case we * clone the args in order to create the following construct in * {@link CodeGenerator} * * <pre> * if (calledFuntion == buildInEval) { * eval(cloned arg); * } else { * cloned arg; * } * </pre> * * @param callNode call node to check if it's an eval */ private CallNode checkEval(final CallNode callNode) { if (callNode.getFunction() instanceof IdentNode) { final List<Expression> args = callNode.getArgs(); final IdentNode callee = (IdentNode)callNode.getFunction(); // 'eval' call with at least one argument if (args.size() >= 1 && EVAL.symbolName().equals(callee.getName())) { final List<Expression> evalArgs = new ArrayList<>(args.size()); for(final Expression arg: args) { evalArgs.add((Expression)ensureUniqueNamesIn(arg).accept(this)); } return callNode.setEvalArgs(new CallNode.EvalArgs(evalArgs, evalLocation(callee))); } } return callNode; }
Example 9
Source File: Lower.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
/** * Check whether a call node may be a call to eval. In that case we * clone the args in order to create the following construct in * {@link CodeGenerator} * * <pre> * if (calledFuntion == buildInEval) { * eval(cloned arg); * } else { * cloned arg; * } * </pre> * * @param callNode call node to check if it's an eval */ private CallNode checkEval(final CallNode callNode) { if (callNode.getFunction() instanceof IdentNode) { final List<Expression> args = callNode.getArgs(); final IdentNode callee = (IdentNode)callNode.getFunction(); // 'eval' call with at least one argument if (args.size() >= 1 && EVAL.symbolName().equals(callee.getName())) { final FunctionNode currentFunction = lc.getCurrentFunction(); return callNode.setEvalArgs( new CallNode.EvalArgs( (Expression)ensureUniqueNamesIn(args.get(0)).accept(this), compilerConstant(THIS), evalLocation(callee), currentFunction.isStrict())); } } return callNode; }
Example 10
Source File: Lower.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
/** * Check whether a call node may be a call to eval. In that case we * clone the args in order to create the following construct in * {@link CodeGenerator} * * <pre> * if (calledFuntion == buildInEval) { * eval(cloned arg); * } else { * cloned arg; * } * </pre> * * @param callNode call node to check if it's an eval */ private CallNode checkEval(final CallNode callNode) { if (callNode.getFunction() instanceof IdentNode) { final List<Expression> args = callNode.getArgs(); final IdentNode callee = (IdentNode)callNode.getFunction(); // 'eval' call with at least one argument if (args.size() >= 1 && EVAL.symbolName().equals(callee.getName())) { final FunctionNode currentFunction = lc.getCurrentFunction(); return callNode.setEvalArgs( new CallNode.EvalArgs( (Expression)ensureUniqueNamesIn(args.get(0)).accept(this), compilerConstant(THIS), evalLocation(callee), currentFunction.isStrict())); } } return callNode; }
Example 11
Source File: CodeGenerator.java From nashorn with GNU General Public License v2.0 | 5 votes |
@Override public boolean enterNEW(final UnaryNode unaryNode) { final CallNode callNode = (CallNode)unaryNode.rhs(); final List<Expression> args = callNode.getArgs(); // Load function reference. load(callNode.getFunction()).convert(Type.OBJECT); // must detect type error method.dynamicNew(1 + loadArgs(args), getCallSiteFlags()); method.store(unaryNode.getSymbol()); return false; }
Example 12
Source File: ApplySpecialization.java From jdk8u_nashorn with GNU General Public License v2.0 | 5 votes |
@Override public Node leaveCallNode(final CallNode callNode) { //apply needs to be a global symbol or we don't allow it final List<IdentNode> newParams = explodedArguments.peek(); if (isApply(callNode)) { final List<Expression> newArgs = new ArrayList<>(); for (final Expression arg : callNode.getArgs()) { if (arg instanceof IdentNode && ARGUMENTS.equals(((IdentNode)arg).getName())) { newArgs.addAll(newParams); } else { newArgs.add(arg); } } changed.add(lc.getCurrentFunction().getId()); final CallNode newCallNode = callNode.setArgs(newArgs).setIsApplyToCall(); if (log.isEnabled()) { log.fine("Transformed ", callNode, " from apply to call => ", newCallNode, " in ", DebugLogger.quote(lc.getCurrentFunction().getName())); } return newCallNode; } return callNode; }
Example 13
Source File: CodeGenerator.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
@Override public boolean enterNEW(final UnaryNode unaryNode) { final CallNode callNode = (CallNode)unaryNode.rhs(); final List<Expression> args = callNode.getArgs(); // Load function reference. load(callNode.getFunction(), Type.OBJECT); // must detect type error method.dynamicNew(1 + loadArgs(args), getCallSiteFlags()); method.store(unaryNode.getSymbol()); return false; }
Example 14
Source File: CodeGenerator.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
@Override public boolean enterNEW(final UnaryNode unaryNode) { final CallNode callNode = (CallNode)unaryNode.rhs(); final List<Expression> args = callNode.getArgs(); // Load function reference. load(callNode.getFunction(), Type.OBJECT); // must detect type error method.dynamicNew(1 + loadArgs(args), getCallSiteFlags()); method.store(unaryNode.getSymbol()); return false; }
Example 15
Source File: ApplySpecialization.java From hottub with GNU General Public License v2.0 | 5 votes |
@Override public Node leaveCallNode(final CallNode callNode) { //apply needs to be a global symbol or we don't allow it final List<IdentNode> newParams = explodedArguments.peek(); if (isApply(callNode)) { final List<Expression> newArgs = new ArrayList<>(); for (final Expression arg : callNode.getArgs()) { if (arg instanceof IdentNode && ARGUMENTS.equals(((IdentNode)arg).getName())) { newArgs.addAll(newParams); } else { newArgs.add(arg); } } changed.add(lc.getCurrentFunction().getId()); final CallNode newCallNode = callNode.setArgs(newArgs).setIsApplyToCall(); if (log.isEnabled()) { log.fine("Transformed ", callNode, " from apply to call => ", newCallNode, " in ", DebugLogger.quote(lc.getCurrentFunction().getName())); } return newCallNode; } return callNode; }
Example 16
Source File: ApplySpecialization.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Override public Node leaveCallNode(final CallNode callNode) { //apply needs to be a global symbol or we don't allow it final List<IdentNode> newParams = explodedArguments.peek(); if (isApply(callNode)) { final List<Expression> newArgs = new ArrayList<>(); for (final Expression arg : callNode.getArgs()) { if (arg instanceof IdentNode && ARGUMENTS.equals(((IdentNode)arg).getName())) { newArgs.addAll(newParams); } else { newArgs.add(arg); } } changed.add(lc.getCurrentFunction().getId()); final CallNode newCallNode = callNode.setArgs(newArgs).setIsApplyToCall(); if (log.isEnabled()) { log.fine("Transformed ", callNode, " from apply to call => ", newCallNode, " in ", DebugLogger.quote(lc.getCurrentFunction().getName())); } return newCallNode; } return callNode; }
Example 17
Source File: ApplySpecialization.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
@Override public Node leaveCallNode(final CallNode callNode) { //apply needs to be a global symbol or we don't allow it final List<IdentNode> newParams = explodedArguments.peek(); if (isApply(callNode)) { final List<Expression> newArgs = new ArrayList<>(); for (final Expression arg : callNode.getArgs()) { if (arg instanceof IdentNode && ARGUMENTS.equals(((IdentNode)arg).getName())) { newArgs.addAll(newParams); } else { newArgs.add(arg); } } changed.add(lc.getCurrentFunction().getId()); final CallNode newCallNode = callNode.setArgs(newArgs).setIsApplyToCall(); if (log.isEnabled()) { log.fine("Transformed ", callNode, " from apply to call => ", newCallNode, " in ", DebugLogger.quote(lc.getCurrentFunction().getName())); } return newCallNode; } return callNode; }
Example 18
Source File: ApplySpecialization.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
@Override public Node leaveCallNode(final CallNode callNode) { //apply needs to be a global symbol or we don't allow it final List<IdentNode> newParams = explodedArguments.peek(); if (isApply(callNode)) { final List<Expression> newArgs = new ArrayList<>(); for (final Expression arg : callNode.getArgs()) { if (arg instanceof IdentNode && ARGUMENTS.equals(((IdentNode)arg).getName())) { newArgs.addAll(newParams); } else { newArgs.add(arg); } } changed.add(lc.getCurrentFunction().getId()); final CallNode newCallNode = callNode.setArgs(newArgs).setIsApplyToCall(); if (log.isEnabled()) { log.fine("Transformed ", callNode, " from apply to call => ", newCallNode, " in ", DebugLogger.quote(lc.getCurrentFunction().getName())); } return newCallNode; } return callNode; }
Example 19
Source File: ApplySpecialization.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
@Override public Node leaveCallNode(final CallNode callNode) { //apply needs to be a global symbol or we don't allow it final List<IdentNode> newParams = explodedArguments.peek(); if (isApply(callNode)) { final List<Expression> newArgs = new ArrayList<>(); for (final Expression arg : callNode.getArgs()) { if (arg instanceof IdentNode && ARGUMENTS.equals(((IdentNode)arg).getName())) { newArgs.addAll(newParams); } else { newArgs.add(arg); } } changed.add(lc.getCurrentFunction().getId()); final CallNode newCallNode = callNode.setArgs(newArgs).setIsApplyToCall(); if (log.isEnabled()) { log.fine("Transformed ", callNode, " from apply to call => ", newCallNode, " in ", DebugLogger.quote(lc.getCurrentFunction().getName())); } return newCallNode; } return callNode; }
Example 20
Source File: ApplySpecialization.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
@Override public Node leaveCallNode(final CallNode callNode) { //apply needs to be a global symbol or we don't allow it final List<IdentNode> newParams = explodedArguments.peek(); if (isApply(callNode)) { final List<Expression> newArgs = new ArrayList<>(); for (final Expression arg : callNode.getArgs()) { if (arg instanceof IdentNode && ARGUMENTS.equals(((IdentNode)arg).getName())) { newArgs.addAll(newParams); } else { newArgs.add(arg); } } changed.add(lc.getCurrentFunction().getId()); final CallNode newCallNode = callNode.setArgs(newArgs).setIsApplyToCall(); if (log.isEnabled()) { log.fine("Transformed ", callNode, " from apply to call => ", newCallNode, " in ", DebugLogger.quote(lc.getCurrentFunction().getName())); } return newCallNode; } return callNode; }