changeset 987:f03ee361fa76

8055906: Avoid throwing an exception with filled in stack trace as part of the normal control flow Reviewed-by: attila, hannesw
author lagergren
date Tue, 26 Aug 2014 11:42:07 +0200
parents 9388010e3a8e
children d81f7c897bdf
files src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ApplySpecialization.java
diffstat 1 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ApplySpecialization.java	Tue Aug 26 11:32:12 2014 +0200
+++ b/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;
                 }