changeset 381:d1886ad46f0c

8019175: Simplify ScriptObject.modifyOwnProperty Reviewed-by: hannesw Contributed-by: james.laskey@oracle.com
author jlaskey
date Wed, 26 Jun 2013 12:38:35 -0300
parents 635098f9f45e
children f9c855b828fe
files src/jdk/nashorn/internal/objects/ScriptFunctionImpl.java src/jdk/nashorn/internal/runtime/ScriptObject.java
diffstat 2 files changed, 1 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- 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.
--- 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));
         }