8011219: Regression with recent PropertyMap history changes
authorhannesw
Tue, 02 Apr 2013 13:55:49 +0200
changeset 16759 ecf99910fc31
parent 16758 4f7379c41907
child 16760 d3a094bca83f
8011219: Regression with recent PropertyMap history changes Reviewed-by: jlaskey, lagergren
nashorn/src/jdk/nashorn/internal/runtime/PropertyMap.java
--- a/nashorn/src/jdk/nashorn/internal/runtime/PropertyMap.java	Sun Mar 31 08:19:11 2013 -0300
+++ b/nashorn/src/jdk/nashorn/internal/runtime/PropertyMap.java	Tue Apr 02 13:55:49 2013 +0200
@@ -526,13 +526,11 @@
      * @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<>();
-            }
+        if (protoHistory == null) {
+            protoHistory = new WeakHashMap<>();
+        }
 
-            protoHistory.put(newProto, new WeakReference<>(newMap));
-        }
+        protoHistory.put(newProto, new WeakReference<>(newMap));
     }
 
     /**
@@ -542,13 +540,11 @@
      * @param newMap   Modified {@link PropertyMap}.
      */
     private void addToHistory(final Property property, final PropertyMap newMap) {
-        if (!properties.isEmpty()) {
-            if (history == null) {
-                history = new LinkedHashMap<>();
-            }
+        if (history == null) {
+            history = new LinkedHashMap<>();
+        }
 
-            history.put(property, newMap);
-        }
+        history.put(property, newMap);
     }
 
     /**