]> git.saurik.com Git - apple/javascriptcore.git/blobdiff - runtime/InternalFunction.cpp
JavaScriptCore-7600.1.4.16.1.tar.gz
[apple/javascriptcore.git] / runtime / InternalFunction.cpp
index c48d6288e5c8406d8b377d4cdebe70af386b729f..24519c663774f18bb29ba17f66e6d9fc8685c2f2 100644 (file)
 #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, 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, NonNullPassRefPtr<Structure> 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(ExecState* exec)
+const String& InternalFunction::name(ExecState* exec)
 {
-    return asString(getDirect(exec->globalData().propertyNames->name))->value(exec);
+    return asString(getDirect(exec->vm(), exec->vm().propertyNames->name))->tryGetValue();
 }
 
-const UString InternalFunction::displayName(ExecState* exec)
+const String InternalFunction::displayName(ExecState* exec)
 {
-    JSValue displayName = getDirect(exec->globalData().propertyNames->displayName);
+    JSValue displayName = getDirect(exec->vm(), exec->vm().propertyNames->displayName);
     
-    if (displayName && isJSString(&exec->globalData(), displayName))
-        return asString(displayName)->value(exec);
+    if (displayName && isJSString(displayName))
+        return asString(displayName)->tryGetValue();
     
-    return UString::null();
+    return String();
 }
 
-const UString InternalFunction::calculatedDisplayName(ExecState* exec)
+CallType InternalFunction::getCallData(JSCell*, CallData&)
 {
-    const UString explicitName = displayName(exec);
+    RELEASE_ASSERT_NOT_REACHED();
+    return CallTypeNone;
+}
+
+const String InternalFunction::calculatedDisplayName(ExecState* exec)
+{
+    const String explicitName = displayName(exec);
     
     if (!explicitName.isEmpty())
         return explicitName;