168
169 assert methodHandle != null;
170 assert property != null;
171
172 final MethodHandle boundHandle;
173 if (find.isInheritedOrdinaryProperty()) {
174 boundHandle = ScriptObject.addProtoFilter(methodHandle, find.getProtoChainLength());
175 } else {
176 boundHandle = methodHandle;
177 }
178 return new SetMethod(boundHandle, property);
179 }
180
181 private SetMethod createGlobalPropertySetter() {
182 final ScriptObject global = Context.getGlobal();
183 return new SetMethod(MH.filterArguments(global.addSpill(type, getName()), 0, ScriptObject.GLOBALFILTER), null);
184 }
185
186 private SetMethod createNewPropertySetter(final SwitchPoint builtinSwitchPoint) {
187 final SetMethod sm = map.getFreeFieldSlot() > -1 ? createNewFieldSetter(builtinSwitchPoint) : createNewSpillPropertySetter(builtinSwitchPoint);
188 map.propertyAdded(sm.property, true);
189 return sm;
190 }
191
192 private SetMethod createNewSetter(final Property property, final SwitchPoint builtinSwitchPoint) {
193 property.setBuiltinSwitchPoint(builtinSwitchPoint);
194
195 final PropertyMap oldMap = getMap();
196 final PropertyMap newMap = getNewMap(property);
197 final boolean isStrict = NashornCallSiteDescriptor.isStrict(desc);
198 final String name = NashornCallSiteDescriptor.getOperand(desc);
199
200 //fast type specific setter
201 final MethodHandle fastSetter = property.getSetter(type, newMap); //0 sobj, 1 value, slot folded for spill property already
202
203 //slow setter, that calls ScriptObject.set with appropriate type and key name
204 MethodHandle slowSetter = ScriptObject.SET_SLOW[getAccessorTypeIndex(type)];
205 slowSetter = MH.insertArguments(slowSetter, 3, NashornCallSiteDescriptor.getFlags(desc));
206 slowSetter = MH.insertArguments(slowSetter, 1, name);
207 slowSetter = MH.asType(slowSetter, slowSetter.type().changeParameterType(0, Object.class));
208
|
168
169 assert methodHandle != null;
170 assert property != null;
171
172 final MethodHandle boundHandle;
173 if (find.isInheritedOrdinaryProperty()) {
174 boundHandle = ScriptObject.addProtoFilter(methodHandle, find.getProtoChainLength());
175 } else {
176 boundHandle = methodHandle;
177 }
178 return new SetMethod(boundHandle, property);
179 }
180
181 private SetMethod createGlobalPropertySetter() {
182 final ScriptObject global = Context.getGlobal();
183 return new SetMethod(MH.filterArguments(global.addSpill(type, getName()), 0, ScriptObject.GLOBALFILTER), null);
184 }
185
186 private SetMethod createNewPropertySetter(final SwitchPoint builtinSwitchPoint) {
187 final SetMethod sm = map.getFreeFieldSlot() > -1 ? createNewFieldSetter(builtinSwitchPoint) : createNewSpillPropertySetter(builtinSwitchPoint);
188 map.invalidateProperty(sm.property);
189 return sm;
190 }
191
192 private SetMethod createNewSetter(final Property property, final SwitchPoint builtinSwitchPoint) {
193 property.setBuiltinSwitchPoint(builtinSwitchPoint);
194
195 final PropertyMap oldMap = getMap();
196 final PropertyMap newMap = getNewMap(property);
197 final boolean isStrict = NashornCallSiteDescriptor.isStrict(desc);
198 final String name = NashornCallSiteDescriptor.getOperand(desc);
199
200 //fast type specific setter
201 final MethodHandle fastSetter = property.getSetter(type, newMap); //0 sobj, 1 value, slot folded for spill property already
202
203 //slow setter, that calls ScriptObject.set with appropriate type and key name
204 MethodHandle slowSetter = ScriptObject.SET_SLOW[getAccessorTypeIndex(type)];
205 slowSetter = MH.insertArguments(slowSetter, 3, NashornCallSiteDescriptor.getFlags(desc));
206 slowSetter = MH.insertArguments(slowSetter, 1, name);
207 slowSetter = MH.asType(slowSetter, slowSetter.type().changeParameterType(0, Object.class));
208
|