8019175: Simplify ScriptObject.modifyOwnProperty
Reviewed-by: hannesw
Contributed-by: james.laskey@oracle.com
--- a/nashorn/src/jdk/nashorn/internal/objects/ScriptFunctionImpl.java Wed Jun 26 19:42:17 2013 +0530
+++ b/nashorn/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.
--- a/nashorn/src/jdk/nashorn/internal/runtime/ScriptObject.java Wed Jun 26 19:42:17 2013 +0530
+++ b/nashorn/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));
}