src/jdk/nashorn/internal/runtime/SetMethodCreator.java

Print this page

        

*** 29,39 **** import static jdk.nashorn.internal.lookup.Lookup.MH; import java.lang.invoke.MethodHandle; import jdk.internal.dynalink.CallSiteDescriptor; import jdk.internal.dynalink.linker.GuardedInvocation; - import jdk.nashorn.internal.codegen.ObjectClassGenerator; import jdk.nashorn.internal.lookup.Lookup; import jdk.nashorn.internal.runtime.linker.NashornCallSiteDescriptor; import jdk.nashorn.internal.runtime.linker.NashornGuards; --- 29,38 ----
*** 102,126 **** /** * Composes from its components an actual guarded invocation that represents the dynamic setter method for the property. * @return the composed guarded invocation that represents the dynamic setter method for the property. */ GuardedInvocation createGuardedInvocation() { ! return new GuardedInvocation(methodHandle, getGuard()); } - private MethodHandle getGuard() { - return needsNoGuard() ? null : NashornGuards.getMapGuard(getMap()); - } - - private boolean needsNoGuard() { - return NashornCallSiteDescriptor.isFastScope(desc) && - (ObjectClassGenerator.OBJECT_FIELDS_ONLY || isPropertyTypeStable()); - } - - private boolean isPropertyTypeStable() { - return property == null || !property.canChangeType(); - } } private SetMethod createSetMethod() { if (find != null) { return createExistingPropertySetter(); --- 101,113 ---- /** * Composes from its components an actual guarded invocation that represents the dynamic setter method for the property. * @return the composed guarded invocation that represents the dynamic setter method for the property. */ GuardedInvocation createGuardedInvocation() { ! return new GuardedInvocation(methodHandle, NashornGuards.getGuard(sobj, property, desc)); } } private SetMethod createSetMethod() { if (find != null) { return createExistingPropertySetter();
*** 152,173 **** assert property != null; final MethodHandle boundHandle; if (!property.hasSetterFunction(find.getOwner()) && find.isInherited()) { // Bind or add prototype filter depending on whether this is a scope object. ! boundHandle = sobj.isScope() ? ! ScriptObject.addProtoFilter(methodHandle, find.getProtoChainLength()): ! ScriptObject.bindTo(methodHandle, find.getOwner()); } else { boundHandle = methodHandle; } return new SetMethod(boundHandle, property); } private SetMethod createGlobalPropertySetter() { final ScriptObject global = Context.getGlobalTrusted(); ! return new SetMethod(ScriptObject.bindTo(global.addSpill(getName()), global), null); } private SetMethod createNewPropertySetter() { final SetMethod sm = map.getFieldCount() < map.getFieldMaximum() ? createNewFieldSetter() : createNewSpillPropertySetter(); final PropertyListeners listeners = map.getListeners(); --- 139,158 ---- assert property != null; final MethodHandle boundHandle; if (!property.hasSetterFunction(find.getOwner()) && find.isInherited()) { // Bind or add prototype filter depending on whether this is a scope object. ! boundHandle = ScriptObject.addProtoFilter(methodHandle, find.getProtoChainLength()); } else { boundHandle = methodHandle; } return new SetMethod(boundHandle, property); } private SetMethod createGlobalPropertySetter() { final ScriptObject global = Context.getGlobalTrusted(); ! return new SetMethod(MH.filterArguments(global.addSpill(getName()), 0, ScriptObject.GLOBALFILTER), null); } private SetMethod createNewPropertySetter() { final SetMethod sm = map.getFieldCount() < map.getFieldMaximum() ? createNewFieldSetter() : createNewSpillPropertySetter(); final PropertyListeners listeners = map.getListeners();