Add infrastructure for pointer preparation.
[WebKit-https.git] / Source / WebCore / bindings / scripts / test / JS / JSTestNamedSetterWithIndexedGetterAndSetter.cpp
1 /*
2     This file is part of the WebKit open source project.
3     This file has been generated by generate-bindings.pl. DO NOT MODIFY!
4
5     This library is free software; you can redistribute it and/or
6     modify it under the terms of the GNU Library General Public
7     License as published by the Free Software Foundation; either
8     version 2 of the License, or (at your option) any later version.
9
10     This library is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13     Library General Public License for more details.
14
15     You should have received a copy of the GNU Library General Public License
16     along with this library; see the file COPYING.LIB.  If not, write to
17     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18     Boston, MA 02110-1301, USA.
19 */
20
21 #include "config.h"
22 #include "JSTestNamedSetterWithIndexedGetterAndSetter.h"
23
24 #include "JSDOMAbstractOperations.h"
25 #include "JSDOMBinding.h"
26 #include "JSDOMConstructorNotConstructable.h"
27 #include "JSDOMConvertNumbers.h"
28 #include "JSDOMConvertStrings.h"
29 #include "JSDOMExceptionHandling.h"
30 #include "JSDOMOperation.h"
31 #include "JSDOMWrapperCache.h"
32 #include "URL.h"
33 #include <runtime/FunctionPrototype.h>
34 #include <runtime/JSCInlines.h>
35 #include <runtime/PropertyNameArray.h>
36 #include <wtf/GetPtr.h>
37 #include <wtf/PointerPreparations.h>
38
39
40 namespace WebCore {
41 using namespace JSC;
42
43 // Functions
44
45 JSC::EncodedJSValue JSC_HOST_CALL jsTestNamedSetterWithIndexedGetterAndSetterPrototypeFunctionNamedSetter(JSC::ExecState*);
46 JSC::EncodedJSValue JSC_HOST_CALL jsTestNamedSetterWithIndexedGetterAndSetterPrototypeFunctionIndexedSetter(JSC::ExecState*);
47
48 // Attributes
49
50 JSC::EncodedJSValue jsTestNamedSetterWithIndexedGetterAndSetterConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
51 bool setJSTestNamedSetterWithIndexedGetterAndSetterConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
52
53 class JSTestNamedSetterWithIndexedGetterAndSetterPrototype : public JSC::JSNonFinalObject {
54 public:
55     using Base = JSC::JSNonFinalObject;
56     static JSTestNamedSetterWithIndexedGetterAndSetterPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
57     {
58         JSTestNamedSetterWithIndexedGetterAndSetterPrototype* ptr = new (NotNull, JSC::allocateCell<JSTestNamedSetterWithIndexedGetterAndSetterPrototype>(vm.heap)) JSTestNamedSetterWithIndexedGetterAndSetterPrototype(vm, globalObject, structure);
59         ptr->finishCreation(vm);
60         return ptr;
61     }
62
63     DECLARE_INFO;
64     static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
65     {
66         return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
67     }
68
69 private:
70     JSTestNamedSetterWithIndexedGetterAndSetterPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
71         : JSC::JSNonFinalObject(vm, structure)
72     {
73     }
74
75     void finishCreation(JSC::VM&);
76 };
77
78 using JSTestNamedSetterWithIndexedGetterAndSetterConstructor = JSDOMConstructorNotConstructable<JSTestNamedSetterWithIndexedGetterAndSetter>;
79
80 template<> JSValue JSTestNamedSetterWithIndexedGetterAndSetterConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
81 {
82     UNUSED_PARAM(vm);
83     return globalObject.functionPrototype();
84 }
85
86 template<> void JSTestNamedSetterWithIndexedGetterAndSetterConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
87 {
88     putDirect(vm, vm.propertyNames->prototype, JSTestNamedSetterWithIndexedGetterAndSetter::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
89     putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("TestNamedSetterWithIndexedGetterAndSetter"))), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
90     putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
91 }
92
93 template<> const ClassInfo JSTestNamedSetterWithIndexedGetterAndSetterConstructor::s_info = { "TestNamedSetterWithIndexedGetterAndSetter", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestNamedSetterWithIndexedGetterAndSetterConstructor) };
94
95 /* Hash table for prototype */
96
97 static const HashTableValue JSTestNamedSetterWithIndexedGetterAndSetterPrototypeTableValues[] =
98 {
99     { "constructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestNamedSetterWithIndexedGetterAndSetterConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestNamedSetterWithIndexedGetterAndSetterConstructor) } },
100     { "namedSetter", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestNamedSetterWithIndexedGetterAndSetterPrototypeFunctionNamedSetter), (intptr_t) (2) } },
101     { "indexedSetter", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestNamedSetterWithIndexedGetterAndSetterPrototypeFunctionIndexedSetter), (intptr_t) (1) } },
102 };
103
104 const ClassInfo JSTestNamedSetterWithIndexedGetterAndSetterPrototype::s_info = { "TestNamedSetterWithIndexedGetterAndSetterPrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestNamedSetterWithIndexedGetterAndSetterPrototype) };
105
106 void JSTestNamedSetterWithIndexedGetterAndSetterPrototype::finishCreation(VM& vm)
107 {
108     Base::finishCreation(vm);
109     reifyStaticProperties(vm, JSTestNamedSetterWithIndexedGetterAndSetter::info(), JSTestNamedSetterWithIndexedGetterAndSetterPrototypeTableValues, *this);
110 }
111
112 const ClassInfo JSTestNamedSetterWithIndexedGetterAndSetter::s_info = { "TestNamedSetterWithIndexedGetterAndSetter", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestNamedSetterWithIndexedGetterAndSetter) };
113
114 JSTestNamedSetterWithIndexedGetterAndSetter::JSTestNamedSetterWithIndexedGetterAndSetter(Structure* structure, JSDOMGlobalObject& globalObject, Ref<TestNamedSetterWithIndexedGetterAndSetter>&& impl)
115     : JSDOMWrapper<TestNamedSetterWithIndexedGetterAndSetter>(structure, globalObject, WTFMove(impl))
116 {
117 }
118
119 void JSTestNamedSetterWithIndexedGetterAndSetter::finishCreation(VM& vm)
120 {
121     Base::finishCreation(vm);
122     ASSERT(inherits(vm, info()));
123
124 }
125
126 JSObject* JSTestNamedSetterWithIndexedGetterAndSetter::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
127 {
128     return JSTestNamedSetterWithIndexedGetterAndSetterPrototype::create(vm, &globalObject, JSTestNamedSetterWithIndexedGetterAndSetterPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()));
129 }
130
131 JSObject* JSTestNamedSetterWithIndexedGetterAndSetter::prototype(VM& vm, JSDOMGlobalObject& globalObject)
132 {
133     return getDOMPrototype<JSTestNamedSetterWithIndexedGetterAndSetter>(vm, globalObject);
134 }
135
136 JSValue JSTestNamedSetterWithIndexedGetterAndSetter::getConstructor(VM& vm, const JSGlobalObject* globalObject)
137 {
138     return getDOMConstructor<JSTestNamedSetterWithIndexedGetterAndSetterConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
139 }
140
141 void JSTestNamedSetterWithIndexedGetterAndSetter::destroy(JSC::JSCell* cell)
142 {
143     JSTestNamedSetterWithIndexedGetterAndSetter* thisObject = static_cast<JSTestNamedSetterWithIndexedGetterAndSetter*>(cell);
144     thisObject->JSTestNamedSetterWithIndexedGetterAndSetter::~JSTestNamedSetterWithIndexedGetterAndSetter();
145 }
146
147 bool JSTestNamedSetterWithIndexedGetterAndSetter::getOwnPropertySlot(JSObject* object, ExecState* state, PropertyName propertyName, PropertySlot& slot)
148 {
149     auto* thisObject = jsCast<JSTestNamedSetterWithIndexedGetterAndSetter*>(object);
150     ASSERT_GC_OBJECT_INHERITS(thisObject, info());
151     if (auto index = parseIndex(propertyName)) {
152         if (index.value() < thisObject->wrapped().length()) {
153             auto value = toJS<IDLDOMString>(*state, thisObject->wrapped().indexedSetter(index.value()));
154             slot.setValue(thisObject, static_cast<unsigned>(0), value);
155             return true;
156         }
157         return JSObject::getOwnPropertySlot(object, state, propertyName, slot);
158     }
159     using GetterIDLType = IDLDOMString;
160     auto getterFunctor = [] (auto& thisObject, auto propertyName) -> std::optional<typename GetterIDLType::ImplementationType> {
161         auto result = thisObject.wrapped().namedItem(propertyNameToAtomicString(propertyName));
162         if (!GetterIDLType::isNullValue(result))
163             return typename GetterIDLType::ImplementationType { GetterIDLType::extractValueFromNullable(result) };
164         return std::nullopt;
165     };
166     if (auto namedProperty = accessVisibleNamedProperty<OverrideBuiltins::No>(*state, *thisObject, propertyName, getterFunctor)) {
167         auto value = toJS<IDLDOMString>(*state, WTFMove(namedProperty.value()));
168         slot.setValue(thisObject, static_cast<unsigned>(0), value);
169         return true;
170     }
171     return JSObject::getOwnPropertySlot(object, state, propertyName, slot);
172 }
173
174 bool JSTestNamedSetterWithIndexedGetterAndSetter::getOwnPropertySlotByIndex(JSObject* object, ExecState* state, unsigned index, PropertySlot& slot)
175 {
176     auto* thisObject = jsCast<JSTestNamedSetterWithIndexedGetterAndSetter*>(object);
177     ASSERT_GC_OBJECT_INHERITS(thisObject, info());
178     if (LIKELY(index <= MAX_ARRAY_INDEX)) {
179         if (index < thisObject->wrapped().length()) {
180             auto value = toJS<IDLDOMString>(*state, thisObject->wrapped().indexedSetter(index));
181             slot.setValue(thisObject, static_cast<unsigned>(0), value);
182             return true;
183         }
184         return JSObject::getOwnPropertySlotByIndex(object, state, index, slot);
185     }
186     auto propertyName = Identifier::from(state, index);
187     using GetterIDLType = IDLDOMString;
188     auto getterFunctor = [] (auto& thisObject, auto propertyName) -> std::optional<typename GetterIDLType::ImplementationType> {
189         auto result = thisObject.wrapped().namedItem(propertyNameToAtomicString(propertyName));
190         if (!GetterIDLType::isNullValue(result))
191             return typename GetterIDLType::ImplementationType { GetterIDLType::extractValueFromNullable(result) };
192         return std::nullopt;
193     };
194     if (auto namedProperty = accessVisibleNamedProperty<OverrideBuiltins::No>(*state, *thisObject, propertyName, getterFunctor)) {
195         auto value = toJS<IDLDOMString>(*state, WTFMove(namedProperty.value()));
196         slot.setValue(thisObject, static_cast<unsigned>(0), value);
197         return true;
198     }
199     return JSObject::getOwnPropertySlotByIndex(object, state, index, slot);
200 }
201
202 void JSTestNamedSetterWithIndexedGetterAndSetter::getOwnPropertyNames(JSObject* object, ExecState* state, PropertyNameArray& propertyNames, EnumerationMode mode)
203 {
204     auto* thisObject = jsCast<JSTestNamedSetterWithIndexedGetterAndSetter*>(object);
205     ASSERT_GC_OBJECT_INHERITS(object, info());
206     for (unsigned i = 0, count = thisObject->wrapped().length(); i < count; ++i)
207         propertyNames.add(Identifier::from(state, i));
208     for (auto& propertyName : thisObject->wrapped().supportedPropertyNames())
209         propertyNames.add(Identifier::fromString(state, propertyName));
210     JSObject::getOwnPropertyNames(object, state, propertyNames, mode);
211 }
212
213 bool JSTestNamedSetterWithIndexedGetterAndSetter::put(JSCell* cell, ExecState* state, PropertyName propertyName, JSValue value, PutPropertySlot& putPropertySlot)
214 {
215     auto* thisObject = jsCast<JSTestNamedSetterWithIndexedGetterAndSetter*>(cell);
216     ASSERT_GC_OBJECT_INHERITS(thisObject, info());
217
218     if (auto index = parseIndex(propertyName)) {
219         auto throwScope = DECLARE_THROW_SCOPE(state->vm());
220         auto nativeValue = convert<IDLDOMString>(*state, value);
221         RETURN_IF_EXCEPTION(throwScope, true);
222         thisObject->wrapped().indexedSetter(index.value(), WTFMove(nativeValue));
223         return true;
224     }
225
226     if (!propertyName.isSymbol()) {
227         PropertySlot slot { thisObject, PropertySlot::InternalMethodType::VMInquiry };
228         JSValue prototype = thisObject->getPrototypeDirect(state->vm());
229         if (!(prototype.isObject() && asObject(prototype)->getPropertySlot(state, propertyName, slot))) {
230             auto throwScope = DECLARE_THROW_SCOPE(state->vm());
231             auto nativeValue = convert<IDLDOMString>(*state, value);
232             RETURN_IF_EXCEPTION(throwScope, true);
233             thisObject->wrapped().namedSetter(propertyNameToString(propertyName), WTFMove(nativeValue));
234             return true;
235         }
236     }
237
238     return JSObject::put(thisObject, state, propertyName, value, putPropertySlot);
239 }
240
241 bool JSTestNamedSetterWithIndexedGetterAndSetter::putByIndex(JSCell* cell, ExecState* state, unsigned index, JSValue value, bool shouldThrow)
242 {
243     auto* thisObject = jsCast<JSTestNamedSetterWithIndexedGetterAndSetter*>(cell);
244     ASSERT_GC_OBJECT_INHERITS(thisObject, info());
245
246     if (LIKELY(index <= MAX_ARRAY_INDEX)) {
247         auto throwScope = DECLARE_THROW_SCOPE(state->vm());
248         auto nativeValue = convert<IDLDOMString>(*state, value);
249         RETURN_IF_EXCEPTION(throwScope, true);
250         thisObject->wrapped().indexedSetter(index, WTFMove(nativeValue));
251         return true;
252     }
253
254     auto propertyName = Identifier::from(state, index);
255     PropertySlot slot { thisObject, PropertySlot::InternalMethodType::VMInquiry };
256     JSValue prototype = thisObject->getPrototypeDirect(state->vm());
257     if (!(prototype.isObject() && asObject(prototype)->getPropertySlot(state, propertyName, slot))) {
258         auto throwScope = DECLARE_THROW_SCOPE(state->vm());
259         auto nativeValue = convert<IDLDOMString>(*state, value);
260         RETURN_IF_EXCEPTION(throwScope, true);
261         thisObject->wrapped().namedSetter(propertyNameToString(propertyName), WTFMove(nativeValue));
262         return true;
263     }
264
265     return JSObject::putByIndex(cell, state, index, value, shouldThrow);
266 }
267
268 bool JSTestNamedSetterWithIndexedGetterAndSetter::defineOwnProperty(JSObject* object, ExecState* state, PropertyName propertyName, const PropertyDescriptor& propertyDescriptor, bool shouldThrow)
269 {
270     auto* thisObject = jsCast<JSTestNamedSetterWithIndexedGetterAndSetter*>(object);
271     ASSERT_GC_OBJECT_INHERITS(thisObject, info());
272
273     if (auto index = parseIndex(propertyName)) {
274         if (!propertyDescriptor.isDataDescriptor())
275             return false;
276         auto throwScope = DECLARE_THROW_SCOPE(state->vm());
277         auto nativeValue = convert<IDLDOMString>(*state, propertyDescriptor.value());
278         RETURN_IF_EXCEPTION(throwScope, true);
279         thisObject->wrapped().indexedSetter(index.value(), WTFMove(nativeValue));
280         return true;
281     }
282
283     if (!propertyName.isSymbol()) {
284         PropertySlot slot { thisObject, PropertySlot::InternalMethodType::VMInquiry };
285         if (!JSObject::getOwnPropertySlot(thisObject, state, propertyName, slot)) {
286             if (!propertyDescriptor.isDataDescriptor())
287                 return false;
288             auto throwScope = DECLARE_THROW_SCOPE(state->vm());
289             auto nativeValue = convert<IDLDOMString>(*state, propertyDescriptor.value());
290             RETURN_IF_EXCEPTION(throwScope, true);
291             thisObject->wrapped().namedSetter(propertyNameToString(propertyName), WTFMove(nativeValue));
292             return true;
293         }
294     }
295
296     PropertyDescriptor newPropertyDescriptor = propertyDescriptor;
297     newPropertyDescriptor.setConfigurable(true);
298     return JSObject::defineOwnProperty(object, state, propertyName, newPropertyDescriptor, shouldThrow);
299 }
300
301 template<> inline JSTestNamedSetterWithIndexedGetterAndSetter* IDLOperation<JSTestNamedSetterWithIndexedGetterAndSetter>::cast(ExecState& state)
302 {
303     return jsDynamicDowncast<JSTestNamedSetterWithIndexedGetterAndSetter*>(state.vm(), state.thisValue());
304 }
305
306 EncodedJSValue jsTestNamedSetterWithIndexedGetterAndSetterConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
307 {
308     VM& vm = state->vm();
309     auto throwScope = DECLARE_THROW_SCOPE(vm);
310     auto* prototype = jsDynamicDowncast<JSTestNamedSetterWithIndexedGetterAndSetterPrototype*>(vm, JSValue::decode(thisValue));
311     if (UNLIKELY(!prototype))
312         return throwVMTypeError(state, throwScope);
313     return JSValue::encode(JSTestNamedSetterWithIndexedGetterAndSetter::getConstructor(state->vm(), prototype->globalObject()));
314 }
315
316 bool setJSTestNamedSetterWithIndexedGetterAndSetterConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
317 {
318     VM& vm = state->vm();
319     auto throwScope = DECLARE_THROW_SCOPE(vm);
320     auto* prototype = jsDynamicDowncast<JSTestNamedSetterWithIndexedGetterAndSetterPrototype*>(vm, JSValue::decode(thisValue));
321     if (UNLIKELY(!prototype)) {
322         throwVMTypeError(state, throwScope);
323         return false;
324     }
325     // Shadowing a built-in constructor
326     return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue));
327 }
328
329 static inline JSC::EncodedJSValue jsTestNamedSetterWithIndexedGetterAndSetterPrototypeFunctionNamedSetterBody(JSC::ExecState* state, typename IDLOperation<JSTestNamedSetterWithIndexedGetterAndSetter>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
330 {
331     UNUSED_PARAM(state);
332     UNUSED_PARAM(throwScope);
333     auto& impl = castedThis->wrapped();
334     if (UNLIKELY(state->argumentCount() < 2))
335         return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
336     auto name = convert<IDLDOMString>(*state, state->uncheckedArgument(0));
337     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
338     auto value = convert<IDLDOMString>(*state, state->uncheckedArgument(1));
339     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
340     impl.namedSetter(WTFMove(name), WTFMove(value));
341     return JSValue::encode(jsUndefined());
342 }
343
344 EncodedJSValue JSC_HOST_CALL jsTestNamedSetterWithIndexedGetterAndSetterPrototypeFunctionNamedSetter(ExecState* state)
345 {
346     return IDLOperation<JSTestNamedSetterWithIndexedGetterAndSetter>::call<jsTestNamedSetterWithIndexedGetterAndSetterPrototypeFunctionNamedSetterBody>(*state, "namedSetter");
347 }
348
349 static inline JSC::EncodedJSValue jsTestNamedSetterWithIndexedGetterAndSetterPrototypeFunctionIndexedSetter1Body(JSC::ExecState* state, typename IDLOperation<JSTestNamedSetterWithIndexedGetterAndSetter>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
350 {
351     UNUSED_PARAM(state);
352     UNUSED_PARAM(throwScope);
353     auto& impl = castedThis->wrapped();
354     auto index = convert<IDLUnsignedLong>(*state, state->uncheckedArgument(0));
355     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
356     auto value = convert<IDLDOMString>(*state, state->uncheckedArgument(1));
357     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
358     impl.indexedSetter(WTFMove(index), WTFMove(value));
359     return JSValue::encode(jsUndefined());
360 }
361
362 static inline JSC::EncodedJSValue jsTestNamedSetterWithIndexedGetterAndSetterPrototypeFunctionIndexedSetter2Body(JSC::ExecState* state, typename IDLOperation<JSTestNamedSetterWithIndexedGetterAndSetter>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
363 {
364     UNUSED_PARAM(state);
365     UNUSED_PARAM(throwScope);
366     auto& impl = castedThis->wrapped();
367     auto index = convert<IDLUnsignedLong>(*state, state->uncheckedArgument(0));
368     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
369     return JSValue::encode(toJS<IDLDOMString>(*state, impl.indexedSetter(WTFMove(index))));
370 }
371
372 static inline JSC::EncodedJSValue jsTestNamedSetterWithIndexedGetterAndSetterPrototypeFunctionIndexedSetterOverloadDispatcher(JSC::ExecState* state, typename IDLOperation<JSTestNamedSetterWithIndexedGetterAndSetter>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
373 {
374     UNUSED_PARAM(state);
375     UNUSED_PARAM(throwScope);
376     VM& vm = state->vm();
377     UNUSED_PARAM(vm);
378     size_t argsCount = std::min<size_t>(2, state->argumentCount());
379     if (argsCount == 1) {
380         return jsTestNamedSetterWithIndexedGetterAndSetterPrototypeFunctionIndexedSetter2Body(state, castedThis, throwScope);
381     }
382     if (argsCount == 2) {
383         return jsTestNamedSetterWithIndexedGetterAndSetterPrototypeFunctionIndexedSetter1Body(state, castedThis, throwScope);
384     }
385     return argsCount < 1 ? throwVMError(state, throwScope, createNotEnoughArgumentsError(state)) : throwVMTypeError(state, throwScope);
386 }
387
388 EncodedJSValue JSC_HOST_CALL jsTestNamedSetterWithIndexedGetterAndSetterPrototypeFunctionIndexedSetter(ExecState* state)
389 {
390     return IDLOperation<JSTestNamedSetterWithIndexedGetterAndSetter>::call<jsTestNamedSetterWithIndexedGetterAndSetterPrototypeFunctionIndexedSetterOverloadDispatcher>(*state, "indexedSetter");
391 }
392
393 bool JSTestNamedSetterWithIndexedGetterAndSetterOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
394 {
395     UNUSED_PARAM(handle);
396     UNUSED_PARAM(visitor);
397     return false;
398 }
399
400 void JSTestNamedSetterWithIndexedGetterAndSetterOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
401 {
402     auto* jsTestNamedSetterWithIndexedGetterAndSetter = static_cast<JSTestNamedSetterWithIndexedGetterAndSetter*>(handle.slot()->asCell());
403     auto& world = *static_cast<DOMWrapperWorld*>(context);
404     uncacheWrapper(world, &jsTestNamedSetterWithIndexedGetterAndSetter->wrapped(), jsTestNamedSetterWithIndexedGetterAndSetter);
405 }
406
407 #if ENABLE(BINDING_INTEGRITY)
408 #if PLATFORM(WIN)
409 #pragma warning(disable: 4483)
410 extern "C" { extern void (*const __identifier("??_7TestNamedSetterWithIndexedGetterAndSetter@WebCore@@6B@")[])(); }
411 #else
412 extern "C" { extern void* _ZTVN7WebCore41TestNamedSetterWithIndexedGetterAndSetterE[]; }
413 #endif
414 #endif
415
416 JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<TestNamedSetterWithIndexedGetterAndSetter>&& impl)
417 {
418
419 #if ENABLE(BINDING_INTEGRITY)
420     void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
421 #if PLATFORM(WIN)
422     void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(__identifier("??_7TestNamedSetterWithIndexedGetterAndSetter@WebCore@@6B@"));
423 #else
424     void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(&_ZTVN7WebCore41TestNamedSetterWithIndexedGetterAndSetterE[2]);
425 #endif
426
427     // If this fails TestNamedSetterWithIndexedGetterAndSetter does not have a vtable, so you need to add the
428     // ImplementationLacksVTable attribute to the interface definition
429     static_assert(std::is_polymorphic<TestNamedSetterWithIndexedGetterAndSetter>::value, "TestNamedSetterWithIndexedGetterAndSetter is not polymorphic");
430
431     // If you hit this assertion you either have a use after free bug, or
432     // TestNamedSetterWithIndexedGetterAndSetter has subclasses. If TestNamedSetterWithIndexedGetterAndSetter has subclasses that get passed
433     // to toJS() we currently require TestNamedSetterWithIndexedGetterAndSetter you to opt out of binding hardening
434     // by adding the SkipVTableValidation attribute to the interface IDL definition
435     RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
436 #endif
437     return createWrapper<TestNamedSetterWithIndexedGetterAndSetter>(globalObject, WTFMove(impl));
438 }
439
440 JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestNamedSetterWithIndexedGetterAndSetter& impl)
441 {
442     return wrap(state, globalObject, impl);
443 }
444
445 TestNamedSetterWithIndexedGetterAndSetter* JSTestNamedSetterWithIndexedGetterAndSetter::toWrapped(JSC::VM& vm, JSC::JSValue value)
446 {
447     if (auto* wrapper = jsDynamicDowncast<JSTestNamedSetterWithIndexedGetterAndSetter*>(vm, value))
448         return &wrapper->wrapped();
449     return nullptr;
450 }
451
452 }