8055913: Node.hashCode() delegates to Object.hashCode() and is hot
Reviewed-by: lagergren, sundar
--- 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);
}
/**