X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/ba379fdc102753d6be2c4d937058fe40257329fe..HEAD:/runtime/InternalFunction.cpp?ds=inline diff --git a/runtime/InternalFunction.cpp b/runtime/InternalFunction.cpp index b5c9571..6f53bc0 100644 --- a/runtime/InternalFunction.cpp +++ b/runtime/InternalFunction.cpp @@ -24,48 +24,58 @@ #include "InternalFunction.h" #include "FunctionPrototype.h" +#include "JSGlobalObject.h" #include "JSString.h" +#include "JSCInlines.h" namespace JSC { -ASSERT_CLASS_FITS_IN_CELL(InternalFunction); +STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(InternalFunction); -const ClassInfo InternalFunction::info = { "Function", 0, 0, 0 }; +const ClassInfo InternalFunction::s_info = { "Function", &Base::s_info, 0, CREATE_METHOD_TABLE(InternalFunction) }; -const ClassInfo* InternalFunction::classInfo() const +InternalFunction::InternalFunction(VM& vm, Structure* structure) + : JSDestructibleObject(vm, structure) { - return &info; } -InternalFunction::InternalFunction(JSGlobalData* globalData, PassRefPtr structure, const Identifier& name) - : JSObject(structure) +void InternalFunction::finishCreation(VM& vm, const String& name) { - putDirect(globalData->propertyNames->name, jsString(globalData, name.ustring()), DontDelete | ReadOnly | DontEnum); + Base::finishCreation(vm); + ASSERT(inherits(info())); + ASSERT(methodTable()->getCallData != InternalFunction::info()->methodTable.getCallData); + putDirect(vm, vm.propertyNames->name, jsString(&vm, name), DontDelete | ReadOnly | DontEnum); } -const UString& InternalFunction::name(JSGlobalData* globalData) +const String& InternalFunction::name(ExecState* exec) { - return asString(getDirect(globalData->propertyNames->name))->value(); + return asString(getDirect(exec->vm(), exec->vm().propertyNames->name))->tryGetValue(); } -const UString InternalFunction::displayName(JSGlobalData* globalData) +const String InternalFunction::displayName(ExecState* exec) { - JSValue displayName = getDirect(globalData->propertyNames->displayName); + JSValue displayName = getDirect(exec->vm(), exec->vm().propertyNames->displayName); - if (displayName && isJSString(globalData, displayName)) - return asString(displayName)->value(); + if (displayName && isJSString(displayName)) + return asString(displayName)->tryGetValue(); - return UString::null(); + return String(); } -const UString InternalFunction::calculatedDisplayName(JSGlobalData* globalData) +CallType InternalFunction::getCallData(JSCell*, CallData&) { - const UString explicitName = displayName(globalData); + RELEASE_ASSERT_NOT_REACHED(); + return CallTypeNone; +} + +const String InternalFunction::calculatedDisplayName(ExecState* exec) +{ + const String explicitName = displayName(exec); if (!explicitName.isEmpty()) return explicitName; - return name(globalData); + return name(exec); } } // namespace JSC