aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;
}