JDK-8055906 : jdk.nashorn.internal.codegen.ApplySpecialization$1.leaveIdentNode() should throw stackless Exception
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: jdk.nashorn
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2014-08-25
  • Updated: 2015-06-04
  • Resolved: 2014-08-26
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8 JDK 9
8u40Fixed 9 b29Fixed
Description
Profiling a simple scenario:

$ ~/Install/jdk9u20/bin/java -jar dist/nashorn.jar  -Dnashorn.typeInfo.disabled=false --class-cache-size=0 --persistent-code-cache=false -scripting --log=time test/script/basic/compile-octane.js -- --iterations 5

...yields a few simple low-hanging fruits, here is one of them. Out of 320 seconds of run, 20 seconds is spent here:

19.750	jdk.nashorn.internal.ir.IdentNode.accept(jdk.nashorn.internal.ir.visitor.NodeVisitor)
19.750	jdk.nashorn.internal.codegen.ApplySpecialization$1.leaveIdentNode(jdk.nashorn.internal.ir.IdentNode)
19.140	java.lang.UnsupportedOperationException.<init>()
19.150	java.lang.RuntimeException.<init>()
19.150	java.lang.Exception.<init>()
19.150	java.lang.Throwable.<init>()
20.290	java.lang.Throwable.fillInStackTrace()

Please throw some different from UOE from ApplySpecialization$1.leaveIdentNode(), the exception with fillInStackTrace() overridden should be best. You may also consider throwing the pre-cached exception from the static field, if that is not messy for the Nashorn code.
Comments
Awesome. Please keep these low hangers coming.
25-08-2014