X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/ba379fdc102753d6be2c4d937058fe40257329fe..a253471d7f8e4d91bf6ebabab00155c3b387d3d0:/runtime/InternalFunction.cpp diff --git a/runtime/InternalFunction.cpp b/runtime/InternalFunction.cpp index b5c9571..50ea504 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" namespace JSC { ASSERT_CLASS_FITS_IN_CELL(InternalFunction); +ASSERT_HAS_TRIVIAL_DESTRUCTOR(InternalFunction); -const ClassInfo InternalFunction::info = { "Function", 0, 0, 0 }; +const ClassInfo InternalFunction::s_info = { "Function", &JSNonFinalObject::s_info, 0, 0, CREATE_METHOD_TABLE(InternalFunction) }; -const ClassInfo* InternalFunction::classInfo() const +InternalFunction::InternalFunction(JSGlobalObject* globalObject, Structure* structure) + : JSNonFinalObject(globalObject->globalData(), structure) { - return &info; } -InternalFunction::InternalFunction(JSGlobalData* globalData, PassRefPtr structure, const Identifier& name) - : JSObject(structure) +void InternalFunction::finishCreation(JSGlobalData& globalData, const Identifier& name) { - putDirect(globalData->propertyNames->name, jsString(globalData, name.ustring()), DontDelete | ReadOnly | DontEnum); + Base::finishCreation(globalData); + ASSERT(inherits(&s_info)); + ASSERT(methodTable()->getCallData != InternalFunction::s_info.methodTable.getCallData); + putDirect(globalData, globalData.propertyNames->name, jsString(&globalData, name.isNull() ? "" : name.ustring()), DontDelete | ReadOnly | DontEnum); } -const UString& InternalFunction::name(JSGlobalData* globalData) +const UString& InternalFunction::name(ExecState* exec) { - return asString(getDirect(globalData->propertyNames->name))->value(); + return asString(getDirect(exec->globalData(), exec->globalData().propertyNames->name))->tryGetValue(); } -const UString InternalFunction::displayName(JSGlobalData* globalData) +const UString InternalFunction::displayName(ExecState* exec) { - JSValue displayName = getDirect(globalData->propertyNames->displayName); + JSValue displayName = getDirect(exec->globalData(), exec->globalData().propertyNames->displayName); - if (displayName && isJSString(globalData, displayName)) - return asString(displayName)->value(); + if (displayName && isJSString(displayName)) + return asString(displayName)->tryGetValue(); - return UString::null(); + return UString(); } -const UString InternalFunction::calculatedDisplayName(JSGlobalData* globalData) +CallType InternalFunction::getCallData(JSCell*, CallData&) { - const UString explicitName = displayName(globalData); + ASSERT_NOT_REACHED(); + return CallTypeNone; +} + +const UString InternalFunction::calculatedDisplayName(ExecState* exec) +{ + const UString explicitName = displayName(exec); if (!explicitName.isEmpty()) return explicitName; - return name(globalData); + return name(exec); } } // namespace JSC