InternalFunction.h [plain text]
#pragma once
#include "JSDestructibleObject.h"
namespace JSC {
class FunctionPrototype;
class InternalFunction : public JSDestructibleObject {
public:
typedef JSDestructibleObject Base;
static const unsigned StructureFlags = Base::StructureFlags | ImplementsHasInstance | ImplementsDefaultHasInstance | TypeOfShouldCallGetCallData;
DECLARE_EXPORT_INFO;
JS_EXPORT_PRIVATE static void visitChildren(JSCell*, SlotVisitor&);
JS_EXPORT_PRIVATE const String& name();
const String displayName(VM&);
const String calculatedDisplayName(VM&);
static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue proto)
{
return Structure::create(vm, globalObject, proto, TypeInfo(ObjectType, StructureFlags), info());
}
static Structure* createSubclassStructure(ExecState*, JSValue newTarget, Structure*);
protected:
JS_EXPORT_PRIVATE InternalFunction(VM&, Structure*);
JS_EXPORT_PRIVATE void finishCreation(VM&, const String& name);
JS_EXPORT_PRIVATE static Structure* createSubclassStructureSlow(ExecState*, JSValue newTarget, Structure*);
static CallType getCallData(JSCell*, CallData&);
WriteBarrier<JSString> m_originalName;
};
InternalFunction* asInternalFunction(JSValue);
inline InternalFunction* asInternalFunction(JSValue value)
{
ASSERT(asObject(value)->inherits(*value.getObject()->vm(), InternalFunction::info()));
return static_cast<InternalFunction*>(asObject(value));
}
ALWAYS_INLINE Structure* InternalFunction::createSubclassStructure(ExecState* exec, JSValue newTarget, Structure* baseClass)
{
ASSERT(!newTarget || newTarget.isConstructor());
if (newTarget && newTarget != exec->jsCallee())
return createSubclassStructureSlow(exec, newTarget, baseClass);
return baseClass;
}
}