8011219: Regression with recent PropertyMap history changes
Reviewed-by: jlaskey, lagergren
--- 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);
}
/**