]> git.saurik.com Git - apple/javascriptcore.git/blobdiff - builtins/BuiltinExecutables.h
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / builtins / BuiltinExecutables.h
index d44bf4c9bda8cdbb12a943439bd23f7ce0c5a7cc..f0d5f4e59bd89e176e0bd56064b506cda19b8e4f 100644 (file)
 #define BuiltinExecutables_h
 
 #include "JSCBuiltins.h"
+#include "ParserModes.h"
 #include "SourceCode.h"
 #include "Weak.h"
-#include <wtf/PassOwnPtr.h>
+#include "WeakHandleOwner.h"
 
 namespace JSC {
 
@@ -37,25 +38,31 @@ class UnlinkedFunctionExecutable;
 class Identifier;
 class VM;
 
-class BuiltinExecutables {
+class BuiltinExecutables final: private WeakHandleOwner {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    static PassOwnPtr<BuiltinExecutables> create(VM& vm)
-    {
-        return adoptPtr(new BuiltinExecutables(vm));
-    }
-    
+    explicit BuiltinExecutables(VM&);
+
 #define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, length) \
 UnlinkedFunctionExecutable* name##Executable(); \
 const SourceCode& name##Source() { return m_##name##Source; }
     
     JSC_FOREACH_BUILTIN(EXPOSE_BUILTIN_EXECUTABLES)
 #undef EXPOSE_BUILTIN_SOURCES
-    
+
+    UnlinkedFunctionExecutable* createDefaultConstructor(ConstructorKind, const Identifier& name);
+
 private:
-    BuiltinExecutables(VM&);
+    void finalize(Handle<Unknown>, void* context) override;
+
     VM& m_vm;
-    UnlinkedFunctionExecutable* createBuiltinExecutable(const SourceCode&, const Identifier&);
+
+    UnlinkedFunctionExecutable* createBuiltinExecutable(const SourceCode& code, const Identifier& name)
+    {
+        return createExecutableInternal(code, name, ConstructorKind::None);
+    }
+    UnlinkedFunctionExecutable* createExecutableInternal(const SourceCode&, const Identifier&, ConstructorKind);
+
 #define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, length)\
     SourceCode m_##name##Source; \
     Weak<UnlinkedFunctionExecutable> m_##name##Executable;