changeset 26244:4f3e221fd4ad

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 438aba09d465
children 136ee2110f57
files nashorn/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/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/Node.java	Tue Aug 26 11:31:31 2014 +0200
+++ b/nashorn/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);
     }
 
     /**