aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvlivanov <none@none>2014-11-27 17:14:01 +0400
committervlivanov <none@none>2014-11-27 17:14:01 +0400
commitf3e4fff787c43bba0e454663a770e028df9e3fae (patch)
tree4d0499513abfd482b711025b9e0b92c8dd7bc571
parent39095683abf6079b39ddc3ebcfb43a47dd57572e (diff)
downloadnashorn-f3e4fff787c43bba0e454663a770e028df9e3fae.tar.gz
8065985: Inlining failure of Number.doubleValue() in JSType.toNumeric() causes 15% peak perf regresion on Box2D
Reviewed-by: lagergren, hannesw
-rw-r--r--src/jdk/nashorn/internal/runtime/JSType.java3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/jdk/nashorn/internal/runtime/JSType.java b/src/jdk/nashorn/internal/runtime/JSType.java
index 75395ea4..7e54b1e2 100644
--- a/src/jdk/nashorn/internal/runtime/JSType.java
+++ b/src/jdk/nashorn/internal/runtime/JSType.java
@@ -714,6 +714,9 @@ public enum JSType {
* @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();
}