From 10cd2de7ed00189c5b8377bef5fbb9a51c747488 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20Walln=C3=B6fer?= Date: Tue, 2 Apr 2013 13:55:49 +0200 Subject: [PATCH] 8011219: Regression with recent PropertyMap history changes Reviewed-by: jlaskey, lagergren --- .../nashorn/internal/runtime/PropertyMap.java | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/nashorn/src/jdk/nashorn/internal/runtime/PropertyMap.java b/nashorn/src/jdk/nashorn/internal/runtime/PropertyMap.java index fc8ddd70140..19c12b7a277 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/PropertyMap.java +++ b/nashorn/src/jdk/nashorn/internal/runtime/PropertyMap.java @@ -526,13 +526,11 @@ public final class PropertyMap implements Iterable, PropertyListener { * @param newMap {@link PropertyMap} associated with prototype. */ private void addToProtoHistory(final ScriptObject newProto, final PropertyMap newMap) { - if (!properties.isEmpty()) { - if (protoHistory == null) { - protoHistory = new WeakHashMap<>(); - } - - protoHistory.put(newProto, new WeakReference<>(newMap)); + if (protoHistory == null) { + protoHistory = new WeakHashMap<>(); } + + protoHistory.put(newProto, new WeakReference<>(newMap)); } /** @@ -542,13 +540,11 @@ public final class PropertyMap implements Iterable, PropertyListener { * @param newMap Modified {@link PropertyMap}. */ private void addToHistory(final Property property, final PropertyMap newMap) { - if (!properties.isEmpty()) { - if (history == null) { - history = new LinkedHashMap<>(); - } - - history.put(property, newMap); + if (history == null) { + history = new LinkedHashMap<>(); } + + history.put(property, newMap); } /**