JSTypedArrayViewConstructor.cpp [plain text]
#include "config.h"
#include "JSTypedArrayViewConstructor.h"
#include "CallFrame.h"
#include "Error.h"
#include "GetterSetter.h"
#include "JSCBuiltins.h"
#include "JSCInlines.h"
#include "JSGenericTypedArrayViewConstructorInlines.h"
#include "JSTypedArrayViewPrototype.h"
#include "JSTypedArrays.h"
namespace JSC {
JSTypedArrayViewConstructor::JSTypedArrayViewConstructor(VM& vm, Structure* structure)
: Base(vm, structure)
{
}
const ClassInfo JSTypedArrayViewConstructor::s_info = { "Function", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTypedArrayViewConstructor) };
void JSTypedArrayViewConstructor::finishCreation(VM& vm, JSGlobalObject* globalObject, JSTypedArrayViewPrototype* prototype, GetterSetter* speciesSymbol)
{
Base::finishCreation(vm, "TypedArray");
putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, DontEnum | DontDelete | ReadOnly);
putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(0), DontEnum | ReadOnly);
putDirectNonIndexAccessor(vm, vm.propertyNames->speciesSymbol, speciesSymbol, Accessor | ReadOnly | DontEnum);
JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->of, typedArrayConstructorOfCodeGenerator, DontEnum);
JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->from, typedArrayConstructorFromCodeGenerator, DontEnum);
}
Structure* JSTypedArrayViewConstructor::createStructure(
VM& vm, JSGlobalObject* globalObject, JSValue prototype)
{
return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
}
static EncodedJSValue JSC_HOST_CALL constructTypedArrayView(ExecState* exec)
{
VM& vm = exec->vm();
auto scope = DECLARE_THROW_SCOPE(vm);
return throwVMTypeError(exec, scope, ASCIILiteral("%TypedArray% should not be called directly"));
}
ConstructType JSTypedArrayViewConstructor::getConstructData(JSCell*, ConstructData& constructData)
{
constructData.native.function = constructTypedArrayView;
return ConstructType::Host;
}
CallType JSTypedArrayViewConstructor::getCallData(JSCell*, CallData& callData)
{
callData.native.function = constructTypedArrayView;
return CallType::Host;
}
}