namespace WebCore {
+// Functions
+
+JSC::EncodedJSValue JSC_HOST_CALL jsTestCustomNamedGetterPrototypeFunctionAnotherFunction(JSC::ExecState*);
+
+// Attributes
+
+JSC::EncodedJSValue jsTestCustomNamedGetterConstructor(JSC::ExecState*, JSC::JSObject*, JSC::EncodedJSValue, JSC::PropertyName);
+
+class JSTestCustomNamedGetterPrototype : public JSC::JSNonFinalObject {
+public:
+ typedef JSC::JSNonFinalObject Base;
+ static JSTestCustomNamedGetterPrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure)
+ {
+ JSTestCustomNamedGetterPrototype* ptr = new (NotNull, JSC::allocateCell<JSTestCustomNamedGetterPrototype>(vm.heap)) JSTestCustomNamedGetterPrototype(vm, globalObject, structure);
+ ptr->finishCreation(vm);
+ return ptr;
+ }
+
+ DECLARE_INFO;
+ static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
+ {
+ return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
+ }
+
+private:
+ JSTestCustomNamedGetterPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
+ : JSC::JSNonFinalObject(vm, structure)
+ {
+ }
+
+ void finishCreation(JSC::VM&);
+};
+
+class JSTestCustomNamedGetterConstructor : public DOMConstructorObject {
+private:
+ JSTestCustomNamedGetterConstructor(JSC::Structure*, JSDOMGlobalObject*);
+ void finishCreation(JSC::VM&, JSDOMGlobalObject*);
+
+public:
+ typedef DOMConstructorObject Base;
+ static JSTestCustomNamedGetterConstructor* create(JSC::VM& vm, JSC::Structure* structure, JSDOMGlobalObject* globalObject)
+ {
+ JSTestCustomNamedGetterConstructor* ptr = new (NotNull, JSC::allocateCell<JSTestCustomNamedGetterConstructor>(vm.heap)) JSTestCustomNamedGetterConstructor(structure, globalObject);
+ ptr->finishCreation(vm, globalObject);
+ return ptr;
+ }
+
+ DECLARE_INFO;
+ static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
+ {
+ return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
+ }
+};
+
/* Hash table */
-static const HashTableValue JSTestCustomNamedGetterTableValues[] =
-{
- { "constructor", DontEnum | ReadOnly, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestCustomNamedGetterConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) },
- { 0, 0, NoIntrinsic, 0, 0 }
+static const struct CompactHashIndex JSTestCustomNamedGetterTableIndex[2] = {
+ { -1, -1 },
+ { 0, -1 },
};
-static const HashTable JSTestCustomNamedGetterTable = { 2, 1, true, JSTestCustomNamedGetterTableValues, 0 };
-/* Hash table for constructor */
-static const HashTableValue JSTestCustomNamedGetterConstructorTableValues[] =
+static const HashTableValue JSTestCustomNamedGetterTableValues[] =
{
- { 0, 0, NoIntrinsic, 0, 0 }
+ { "constructor", DontEnum | ReadOnly, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestCustomNamedGetterConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) },
};
-static const HashTable JSTestCustomNamedGetterConstructorTable = { 1, 0, false, JSTestCustomNamedGetterConstructorTableValues, 0 };
-const ClassInfo JSTestCustomNamedGetterConstructor::s_info = { "TestCustomNamedGetterConstructor", &Base::s_info, &JSTestCustomNamedGetterConstructorTable, 0, CREATE_METHOD_TABLE(JSTestCustomNamedGetterConstructor) };
+static const HashTable JSTestCustomNamedGetterTable = { 1, 1, true, JSTestCustomNamedGetterTableValues, 0, JSTestCustomNamedGetterTableIndex };
+const ClassInfo JSTestCustomNamedGetterConstructor::s_info = { "TestCustomNamedGetterConstructor", &Base::s_info, 0, CREATE_METHOD_TABLE(JSTestCustomNamedGetterConstructor) };
JSTestCustomNamedGetterConstructor::JSTestCustomNamedGetterConstructor(Structure* structure, JSDOMGlobalObject* globalObject)
: DOMConstructorObject(structure, globalObject)
{
Base::finishCreation(vm);
ASSERT(inherits(info()));
- putDirect(vm, vm.propertyNames->prototype, JSTestCustomNamedGetterPrototype::self(vm, globalObject), DontDelete | ReadOnly);
+ putDirect(vm, vm.propertyNames->prototype, JSTestCustomNamedGetter::getPrototype(vm, globalObject), DontDelete | ReadOnly);
putDirect(vm, vm.propertyNames->length, jsNumber(0), ReadOnly | DontDelete | DontEnum);
}
-bool JSTestCustomNamedGetterConstructor::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)
-{
- return getStaticValueSlot<JSTestCustomNamedGetterConstructor, JSDOMWrapper>(exec, JSTestCustomNamedGetterConstructorTable, jsCast<JSTestCustomNamedGetterConstructor*>(object), propertyName, slot);
-}
-
/* Hash table for prototype */
static const HashTableValue JSTestCustomNamedGetterPrototypeTableValues[] =
{
{ "anotherFunction", JSC::Function, NoIntrinsic, (intptr_t)static_cast<NativeFunction>(jsTestCustomNamedGetterPrototypeFunctionAnotherFunction), (intptr_t) (1) },
- { 0, 0, NoIntrinsic, 0, 0 }
};
-static const HashTable JSTestCustomNamedGetterPrototypeTable = { 2, 1, false, JSTestCustomNamedGetterPrototypeTableValues, 0 };
-const ClassInfo JSTestCustomNamedGetterPrototype::s_info = { "TestCustomNamedGetterPrototype", &Base::s_info, &JSTestCustomNamedGetterPrototypeTable, 0, CREATE_METHOD_TABLE(JSTestCustomNamedGetterPrototype) };
-
-JSObject* JSTestCustomNamedGetterPrototype::self(VM& vm, JSGlobalObject* globalObject)
-{
- return getDOMPrototype<JSTestCustomNamedGetter>(vm, globalObject);
-}
+WEBCORE_EXPORT const ClassInfo JSTestCustomNamedGetterPrototype::s_info = { "TestCustomNamedGetterPrototype", &Base::s_info, 0, CREATE_METHOD_TABLE(JSTestCustomNamedGetterPrototype) };
-bool JSTestCustomNamedGetterPrototype::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)
+void JSTestCustomNamedGetterPrototype::finishCreation(VM& vm)
{
- JSTestCustomNamedGetterPrototype* thisObject = jsCast<JSTestCustomNamedGetterPrototype*>(object);
- return getStaticFunctionSlot<JSObject>(exec, JSTestCustomNamedGetterPrototypeTable, thisObject, propertyName, slot);
+ Base::finishCreation(vm);
+ reifyStaticProperties(vm, JSTestCustomNamedGetterPrototypeTableValues, *this);
}
-const ClassInfo JSTestCustomNamedGetter::s_info = { "TestCustomNamedGetter", &Base::s_info, &JSTestCustomNamedGetterTable, 0 , CREATE_METHOD_TABLE(JSTestCustomNamedGetter) };
+WEBCORE_EXPORT const ClassInfo JSTestCustomNamedGetter::s_info = { "TestCustomNamedGetter", &Base::s_info, &JSTestCustomNamedGetterTable, CREATE_METHOD_TABLE(JSTestCustomNamedGetter) };
JSTestCustomNamedGetter::JSTestCustomNamedGetter(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<TestCustomNamedGetter> impl)
: JSDOMWrapper(structure, globalObject)
{
}
-void JSTestCustomNamedGetter::finishCreation(VM& vm)
+JSObject* JSTestCustomNamedGetter::createPrototype(VM& vm, JSGlobalObject* globalObject)
{
- Base::finishCreation(vm);
- ASSERT(inherits(info()));
+ return JSTestCustomNamedGetterPrototype::create(vm, globalObject, JSTestCustomNamedGetterPrototype::createStructure(vm, globalObject, globalObject->objectPrototype()));
}
-JSObject* JSTestCustomNamedGetter::createPrototype(VM& vm, JSGlobalObject* globalObject)
+JSObject* JSTestCustomNamedGetter::getPrototype(VM& vm, JSGlobalObject* globalObject)
{
- return JSTestCustomNamedGetterPrototype::create(vm, globalObject, JSTestCustomNamedGetterPrototype::createStructure(vm, globalObject, globalObject->objectPrototype()));
+ return getDOMPrototype<JSTestCustomNamedGetter>(vm, globalObject);
}
void JSTestCustomNamedGetter::destroy(JSC::JSCell* cell)
return Base::getOwnPropertySlotByIndex(thisObject, exec, index, slot);
}
-EncodedJSValue jsTestCustomNamedGetterConstructor(ExecState* exec, JSObject* baseValue, EncodedJSValue thisValue, PropertyName)
+EncodedJSValue jsTestCustomNamedGetterConstructor(ExecState* exec, JSObject*, EncodedJSValue thisValue, PropertyName)
{
- UNUSED_PARAM(baseValue);
- UNUSED_PARAM(thisValue);
JSTestCustomNamedGetter* domObject = jsDynamicCast<JSTestCustomNamedGetter*>(JSValue::decode(thisValue));
if (!domObject)
return throwVMTypeError(exec);
EncodedJSValue JSC_HOST_CALL jsTestCustomNamedGetterPrototypeFunctionAnotherFunction(ExecState* exec)
{
- JSValue thisValue = exec->hostThisValue();
+ JSValue thisValue = exec->thisValue();
JSTestCustomNamedGetter* castedThis = jsDynamicCast<JSTestCustomNamedGetter*>(thisValue);
- if (!castedThis)
- return throwVMTypeError(exec);
+ if (UNLIKELY(!castedThis))
+ return throwThisTypeError(*exec, "TestCustomNamedGetter", "anotherFunction");
ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestCustomNamedGetter::info());
TestCustomNamedGetter& impl = castedThis->impl();
if (exec->argumentCount() < 1)
return throwVMError(exec, createNotEnoughArgumentsError(exec));
const String& str(exec->argument(0).isEmpty() ? String() : exec->argument(0).toString(exec)->value(exec));
- if (exec->hadException())
+ if (UNLIKELY(exec->hadException()))
return JSValue::encode(jsUndefined());
impl.anotherFunction(str);
return JSValue::encode(jsUndefined());
void JSTestCustomNamedGetterOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
{
- JSTestCustomNamedGetter* jsTestCustomNamedGetter = jsCast<JSTestCustomNamedGetter*>(handle.get().asCell());
+ JSTestCustomNamedGetter* jsTestCustomNamedGetter = jsCast<JSTestCustomNamedGetter*>(handle.slot()->asCell());
DOMWrapperWorld& world = *static_cast<DOMWrapperWorld*>(context);
uncacheWrapper(world, &jsTestCustomNamedGetter->impl(), jsTestCustomNamedGetter);
jsTestCustomNamedGetter->releaseImpl();
extern "C" { extern void* _ZTVN7WebCore21TestCustomNamedGetterE[]; }
#endif
#endif
-JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, TestCustomNamedGetter* impl)
+JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject* globalObject, TestCustomNamedGetter* impl)
{
if (!impl)
return jsNull();
- if (JSValue result = getExistingWrapper<JSTestCustomNamedGetter>(exec, impl))
+ if (JSValue result = getExistingWrapper<JSTestCustomNamedGetter>(globalObject, impl))
return result;
#if ENABLE(BINDING_INTEGRITY)
// by adding the SkipVTableValidation attribute to the interface IDL definition
RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
#endif
- ReportMemoryCost<TestCustomNamedGetter>::reportMemoryCost(exec, impl);
- return createNewWrapper<JSTestCustomNamedGetter>(exec, globalObject, impl);
+ return createNewWrapper<JSTestCustomNamedGetter>(globalObject, impl);
}
-TestCustomNamedGetter* toTestCustomNamedGetter(JSC::JSValue value)
+TestCustomNamedGetter* JSTestCustomNamedGetter::toWrapped(JSC::JSValue value)
{
- return value.inherits(JSTestCustomNamedGetter::info()) ? &jsCast<JSTestCustomNamedGetter*>(value)->impl() : 0;
+ if (auto* wrapper = jsDynamicCast<JSTestCustomNamedGetter*>(value))
+ return &wrapper->impl();
+ return nullptr;
}
}