changeset 1091:56c0d55ea562

8063037: ApplySpecialization.hasApplies shouuld not descend into nested functions Reviewed-by: hannesw, lagergren
author attila
date Wed, 12 Nov 2014 14:54:40 +0100
parents 6c2680043f5b
children 3dbb4c9ff43c
files src/jdk/nashorn/internal/codegen/ApplySpecialization.java
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk/nashorn/internal/codegen/ApplySpecialization.java	Tue Nov 11 10:39:52 2014 -0800
+++ b/src/jdk/nashorn/internal/codegen/ApplySpecialization.java	Wed Nov 12 14:54:40 2014 +0100
@@ -141,6 +141,11 @@
         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 @@
      * 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<>();