changeset 1102:ee608f19cc48

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 91d9969f2574
children d248a0bddf79
files src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ApplySpecialization.java
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ApplySpecialization.java	Wed Nov 12 14:40:05 2014 +0100
+++ b/src/jdk.scripting.nashorn/share/classes/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<>();