X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/14957cd040308e3eeec43d26bae5d76da13fcd85..HEAD:/runtime/ErrorConstructor.cpp diff --git a/runtime/ErrorConstructor.cpp b/runtime/ErrorConstructor.cpp index df112dd..30c4faa 100644 --- a/runtime/ErrorConstructor.cpp +++ b/runtime/ErrorConstructor.cpp @@ -22,46 +22,55 @@ #include "ErrorConstructor.h" #include "ErrorPrototype.h" +#include "Interpreter.h" #include "JSGlobalObject.h" #include "JSString.h" +#include "JSCInlines.h" namespace JSC { -ASSERT_CLASS_FITS_IN_CELL(ErrorConstructor); +STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(ErrorConstructor); -ErrorConstructor::ErrorConstructor(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, ErrorPrototype* errorPrototype) - : InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, errorPrototype->classInfo()->className)) +const ClassInfo ErrorConstructor::s_info = { "Function", &Base::s_info, 0, CREATE_METHOD_TABLE(ErrorConstructor) }; + +ErrorConstructor::ErrorConstructor(VM& vm, Structure* structure) + : InternalFunction(vm, structure) +{ +} + +void ErrorConstructor::finishCreation(VM& vm, ErrorPrototype* errorPrototype) { + Base::finishCreation(vm, errorPrototype->classInfo()->className); // ECMA 15.11.3.1 Error.prototype - putDirectWithoutTransition(exec->globalData(), exec->propertyNames().prototype, errorPrototype, DontEnum | DontDelete | ReadOnly); - putDirectWithoutTransition(exec->globalData(), exec->propertyNames().length, jsNumber(1), DontDelete | ReadOnly | DontEnum); + putDirectWithoutTransition(vm, vm.propertyNames->prototype, errorPrototype, DontEnum | DontDelete | ReadOnly); + putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), DontDelete | ReadOnly | DontEnum); } // ECMA 15.9.3 -static EncodedJSValue JSC_HOST_CALL constructWithErrorConstructor(ExecState* exec) +EncodedJSValue JSC_HOST_CALL Interpreter::constructWithErrorConstructor(ExecState* exec) { JSValue message = exec->argumentCount() ? exec->argument(0) : jsUndefined(); Structure* errorStructure = asInternalFunction(exec->callee())->globalObject()->errorStructure(); - return JSValue::encode(ErrorInstance::create(exec, errorStructure, message)); + return JSValue::encode(ErrorInstance::create(exec, errorStructure, message, nullptr, TypeNothing, false)); } -ConstructType ErrorConstructor::getConstructData(ConstructData& constructData) +ConstructType ErrorConstructor::getConstructData(JSCell*, ConstructData& constructData) { - constructData.native.function = constructWithErrorConstructor; + constructData.native.function = Interpreter::constructWithErrorConstructor; return ConstructTypeHost; } -static EncodedJSValue JSC_HOST_CALL callErrorConstructor(ExecState* exec) +EncodedJSValue JSC_HOST_CALL Interpreter::callErrorConstructor(ExecState* exec) { JSValue message = exec->argumentCount() ? exec->argument(0) : jsUndefined(); Structure* errorStructure = asInternalFunction(exec->callee())->globalObject()->errorStructure(); - return JSValue::encode(ErrorInstance::create(exec, errorStructure, message)); + return JSValue::encode(ErrorInstance::create(exec, errorStructure, message, nullptr, TypeNothing, false)); } -CallType ErrorConstructor::getCallData(CallData& callData) +CallType ErrorConstructor::getCallData(JSCell*, CallData& callData) { - callData.native.function = callErrorConstructor; + callData.native.function = Interpreter::callErrorConstructor; return CallTypeHost; }