WeakMapConstructor.cpp [plain text]
#include "config.h"
#include "WeakMapConstructor.h"
#include "JSCJSValueInlines.h"
#include "JSCellInlines.h"
#include "JSGlobalObject.h"
#include "JSWeakMap.h"
#include "StructureInlines.h"
#include "WeakMapPrototype.h"
namespace JSC {
const ClassInfo WeakMapConstructor::s_info = { "Function", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(WeakMapConstructor) };
void WeakMapConstructor::finishCreation(VM& vm, WeakMapPrototype* prototype)
{
Base::finishCreation(vm, prototype->classInfo()->className);
putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, DontEnum | DontDelete | ReadOnly);
putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(0), ReadOnly | DontEnum | DontDelete);
}
static EncodedJSValue JSC_HOST_CALL constructWeakMap(ExecState* exec)
{
JSGlobalObject* globalObject = asInternalFunction(exec->callee())->globalObject();
Structure* structure = globalObject->weakMapStructure();
return JSValue::encode(JSWeakMap::create(exec, structure));
}
ConstructType WeakMapConstructor::getConstructData(JSCell*, ConstructData& constructData)
{
constructData.native.function = constructWeakMap;
return ConstructTypeHost;
}
CallType WeakMapConstructor::getCallData(JSCell*, CallData&)
{
return CallTypeNone;
}
}