8065985: Inlining failure of Number.doubleValue() in JSType.toNumeric() causes 15% peak perf regresion on Box2D
authorvlivanov
Thu, 27 Nov 2014 17:14:01 +0400
changeset 27816 c6c53c5adc51
parent 27815 6ed8e97e8fb6
child 27817 56f6161c3e55
8065985: Inlining failure of Number.doubleValue() in JSType.toNumeric() causes 15% peak perf regresion on Box2D Reviewed-by: lagergren, hannesw
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/JSType.java
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/JSType.java	Thu Nov 27 13:04:46 2014 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/JSType.java	Thu Nov 27 17:14:01 2014 +0400
@@ -714,6 +714,9 @@
      * @return a number
      */
     public static double toNumber(final Object obj) {
+        if (obj instanceof Double) {
+            return (Double)obj;
+        }
         if (obj instanceof Number) {
             return ((Number)obj).doubleValue();
         }