changeset 986:9388010e3a8e

8055913: Node.hashCode() delegates to Object.hashCode() and is hot Reviewed-by: lagergren, sundar
author attila
date Tue, 26 Aug 2014 11:32:12 +0200
parents 10c95d040380
children f03ee361fa76
files src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/Node.java
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/Node.java	Tue Aug 26 11:31:31 2014 +0200
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/Node.java	Tue Aug 26 11:32:12 2014 +0200
@@ -178,12 +178,15 @@
 
     @Override
     public final boolean equals(final Object other) {
-        return super.equals(other);
+        return this == other;
     }
 
     @Override
     public final int hashCode() {
-        return super.hashCode();
+        // NOTE: we aren't delegating to Object.hashCode as it still requires trip to the VM for initializing,
+        // it touches the object header and/or stores the identity hashcode somewhere, etc. There's several
+        // places in the compiler pipeline that store nodes in maps, so this can get hot.
+        return Long.hashCode(token);
     }
 
     /**