blob: 9c4e2e23b3228f1108c86dca6f8ddb8e624c3007 [file] [log] [blame]
weinig@apple.coma1c7e0e2020-09-14 22:30:09 +00001/*
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 "JSTestMapLikeWithOverriddenOperations.h"
23
24#include "ActiveDOMObject.h"
25#include "DOMIsoSubspaces.h"
26#include "JSDOMAttribute.h"
27#include "JSDOMBinding.h"
28#include "JSDOMConstructorNotConstructable.h"
29#include "JSDOMConvertAny.h"
30#include "JSDOMConvertNumbers.h"
31#include "JSDOMConvertStrings.h"
32#include "JSDOMExceptionHandling.h"
33#include "JSDOMMapLike.h"
34#include "JSDOMOperation.h"
35#include "JSDOMWrapperCache.h"
36#include "ScriptExecutionContext.h"
37#include "WebCoreJSClientData.h"
38#include <JavaScriptCore/BuiltinNames.h>
39#include <JavaScriptCore/FunctionPrototype.h>
40#include <JavaScriptCore/HeapAnalyzer.h>
41#include <JavaScriptCore/JSCInlines.h>
42#include <JavaScriptCore/JSDestructibleObjectHeapCellType.h>
mark.lam@apple.com17ae4902021-02-19 15:51:15 +000043#include <JavaScriptCore/SlotVisitorMacros.h>
weinig@apple.coma1c7e0e2020-09-14 22:30:09 +000044#include <JavaScriptCore/SubspaceInlines.h>
45#include <wtf/GetPtr.h>
46#include <wtf/PointerPreparations.h>
47#include <wtf/URL.h>
48
49
50namespace WebCore {
51using namespace JSC;
52
53// Functions
54
weinig@apple.com2b5979b2020-10-26 18:41:09 +000055static JSC_DECLARE_HOST_FUNCTION(jsTestMapLikeWithOverriddenOperationsPrototypeFunction_clear);
56static JSC_DECLARE_HOST_FUNCTION(jsTestMapLikeWithOverriddenOperationsPrototypeFunction_get);
57static JSC_DECLARE_HOST_FUNCTION(jsTestMapLikeWithOverriddenOperationsPrototypeFunction_has);
58static JSC_DECLARE_HOST_FUNCTION(jsTestMapLikeWithOverriddenOperationsPrototypeFunction_entries);
59static JSC_DECLARE_HOST_FUNCTION(jsTestMapLikeWithOverriddenOperationsPrototypeFunction_keys);
60static JSC_DECLARE_HOST_FUNCTION(jsTestMapLikeWithOverriddenOperationsPrototypeFunction_values);
61static JSC_DECLARE_HOST_FUNCTION(jsTestMapLikeWithOverriddenOperationsPrototypeFunction_forEach);
62static JSC_DECLARE_HOST_FUNCTION(jsTestMapLikeWithOverriddenOperationsPrototypeFunction_delete);
weinig@apple.coma1c7e0e2020-09-14 22:30:09 +000063
64// Attributes
65
weinig@apple.com2b5979b2020-10-26 18:41:09 +000066static JSC_DECLARE_CUSTOM_GETTER(jsTestMapLikeWithOverriddenOperationsConstructor);
67static JSC_DECLARE_CUSTOM_GETTER(jsTestMapLikeWithOverriddenOperations_set);
68static JSC_DECLARE_CUSTOM_SETTER(setJSTestMapLikeWithOverriddenOperations_set);
69static JSC_DECLARE_CUSTOM_GETTER(jsTestMapLikeWithOverriddenOperations_size);
weinig@apple.coma1c7e0e2020-09-14 22:30:09 +000070
71class JSTestMapLikeWithOverriddenOperationsPrototype final : public JSC::JSNonFinalObject {
72public:
73 using Base = JSC::JSNonFinalObject;
74 static JSTestMapLikeWithOverriddenOperationsPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
75 {
76 JSTestMapLikeWithOverriddenOperationsPrototype* ptr = new (NotNull, JSC::allocateCell<JSTestMapLikeWithOverriddenOperationsPrototype>(vm.heap)) JSTestMapLikeWithOverriddenOperationsPrototype(vm, globalObject, structure);
77 ptr->finishCreation(vm);
78 return ptr;
79 }
80
81 DECLARE_INFO;
82 template<typename CellType, JSC::SubspaceAccess>
83 static JSC::IsoSubspace* subspaceFor(JSC::VM& vm)
84 {
85 STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSTestMapLikeWithOverriddenOperationsPrototype, Base);
86 return &vm.plainObjectSpace;
87 }
88 static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
89 {
90 return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
91 }
92
93private:
94 JSTestMapLikeWithOverriddenOperationsPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
95 : JSC::JSNonFinalObject(vm, structure)
96 {
97 }
98
99 void finishCreation(JSC::VM&);
100};
101STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSTestMapLikeWithOverriddenOperationsPrototype, JSTestMapLikeWithOverriddenOperationsPrototype::Base);
102
cdumez@apple.com39fa66b2020-10-02 19:21:03 +0000103using JSTestMapLikeWithOverriddenOperationsDOMConstructor = JSDOMConstructorNotConstructable<JSTestMapLikeWithOverriddenOperations>;
weinig@apple.coma1c7e0e2020-09-14 22:30:09 +0000104
cdumez@apple.com39fa66b2020-10-02 19:21:03 +0000105template<> JSValue JSTestMapLikeWithOverriddenOperationsDOMConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
weinig@apple.coma1c7e0e2020-09-14 22:30:09 +0000106{
107 UNUSED_PARAM(vm);
108 return globalObject.functionPrototype();
109}
110
cdumez@apple.com39fa66b2020-10-02 19:21:03 +0000111template<> void JSTestMapLikeWithOverriddenOperationsDOMConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
weinig@apple.coma1c7e0e2020-09-14 22:30:09 +0000112{
113 putDirect(vm, vm.propertyNames->prototype, JSTestMapLikeWithOverriddenOperations::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
114 putDirect(vm, vm.propertyNames->name, jsNontrivialString(vm, "TestMapLikeWithOverriddenOperations"_s), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
115 putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
116}
117
cdumez@apple.com39fa66b2020-10-02 19:21:03 +0000118template<> const ClassInfo JSTestMapLikeWithOverriddenOperationsDOMConstructor::s_info = { "TestMapLikeWithOverriddenOperations", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestMapLikeWithOverriddenOperationsDOMConstructor) };
weinig@apple.coma1c7e0e2020-09-14 22:30:09 +0000119
120/* Hash table for prototype */
121
122static const HashTableValue JSTestMapLikeWithOverriddenOperationsPrototypeTableValues[] =
123{
shvaikalesh@gmail.comecaf3572020-10-20 02:49:07 +0000124 { "constructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestMapLikeWithOverriddenOperationsConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
weinig@apple.comea97c9f2020-10-15 20:40:34 +0000125 { "set", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestMapLikeWithOverriddenOperations_set), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestMapLikeWithOverriddenOperations_set) } },
126 { "size", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestMapLikeWithOverriddenOperations_size), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
127 { "clear", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestMapLikeWithOverriddenOperationsPrototypeFunction_clear), (intptr_t) (0) } },
128 { "get", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum | JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestMapLikeWithOverriddenOperationsPrototypeFunction_get), (intptr_t) (1) } },
129 { "has", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum | JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestMapLikeWithOverriddenOperationsPrototypeFunction_has), (intptr_t) (1) } },
130 { "entries", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum | JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestMapLikeWithOverriddenOperationsPrototypeFunction_entries), (intptr_t) (0) } },
131 { "keys", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum | JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestMapLikeWithOverriddenOperationsPrototypeFunction_keys), (intptr_t) (0) } },
132 { "values", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum | JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestMapLikeWithOverriddenOperationsPrototypeFunction_values), (intptr_t) (0) } },
133 { "forEach", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestMapLikeWithOverriddenOperationsPrototypeFunction_forEach), (intptr_t) (1) } },
134 { "delete", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum | JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestMapLikeWithOverriddenOperationsPrototypeFunction_delete), (intptr_t) (1) } },
weinig@apple.coma1c7e0e2020-09-14 22:30:09 +0000135};
136
137const ClassInfo JSTestMapLikeWithOverriddenOperationsPrototype::s_info = { "TestMapLikeWithOverriddenOperations", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestMapLikeWithOverriddenOperationsPrototype) };
138
139void JSTestMapLikeWithOverriddenOperationsPrototype::finishCreation(VM& vm)
140{
141 Base::finishCreation(vm);
142 reifyStaticProperties(vm, JSTestMapLikeWithOverriddenOperations::info(), JSTestMapLikeWithOverriddenOperationsPrototypeTableValues, *this);
143 putDirect(vm, vm.propertyNames->iteratorSymbol, getDirect(vm, vm.propertyNames->builtinNames().entriesPublicName()), static_cast<unsigned>(JSC::PropertyAttribute::DontEnum));
144 JSC_TO_STRING_TAG_WITHOUT_TRANSITION();
145}
146
147const ClassInfo JSTestMapLikeWithOverriddenOperations::s_info = { "TestMapLikeWithOverriddenOperations", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestMapLikeWithOverriddenOperations) };
148
149JSTestMapLikeWithOverriddenOperations::JSTestMapLikeWithOverriddenOperations(Structure* structure, JSDOMGlobalObject& globalObject, Ref<TestMapLikeWithOverriddenOperations>&& impl)
150 : JSDOMWrapper<TestMapLikeWithOverriddenOperations>(structure, globalObject, WTFMove(impl))
151{
152}
153
154void JSTestMapLikeWithOverriddenOperations::finishCreation(VM& vm)
155{
156 Base::finishCreation(vm);
157 ASSERT(inherits(vm, info()));
158
159 static_assert(!std::is_base_of<ActiveDOMObject, TestMapLikeWithOverriddenOperations>::value, "Interface is not marked as [ActiveDOMObject] even though implementation class subclasses ActiveDOMObject.");
160
161}
162
163JSObject* JSTestMapLikeWithOverriddenOperations::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
164{
165 return JSTestMapLikeWithOverriddenOperationsPrototype::create(vm, &globalObject, JSTestMapLikeWithOverriddenOperationsPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()));
166}
167
168JSObject* JSTestMapLikeWithOverriddenOperations::prototype(VM& vm, JSDOMGlobalObject& globalObject)
169{
170 return getDOMPrototype<JSTestMapLikeWithOverriddenOperations>(vm, globalObject);
171}
172
173JSValue JSTestMapLikeWithOverriddenOperations::getConstructor(VM& vm, const JSGlobalObject* globalObject)
174{
cdumez@apple.com39fa66b2020-10-02 19:21:03 +0000175 return getDOMConstructor<JSTestMapLikeWithOverriddenOperationsDOMConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
weinig@apple.coma1c7e0e2020-09-14 22:30:09 +0000176}
177
178void JSTestMapLikeWithOverriddenOperations::destroy(JSC::JSCell* cell)
179{
180 JSTestMapLikeWithOverriddenOperations* thisObject = static_cast<JSTestMapLikeWithOverriddenOperations*>(cell);
181 thisObject->JSTestMapLikeWithOverriddenOperations::~JSTestMapLikeWithOverriddenOperations();
182}
183
184template<> inline JSTestMapLikeWithOverriddenOperations* IDLAttribute<JSTestMapLikeWithOverriddenOperations>::cast(JSGlobalObject& lexicalGlobalObject, EncodedJSValue thisValue)
185{
186 return jsDynamicCast<JSTestMapLikeWithOverriddenOperations*>(JSC::getVM(&lexicalGlobalObject), JSValue::decode(thisValue));
187}
188
189template<> inline JSTestMapLikeWithOverriddenOperations* IDLOperation<JSTestMapLikeWithOverriddenOperations>::cast(JSGlobalObject& lexicalGlobalObject, CallFrame& callFrame)
190{
191 return jsDynamicCast<JSTestMapLikeWithOverriddenOperations*>(JSC::getVM(&lexicalGlobalObject), callFrame.thisValue());
192}
193
ysuzuki@apple.comf4d958e2020-09-29 05:51:12 +0000194JSC_DEFINE_CUSTOM_GETTER(jsTestMapLikeWithOverriddenOperationsConstructor, (JSGlobalObject* lexicalGlobalObject, EncodedJSValue thisValue, PropertyName))
weinig@apple.coma1c7e0e2020-09-14 22:30:09 +0000195{
196 VM& vm = JSC::getVM(lexicalGlobalObject);
197 auto throwScope = DECLARE_THROW_SCOPE(vm);
198 auto* prototype = jsDynamicCast<JSTestMapLikeWithOverriddenOperationsPrototype*>(vm, JSValue::decode(thisValue));
199 if (UNLIKELY(!prototype))
200 return throwVMTypeError(lexicalGlobalObject, throwScope);
201 return JSValue::encode(JSTestMapLikeWithOverriddenOperations::getConstructor(JSC::getVM(lexicalGlobalObject), prototype->globalObject()));
202}
203
weinig@apple.comea97c9f2020-10-15 20:40:34 +0000204static inline JSValue jsTestMapLikeWithOverriddenOperations_setGetter(JSGlobalObject& lexicalGlobalObject, JSTestMapLikeWithOverriddenOperations& thisObject)
weinig@apple.coma1c7e0e2020-09-14 22:30:09 +0000205{
206 auto& vm = JSC::getVM(&lexicalGlobalObject);
207 auto throwScope = DECLARE_THROW_SCOPE(vm);
208 auto& impl = thisObject.wrapped();
209 RELEASE_AND_RETURN(throwScope, (toJS<IDLLong>(lexicalGlobalObject, throwScope, impl.set())));
210}
211
weinig@apple.comea97c9f2020-10-15 20:40:34 +0000212JSC_DEFINE_CUSTOM_GETTER(jsTestMapLikeWithOverriddenOperations_set, (JSGlobalObject* lexicalGlobalObject, EncodedJSValue thisValue, PropertyName))
weinig@apple.coma1c7e0e2020-09-14 22:30:09 +0000213{
weinig@apple.comea97c9f2020-10-15 20:40:34 +0000214 return IDLAttribute<JSTestMapLikeWithOverriddenOperations>::get<jsTestMapLikeWithOverriddenOperations_setGetter, CastedThisErrorBehavior::Assert>(*lexicalGlobalObject, thisValue, "set");
weinig@apple.coma1c7e0e2020-09-14 22:30:09 +0000215}
216
weinig@apple.comea97c9f2020-10-15 20:40:34 +0000217static inline bool setJSTestMapLikeWithOverriddenOperations_setSetter(JSGlobalObject& lexicalGlobalObject, JSTestMapLikeWithOverriddenOperations& thisObject, JSValue value)
weinig@apple.coma1c7e0e2020-09-14 22:30:09 +0000218{
219 auto& vm = JSC::getVM(&lexicalGlobalObject);
220 auto throwScope = DECLARE_THROW_SCOPE(vm);
221 auto& impl = thisObject.wrapped();
222 auto nativeValue = convert<IDLLong>(lexicalGlobalObject, value);
223 RETURN_IF_EXCEPTION(throwScope, false);
224 AttributeSetter::call(lexicalGlobalObject, throwScope, [&] {
225 return impl.setSet(WTFMove(nativeValue));
226 });
227 return true;
228}
229
weinig@apple.comea97c9f2020-10-15 20:40:34 +0000230JSC_DEFINE_CUSTOM_SETTER(setJSTestMapLikeWithOverriddenOperations_set, (JSGlobalObject* lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue))
weinig@apple.coma1c7e0e2020-09-14 22:30:09 +0000231{
weinig@apple.comea97c9f2020-10-15 20:40:34 +0000232 return IDLAttribute<JSTestMapLikeWithOverriddenOperations>::set<setJSTestMapLikeWithOverriddenOperations_setSetter>(*lexicalGlobalObject, thisValue, encodedValue, "set");
weinig@apple.coma1c7e0e2020-09-14 22:30:09 +0000233}
234
weinig@apple.comea97c9f2020-10-15 20:40:34 +0000235static inline JSValue jsTestMapLikeWithOverriddenOperations_sizeGetter(JSGlobalObject& lexicalGlobalObject, JSTestMapLikeWithOverriddenOperations& thisObject)
weinig@apple.coma1c7e0e2020-09-14 22:30:09 +0000236{
237 auto& vm = JSC::getVM(&lexicalGlobalObject);
238 auto throwScope = DECLARE_THROW_SCOPE(vm);
239 RELEASE_AND_RETURN(throwScope, (toJS<IDLAny>(lexicalGlobalObject, throwScope, forwardSizeToMapLike(lexicalGlobalObject, thisObject))));
240}
241
weinig@apple.comea97c9f2020-10-15 20:40:34 +0000242JSC_DEFINE_CUSTOM_GETTER(jsTestMapLikeWithOverriddenOperations_size, (JSGlobalObject* lexicalGlobalObject, EncodedJSValue thisValue, PropertyName))
weinig@apple.coma1c7e0e2020-09-14 22:30:09 +0000243{
weinig@apple.comea97c9f2020-10-15 20:40:34 +0000244 return IDLAttribute<JSTestMapLikeWithOverriddenOperations>::get<jsTestMapLikeWithOverriddenOperations_sizeGetter>(*lexicalGlobalObject, thisValue, "size");
weinig@apple.coma1c7e0e2020-09-14 22:30:09 +0000245}
246
weinig@apple.comea97c9f2020-10-15 20:40:34 +0000247static inline JSC::EncodedJSValue jsTestMapLikeWithOverriddenOperationsPrototypeFunction_clearBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSTestMapLikeWithOverriddenOperations>::ClassParameter castedThis)
weinig@apple.coma1c7e0e2020-09-14 22:30:09 +0000248{
249 auto& vm = JSC::getVM(lexicalGlobalObject);
250 auto throwScope = DECLARE_THROW_SCOPE(vm);
251 UNUSED_PARAM(throwScope);
252 UNUSED_PARAM(callFrame);
253 auto& impl = castedThis->wrapped();
254 throwScope.release();
255 impl.clear();
256 return JSValue::encode(jsUndefined());
257}
258
weinig@apple.comea97c9f2020-10-15 20:40:34 +0000259JSC_DEFINE_HOST_FUNCTION(jsTestMapLikeWithOverriddenOperationsPrototypeFunction_clear, (JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame))
weinig@apple.coma1c7e0e2020-09-14 22:30:09 +0000260{
weinig@apple.comea97c9f2020-10-15 20:40:34 +0000261 return IDLOperation<JSTestMapLikeWithOverriddenOperations>::call<jsTestMapLikeWithOverriddenOperationsPrototypeFunction_clearBody>(*lexicalGlobalObject, *callFrame, "clear");
weinig@apple.coma1c7e0e2020-09-14 22:30:09 +0000262}
263
weinig@apple.comea97c9f2020-10-15 20:40:34 +0000264static inline JSC::EncodedJSValue jsTestMapLikeWithOverriddenOperationsPrototypeFunction_getBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSTestMapLikeWithOverriddenOperations>::ClassParameter castedThis)
weinig@apple.coma1c7e0e2020-09-14 22:30:09 +0000265{
266 auto& vm = JSC::getVM(lexicalGlobalObject);
267 auto throwScope = DECLARE_THROW_SCOPE(vm);
268 UNUSED_PARAM(throwScope);
269 UNUSED_PARAM(callFrame);
270 if (UNLIKELY(callFrame->argumentCount() < 1))
271 return throwVMError(lexicalGlobalObject, throwScope, createNotEnoughArgumentsError(lexicalGlobalObject));
272 EnsureStillAliveScope argument0 = callFrame->uncheckedArgument(0);
273 auto key = convert<IDLDOMString>(*lexicalGlobalObject, argument0.value());
274 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
275 RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLAny>(forwardGetToMapLike(*lexicalGlobalObject, *callFrame, *castedThis, WTFMove(key)))));
276}
277
weinig@apple.comea97c9f2020-10-15 20:40:34 +0000278JSC_DEFINE_HOST_FUNCTION(jsTestMapLikeWithOverriddenOperationsPrototypeFunction_get, (JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame))
weinig@apple.coma1c7e0e2020-09-14 22:30:09 +0000279{
weinig@apple.comea97c9f2020-10-15 20:40:34 +0000280 return IDLOperation<JSTestMapLikeWithOverriddenOperations>::call<jsTestMapLikeWithOverriddenOperationsPrototypeFunction_getBody>(*lexicalGlobalObject, *callFrame, "get");
weinig@apple.coma1c7e0e2020-09-14 22:30:09 +0000281}
282
weinig@apple.comea97c9f2020-10-15 20:40:34 +0000283static inline JSC::EncodedJSValue jsTestMapLikeWithOverriddenOperationsPrototypeFunction_hasBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSTestMapLikeWithOverriddenOperations>::ClassParameter castedThis)
weinig@apple.coma1c7e0e2020-09-14 22:30:09 +0000284{
285 auto& vm = JSC::getVM(lexicalGlobalObject);
286 auto throwScope = DECLARE_THROW_SCOPE(vm);
287 UNUSED_PARAM(throwScope);
288 UNUSED_PARAM(callFrame);
289 if (UNLIKELY(callFrame->argumentCount() < 1))
290 return throwVMError(lexicalGlobalObject, throwScope, createNotEnoughArgumentsError(lexicalGlobalObject));
291 EnsureStillAliveScope argument0 = callFrame->uncheckedArgument(0);
292 auto key = convert<IDLDOMString>(*lexicalGlobalObject, argument0.value());
293 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
294 RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLAny>(forwardHasToMapLike(*lexicalGlobalObject, *callFrame, *castedThis, WTFMove(key)))));
295}
296
weinig@apple.comea97c9f2020-10-15 20:40:34 +0000297JSC_DEFINE_HOST_FUNCTION(jsTestMapLikeWithOverriddenOperationsPrototypeFunction_has, (JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame))
weinig@apple.coma1c7e0e2020-09-14 22:30:09 +0000298{
weinig@apple.comea97c9f2020-10-15 20:40:34 +0000299 return IDLOperation<JSTestMapLikeWithOverriddenOperations>::call<jsTestMapLikeWithOverriddenOperationsPrototypeFunction_hasBody>(*lexicalGlobalObject, *callFrame, "has");
weinig@apple.coma1c7e0e2020-09-14 22:30:09 +0000300}
301
weinig@apple.comea97c9f2020-10-15 20:40:34 +0000302static inline JSC::EncodedJSValue jsTestMapLikeWithOverriddenOperationsPrototypeFunction_entriesBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSTestMapLikeWithOverriddenOperations>::ClassParameter castedThis)
weinig@apple.coma1c7e0e2020-09-14 22:30:09 +0000303{
304 auto& vm = JSC::getVM(lexicalGlobalObject);
305 auto throwScope = DECLARE_THROW_SCOPE(vm);
306 UNUSED_PARAM(throwScope);
307 UNUSED_PARAM(callFrame);
308 RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLAny>(forwardEntriesToMapLike(*lexicalGlobalObject, *callFrame, *castedThis))));
309}
310
weinig@apple.comea97c9f2020-10-15 20:40:34 +0000311JSC_DEFINE_HOST_FUNCTION(jsTestMapLikeWithOverriddenOperationsPrototypeFunction_entries, (JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame))
weinig@apple.coma1c7e0e2020-09-14 22:30:09 +0000312{
weinig@apple.comea97c9f2020-10-15 20:40:34 +0000313 return IDLOperation<JSTestMapLikeWithOverriddenOperations>::call<jsTestMapLikeWithOverriddenOperationsPrototypeFunction_entriesBody>(*lexicalGlobalObject, *callFrame, "entries");
weinig@apple.coma1c7e0e2020-09-14 22:30:09 +0000314}
315
weinig@apple.comea97c9f2020-10-15 20:40:34 +0000316static inline JSC::EncodedJSValue jsTestMapLikeWithOverriddenOperationsPrototypeFunction_keysBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSTestMapLikeWithOverriddenOperations>::ClassParameter castedThis)
weinig@apple.coma1c7e0e2020-09-14 22:30:09 +0000317{
318 auto& vm = JSC::getVM(lexicalGlobalObject);
319 auto throwScope = DECLARE_THROW_SCOPE(vm);
320 UNUSED_PARAM(throwScope);
321 UNUSED_PARAM(callFrame);
322 RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLAny>(forwardKeysToMapLike(*lexicalGlobalObject, *callFrame, *castedThis))));
323}
324
weinig@apple.comea97c9f2020-10-15 20:40:34 +0000325JSC_DEFINE_HOST_FUNCTION(jsTestMapLikeWithOverriddenOperationsPrototypeFunction_keys, (JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame))
weinig@apple.coma1c7e0e2020-09-14 22:30:09 +0000326{
weinig@apple.comea97c9f2020-10-15 20:40:34 +0000327 return IDLOperation<JSTestMapLikeWithOverriddenOperations>::call<jsTestMapLikeWithOverriddenOperationsPrototypeFunction_keysBody>(*lexicalGlobalObject, *callFrame, "keys");
weinig@apple.coma1c7e0e2020-09-14 22:30:09 +0000328}
329
weinig@apple.comea97c9f2020-10-15 20:40:34 +0000330static inline JSC::EncodedJSValue jsTestMapLikeWithOverriddenOperationsPrototypeFunction_valuesBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSTestMapLikeWithOverriddenOperations>::ClassParameter castedThis)
weinig@apple.coma1c7e0e2020-09-14 22:30:09 +0000331{
332 auto& vm = JSC::getVM(lexicalGlobalObject);
333 auto throwScope = DECLARE_THROW_SCOPE(vm);
334 UNUSED_PARAM(throwScope);
335 UNUSED_PARAM(callFrame);
336 RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLAny>(forwardValuesToMapLike(*lexicalGlobalObject, *callFrame, *castedThis))));
337}
338
weinig@apple.comea97c9f2020-10-15 20:40:34 +0000339JSC_DEFINE_HOST_FUNCTION(jsTestMapLikeWithOverriddenOperationsPrototypeFunction_values, (JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame))
weinig@apple.coma1c7e0e2020-09-14 22:30:09 +0000340{
weinig@apple.comea97c9f2020-10-15 20:40:34 +0000341 return IDLOperation<JSTestMapLikeWithOverriddenOperations>::call<jsTestMapLikeWithOverriddenOperationsPrototypeFunction_valuesBody>(*lexicalGlobalObject, *callFrame, "values");
weinig@apple.coma1c7e0e2020-09-14 22:30:09 +0000342}
343
weinig@apple.comea97c9f2020-10-15 20:40:34 +0000344static inline JSC::EncodedJSValue jsTestMapLikeWithOverriddenOperationsPrototypeFunction_forEachBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSTestMapLikeWithOverriddenOperations>::ClassParameter castedThis)
weinig@apple.coma1c7e0e2020-09-14 22:30:09 +0000345{
346 auto& vm = JSC::getVM(lexicalGlobalObject);
347 auto throwScope = DECLARE_THROW_SCOPE(vm);
348 UNUSED_PARAM(throwScope);
349 UNUSED_PARAM(callFrame);
350 if (UNLIKELY(callFrame->argumentCount() < 1))
351 return throwVMError(lexicalGlobalObject, throwScope, createNotEnoughArgumentsError(lexicalGlobalObject));
352 EnsureStillAliveScope argument0 = callFrame->uncheckedArgument(0);
353 auto callback = convert<IDLAny>(*lexicalGlobalObject, argument0.value());
354 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
355 RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLAny>(forwardForEachToMapLike(*lexicalGlobalObject, *callFrame, *castedThis, WTFMove(callback)))));
356}
357
weinig@apple.comea97c9f2020-10-15 20:40:34 +0000358JSC_DEFINE_HOST_FUNCTION(jsTestMapLikeWithOverriddenOperationsPrototypeFunction_forEach, (JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame))
weinig@apple.coma1c7e0e2020-09-14 22:30:09 +0000359{
weinig@apple.comea97c9f2020-10-15 20:40:34 +0000360 return IDLOperation<JSTestMapLikeWithOverriddenOperations>::call<jsTestMapLikeWithOverriddenOperationsPrototypeFunction_forEachBody>(*lexicalGlobalObject, *callFrame, "forEach");
weinig@apple.coma1c7e0e2020-09-14 22:30:09 +0000361}
362
weinig@apple.comea97c9f2020-10-15 20:40:34 +0000363static inline JSC::EncodedJSValue jsTestMapLikeWithOverriddenOperationsPrototypeFunction_deleteBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSTestMapLikeWithOverriddenOperations>::ClassParameter castedThis)
weinig@apple.coma1c7e0e2020-09-14 22:30:09 +0000364{
365 auto& vm = JSC::getVM(lexicalGlobalObject);
366 auto throwScope = DECLARE_THROW_SCOPE(vm);
367 UNUSED_PARAM(throwScope);
368 UNUSED_PARAM(callFrame);
369 if (UNLIKELY(callFrame->argumentCount() < 1))
370 return throwVMError(lexicalGlobalObject, throwScope, createNotEnoughArgumentsError(lexicalGlobalObject));
371 EnsureStillAliveScope argument0 = callFrame->uncheckedArgument(0);
372 auto key = convert<IDLDOMString>(*lexicalGlobalObject, argument0.value());
373 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
374 RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLAny>(forwardDeleteToMapLike(*lexicalGlobalObject, *callFrame, *castedThis, WTFMove(key)))));
375}
376
weinig@apple.comea97c9f2020-10-15 20:40:34 +0000377JSC_DEFINE_HOST_FUNCTION(jsTestMapLikeWithOverriddenOperationsPrototypeFunction_delete, (JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame))
weinig@apple.coma1c7e0e2020-09-14 22:30:09 +0000378{
weinig@apple.comea97c9f2020-10-15 20:40:34 +0000379 return IDLOperation<JSTestMapLikeWithOverriddenOperations>::call<jsTestMapLikeWithOverriddenOperationsPrototypeFunction_deleteBody>(*lexicalGlobalObject, *callFrame, "delete");
weinig@apple.coma1c7e0e2020-09-14 22:30:09 +0000380}
381
382JSC::IsoSubspace* JSTestMapLikeWithOverriddenOperations::subspaceForImpl(JSC::VM& vm)
383{
384 auto& clientData = *static_cast<JSVMClientData*>(vm.clientData);
385 auto& spaces = clientData.subspaces();
386 if (auto* space = spaces.m_subspaceForTestMapLikeWithOverriddenOperations.get())
387 return space;
388 static_assert(std::is_base_of_v<JSC::JSDestructibleObject, JSTestMapLikeWithOverriddenOperations> || !JSTestMapLikeWithOverriddenOperations::needsDestruction);
389 if constexpr (std::is_base_of_v<JSC::JSDestructibleObject, JSTestMapLikeWithOverriddenOperations>)
390 spaces.m_subspaceForTestMapLikeWithOverriddenOperations = makeUnique<IsoSubspace> ISO_SUBSPACE_INIT(vm.heap, vm.destructibleObjectHeapCellType.get(), JSTestMapLikeWithOverriddenOperations);
391 else
392 spaces.m_subspaceForTestMapLikeWithOverriddenOperations = makeUnique<IsoSubspace> ISO_SUBSPACE_INIT(vm.heap, vm.cellHeapCellType.get(), JSTestMapLikeWithOverriddenOperations);
393 auto* space = spaces.m_subspaceForTestMapLikeWithOverriddenOperations.get();
394IGNORE_WARNINGS_BEGIN("unreachable-code")
395IGNORE_WARNINGS_BEGIN("tautological-compare")
mark.lam@apple.com17ae4902021-02-19 15:51:15 +0000396 void (*myVisitOutputConstraint)(JSC::JSCell*, JSC::SlotVisitor&) = JSTestMapLikeWithOverriddenOperations::visitOutputConstraints;
397 void (*jsCellVisitOutputConstraint)(JSC::JSCell*, JSC::SlotVisitor&) = JSC::JSCell::visitOutputConstraints;
398 if (myVisitOutputConstraint != jsCellVisitOutputConstraint)
weinig@apple.coma1c7e0e2020-09-14 22:30:09 +0000399 clientData.outputConstraintSpaces().append(space);
400IGNORE_WARNINGS_END
401IGNORE_WARNINGS_END
402 return space;
403}
404
405void JSTestMapLikeWithOverriddenOperations::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer)
406{
407 auto* thisObject = jsCast<JSTestMapLikeWithOverriddenOperations*>(cell);
408 analyzer.setWrappedObjectForCell(cell, &thisObject->wrapped());
409 if (thisObject->scriptExecutionContext())
410 analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string());
411 Base::analyzeHeap(cell, analyzer);
412}
413
mark.lam@apple.com17ae4902021-02-19 15:51:15 +0000414bool JSTestMapLikeWithOverriddenOperationsOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, AbstractSlotVisitor& visitor, const char** reason)
weinig@apple.coma1c7e0e2020-09-14 22:30:09 +0000415{
416 UNUSED_PARAM(handle);
417 UNUSED_PARAM(visitor);
418 UNUSED_PARAM(reason);
419 return false;
420}
421
422void JSTestMapLikeWithOverriddenOperationsOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
423{
424 auto* jsTestMapLikeWithOverriddenOperations = static_cast<JSTestMapLikeWithOverriddenOperations*>(handle.slot()->asCell());
425 auto& world = *static_cast<DOMWrapperWorld*>(context);
426 uncacheWrapper(world, &jsTestMapLikeWithOverriddenOperations->wrapped(), jsTestMapLikeWithOverriddenOperations);
427}
428
429#if ENABLE(BINDING_INTEGRITY)
430#if PLATFORM(WIN)
431#pragma warning(disable: 4483)
432extern "C" { extern void (*const __identifier("??_7TestMapLikeWithOverriddenOperations@WebCore@@6B@")[])(); }
433#else
434extern "C" { extern void* _ZTVN7WebCore35TestMapLikeWithOverriddenOperationsE[]; }
435#endif
436#endif
437
438JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject*, JSDOMGlobalObject* globalObject, Ref<TestMapLikeWithOverriddenOperations>&& impl)
439{
440
441#if ENABLE(BINDING_INTEGRITY)
442 const void* actualVTablePointer = getVTablePointer(impl.ptr());
443#if PLATFORM(WIN)
444 void* expectedVTablePointer = __identifier("??_7TestMapLikeWithOverriddenOperations@WebCore@@6B@");
445#else
446 void* expectedVTablePointer = &_ZTVN7WebCore35TestMapLikeWithOverriddenOperationsE[2];
447#endif
448
449 // If this fails TestMapLikeWithOverriddenOperations does not have a vtable, so you need to add the
450 // ImplementationLacksVTable attribute to the interface definition
451 static_assert(std::is_polymorphic<TestMapLikeWithOverriddenOperations>::value, "TestMapLikeWithOverriddenOperations is not polymorphic");
452
453 // If you hit this assertion you either have a use after free bug, or
454 // TestMapLikeWithOverriddenOperations has subclasses. If TestMapLikeWithOverriddenOperations has subclasses that get passed
455 // to toJS() we currently require TestMapLikeWithOverriddenOperations you to opt out of binding hardening
456 // by adding the SkipVTableValidation attribute to the interface IDL definition
457 RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
458#endif
459 return createWrapper<TestMapLikeWithOverriddenOperations>(globalObject, WTFMove(impl));
460}
461
462JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, TestMapLikeWithOverriddenOperations& impl)
463{
464 return wrap(lexicalGlobalObject, globalObject, impl);
465}
466
467TestMapLikeWithOverriddenOperations* JSTestMapLikeWithOverriddenOperations::toWrapped(JSC::VM& vm, JSC::JSValue value)
468{
469 if (auto* wrapper = jsDynamicCast<JSTestMapLikeWithOverriddenOperations*>(vm, value))
470 return &wrapper->wrapped();
471 return nullptr;
472}
473
474}