aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorattila <none@none>2014-11-12 14:54:40 +0100
committerattila <none@none>2014-11-12 14:54:40 +0100
commitad1f19bf8aa630361954225d977bc126c3c1d9a0 (patch)
treec4e419882165f1f6dbd94e5e6aebe76c70785049
parent9adcbe0926f62e91c240f6dac9179420ac2326ef (diff)
downloadnashorn-ad1f19bf8aa630361954225d977bc126c3c1d9a0.tar.gz
8063037: ApplySpecialization.hasApplies shouuld not descend into nested functions
Reviewed-by: hannesw, lagergren
-rw-r--r--src/jdk/nashorn/internal/codegen/ApplySpecialization.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/jdk/nashorn/internal/codegen/ApplySpecialization.java b/src/jdk/nashorn/internal/codegen/ApplySpecialization.java
index 274afc84..62e58f46 100644
--- a/src/jdk/nashorn/internal/codegen/ApplySpecialization.java
+++ b/src/jdk/nashorn/internal/codegen/ApplySpecialization.java
@@ -141,6 +141,11 @@ public final class ApplySpecialization extends NodeVisitor<LexicalContext> imple
try {
functionNode.accept(new NodeVisitor<LexicalContext>(new LexicalContext()) {
@Override
+ public boolean enterFunctionNode(final FunctionNode fn) {
+ return fn == functionNode;
+ }
+
+ @Override
public boolean enterCallNode(final CallNode callNode) {
if (isApply(callNode)) {
throw HAS_APPLIES;
@@ -162,7 +167,7 @@ public final class ApplySpecialization extends NodeVisitor<LexicalContext> imple
* scope, thus we are conservative and treat any access to arguments outside the
* apply call as a case of "we cannot apply the optimization".
*/
- private void checkValidTransform(final FunctionNode functionNode) {
+ private static void checkValidTransform(final FunctionNode functionNode) {
final Set<Expression> argumentsFound = new HashSet<>();
final Deque<Set<Expression>> stack = new ArrayDeque<>();