# HG changeset patch # User jlaskey # Date 1372261115 10800 # Node ID d1886ad46f0cc62d1ee0f483f0007a3841559247 # Parent 635098f9f45edeec116e60674ea0f3b0eb49082e 8019175: Simplify ScriptObject.modifyOwnProperty Reviewed-by: hannesw Contributed-by: james.laskey@oracle.com diff -r 635098f9f45e -r d1886ad46f0c src/jdk/nashorn/internal/objects/ScriptFunctionImpl.java --- a/src/jdk/nashorn/internal/objects/ScriptFunctionImpl.java Wed Jun 26 19:42:17 2013 +0530 +++ b/src/jdk/nashorn/internal/objects/ScriptFunctionImpl.java Wed Jun 26 12:38:35 2013 -0300 @@ -149,12 +149,6 @@ return typeErrorThrower; } - // add a new property that throws TypeError on get as well as set - static synchronized PropertyMap newThrowerProperty(final PropertyMap map, final String name) { - return map.newProperty(name, Property.NOT_ENUMERABLE | Property.NOT_CONFIGURABLE, -1, - Lookup.TYPE_ERROR_THROWER_GETTER, Lookup.TYPE_ERROR_THROWER_SETTER); - } - private static PropertyMap createStrictModeMap(PropertyMap map) { final int flags = Property.NOT_ENUMERABLE | Property.NOT_CONFIGURABLE; // Need to add properties directly to map since slots are assigned speculatively by newUserAccessors. diff -r 635098f9f45e -r d1886ad46f0c src/jdk/nashorn/internal/runtime/ScriptObject.java --- a/src/jdk/nashorn/internal/runtime/ScriptObject.java Wed Jun 26 19:42:17 2013 +0530 +++ b/src/jdk/nashorn/internal/runtime/ScriptObject.java Wed Jun 26 12:38:35 2013 -0300 @@ -868,9 +868,7 @@ public final void setUserAccessors(final String key, final ScriptFunction getter, final ScriptFunction setter) { final Property oldProperty = getMap().findProperty(key); if (oldProperty instanceof UserAccessorProperty) { - final UserAccessorProperty ua = (UserAccessorProperty)oldProperty; - setSpill(ua.getGetterSlot(), getter); - setSpill(ua.getSetterSlot(), setter); + modifyOwnProperty(oldProperty, oldProperty.getFlags(), getter, setter); } else { addOwnProperty(newUserAccessors(key, oldProperty != null ? oldProperty.getFlags() : 0, getter, setter)); }