8055906: Avoid throwing an exception with filled in stack trace as part of the normal control flow
authorlagergren
Tue, 26 Aug 2014 11:42:07 +0200
changeset 26245 136ee2110f57
parent 26244 4f3e221fd4ad
child 26246 66c7c54fe70c
8055906: Avoid throwing an exception with filled in stack trace as part of the normal control flow Reviewed-by: attila, hannesw
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ApplySpecialization.java
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ApplySpecialization.java	Tue Aug 26 11:32:12 2014 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ApplySpecialization.java	Tue Aug 26 11:42:07 2014 +0200
@@ -35,6 +35,7 @@
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
+
 import jdk.nashorn.internal.ir.AccessNode;
 import jdk.nashorn.internal.ir.CallNode;
 import jdk.nashorn.internal.ir.Expression;
@@ -127,6 +128,14 @@
      */
     private boolean argumentsEscape(final FunctionNode functionNode) {
 
+        @SuppressWarnings("serial")
+        final UnsupportedOperationException uoe = new UnsupportedOperationException() {
+            @Override
+            public Throwable fillInStackTrace() {
+                return null;
+            }
+        };
+
         final Deque<Set<Expression>> stack = new ArrayDeque<>();
         //ensure that arguments is only passed as arg to apply
         try {
@@ -151,7 +160,7 @@
                 @Override
                 public Node leaveIdentNode(final IdentNode identNode) {
                     if (isParam(identNode.getName()) || ARGUMENTS.equals(identNode.getName()) && !isCurrentArg(identNode)) {
-                        throw new UnsupportedOperationException();
+                        throw uoe; //avoid filling in stack trace
                     }
                     return identNode;
                 }