BuiltinExecutables.h [plain text]
#pragma once
#include "JSCBuiltins.h"
#include "ParserModes.h"
#include "SourceCode.h"
#include "Weak.h"
#include "WeakHandleOwner.h"
namespace JSC {
class UnlinkedFunctionExecutable;
class Identifier;
class VM;
class BuiltinExecutables final: private WeakHandleOwner {
WTF_MAKE_FAST_ALLOCATED;
public:
explicit BuiltinExecutables(VM&);
#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, length) \
UnlinkedFunctionExecutable* name##Executable(); \
const SourceCode& name##Source() { return m_##name##Source; }
JSC_FOREACH_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES)
#undef EXPOSE_BUILTIN_SOURCES
UnlinkedFunctionExecutable* createDefaultConstructor(ConstructorKind, const Identifier& name);
static UnlinkedFunctionExecutable* createExecutable(VM&, const SourceCode&, const Identifier&, ConstructorKind, ConstructAbility);
private:
void finalize(Handle<Unknown>, void* context) override;
VM& m_vm;
UnlinkedFunctionExecutable* createBuiltinExecutable(const SourceCode&, const Identifier&, ConstructAbility);
#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, length)\
SourceCode m_##name##Source; \
Weak<UnlinkedFunctionExecutable> m_##name##Executable;
JSC_FOREACH_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS)
#undef DECLARE_BUILTIN_SOURCE_MEMBERS
};
}