aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhannesw <none@none>2013-06-11 17:50:10 +0200
committerhannesw <none@none>2013-06-11 17:50:10 +0200
commit80124a13c4d3b869e2f00657c8412571894f7635 (patch)
tree203211b67a81b9f362a38f0b1f27c28c4d1f9c56
parent0e4ad3296e8eab24a0450363caa08d69e543ea00 (diff)
downloadnashorn-80124a13c4d3b869e2f00657c8412571894f7635.tar.gz
8015379: PropertyMap.addProperty() is slow
Reviewed-by: attila, jlaskey
-rw-r--r--src/jdk/nashorn/internal/runtime/PropertyMap.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/jdk/nashorn/internal/runtime/PropertyMap.java b/src/jdk/nashorn/internal/runtime/PropertyMap.java
index 077218d3..b7248166 100644
--- a/src/jdk/nashorn/internal/runtime/PropertyMap.java
+++ b/src/jdk/nashorn/internal/runtime/PropertyMap.java
@@ -95,7 +95,6 @@ public final class PropertyMap implements Iterable<Object>, PropertyListener {
*/
private PropertyMap(final PropertyHashMap properties, final int fieldCount, final int fieldMaximum) {
this.properties = properties;
- this.hashCode = computeHashCode();
this.fieldCount = fieldCount;
this.fieldMaximum = fieldMaximum;
@@ -125,7 +124,6 @@ public final class PropertyMap implements Iterable<Object>, PropertyListener {
this.spillLength = propertyMap.spillLength;
this.fieldCount = propertyMap.fieldCount;
this.fieldMaximum = propertyMap.fieldMaximum;
- this.hashCode = computeHashCode();
if (Context.DEBUG) {
count++;
@@ -610,6 +608,9 @@ public final class PropertyMap implements Iterable<Object>, PropertyListener {
@Override
public int hashCode() {
+ if (hashCode == 0 && !properties.isEmpty()) {
+ hashCode = computeHashCode();
+ }
return hashCode;
}