Tue, 26 Aug 2014 11:42:07 +0200
8055906: Avoid throwing an exception with filled in stack trace as part of the normal control flow
Reviewed-by: attila, hannesw
src/jdk/nashorn/internal/codegen/ApplySpecialization.java | file | annotate | diff | comparison | revisions |
1.1 --- a/src/jdk/nashorn/internal/codegen/ApplySpecialization.java Wed Aug 27 14:34:22 2014 +0200 1.2 +++ b/src/jdk/nashorn/internal/codegen/ApplySpecialization.java Tue Aug 26 11:42:07 2014 +0200 1.3 @@ -35,6 +35,7 @@ 1.4 import java.util.HashSet; 1.5 import java.util.List; 1.6 import java.util.Set; 1.7 + 1.8 import jdk.nashorn.internal.ir.AccessNode; 1.9 import jdk.nashorn.internal.ir.CallNode; 1.10 import jdk.nashorn.internal.ir.Expression; 1.11 @@ -127,6 +128,14 @@ 1.12 */ 1.13 private boolean argumentsEscape(final FunctionNode functionNode) { 1.14 1.15 + @SuppressWarnings("serial") 1.16 + final UnsupportedOperationException uoe = new UnsupportedOperationException() { 1.17 + @Override 1.18 + public Throwable fillInStackTrace() { 1.19 + return null; 1.20 + } 1.21 + }; 1.22 + 1.23 final Deque<Set<Expression>> stack = new ArrayDeque<>(); 1.24 //ensure that arguments is only passed as arg to apply 1.25 try { 1.26 @@ -151,7 +160,7 @@ 1.27 @Override 1.28 public Node leaveIdentNode(final IdentNode identNode) { 1.29 if (isParam(identNode.getName()) || ARGUMENTS.equals(identNode.getName()) && !isCurrentArg(identNode)) { 1.30 - throw new UnsupportedOperationException(); 1.31 + throw uoe; //avoid filling in stack trace 1.32 } 1.33 return identNode; 1.34 }