Wed, 26 Jun 2013 12:38:35 -0300
8019175: Simplify ScriptObject.modifyOwnProperty
Reviewed-by: hannesw
Contributed-by: james.laskey@oracle.com
1.1 --- a/src/jdk/nashorn/internal/objects/ScriptFunctionImpl.java Wed Jun 26 19:42:17 2013 +0530 1.2 +++ b/src/jdk/nashorn/internal/objects/ScriptFunctionImpl.java Wed Jun 26 12:38:35 2013 -0300 1.3 @@ -149,12 +149,6 @@ 1.4 return typeErrorThrower; 1.5 } 1.6 1.7 - // add a new property that throws TypeError on get as well as set 1.8 - static synchronized PropertyMap newThrowerProperty(final PropertyMap map, final String name) { 1.9 - return map.newProperty(name, Property.NOT_ENUMERABLE | Property.NOT_CONFIGURABLE, -1, 1.10 - Lookup.TYPE_ERROR_THROWER_GETTER, Lookup.TYPE_ERROR_THROWER_SETTER); 1.11 - } 1.12 - 1.13 private static PropertyMap createStrictModeMap(PropertyMap map) { 1.14 final int flags = Property.NOT_ENUMERABLE | Property.NOT_CONFIGURABLE; 1.15 // Need to add properties directly to map since slots are assigned speculatively by newUserAccessors.
2.1 --- a/src/jdk/nashorn/internal/runtime/ScriptObject.java Wed Jun 26 19:42:17 2013 +0530 2.2 +++ b/src/jdk/nashorn/internal/runtime/ScriptObject.java Wed Jun 26 12:38:35 2013 -0300 2.3 @@ -868,9 +868,7 @@ 2.4 public final void setUserAccessors(final String key, final ScriptFunction getter, final ScriptFunction setter) { 2.5 final Property oldProperty = getMap().findProperty(key); 2.6 if (oldProperty instanceof UserAccessorProperty) { 2.7 - final UserAccessorProperty ua = (UserAccessorProperty)oldProperty; 2.8 - setSpill(ua.getGetterSlot(), getter); 2.9 - setSpill(ua.getSetterSlot(), setter); 2.10 + modifyOwnProperty(oldProperty, oldProperty.getFlags(), getter, setter); 2.11 } else { 2.12 addOwnProperty(newUserAccessors(key, oldProperty != null ? oldProperty.getFlags() : 0, getter, setter)); 2.13 }