]> git.saurik.com Git - apple/javascriptcore.git/blobdiff - runtime/InternalFunction.cpp
JavaScriptCore-1097.13.tar.gz
[apple/javascriptcore.git] / runtime / InternalFunction.cpp
index f68e795f31cbd8b0a298a35c31e5a26b056f8f22..50ea504c1a9396d29ee577a37fe5d0a33dd71be9 100644 (file)
 #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, NonNullPassRefPtr<Structure> structure, const Identifier& name)
-    : JSObject(structure)
+void InternalFunction::finishCreation(JSGlobalData& globalData, const Identifier& name)
 {
-    putDirect(globalData->propertyNames->name, jsString(globalData, name.isNull() ? "" : 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(ExecState* exec)
 {
-    return asString(getDirect(exec->globalData().propertyNames->name))->tryGetValue();
+    return asString(getDirect(exec->globalData(), exec->globalData().propertyNames->name))->tryGetValue();
 }
 
 const UString InternalFunction::displayName(ExecState* exec)
 {
-    JSValue displayName = getDirect(exec->globalData().propertyNames->displayName);
+    JSValue displayName = getDirect(exec->globalData(), exec->globalData().propertyNames->displayName);
     
-    if (displayName && isJSString(&exec->globalData(), displayName))
+    if (displayName && isJSString(displayName))
         return asString(displayName)->tryGetValue();
     
-    return UString::null();
+    return UString();
+}
+
+CallType InternalFunction::getCallData(JSCell*, CallData&)
+{
+    ASSERT_NOT_REACHED();
+    return CallTypeNone;
 }
 
 const UString InternalFunction::calculatedDisplayName(ExecState* exec)