Use JSFastNative API in more places, for improved compatibility with future SpiderMonkey versions.

Remove some unnecessary script-exposed functions, and move some more
into the Engine namespace.

This was SVN commit r8428.
This commit is contained in:
Ykkrosh
2010-10-21 19:54:59 +00:00
parent 55741aed44
commit c0a7a36f7a
14 changed files with 124 additions and 394 deletions
+12 -3
View File
@@ -29,6 +29,9 @@
#include "ScriptTypes.h"
#include "ScriptVal.h"
#include "js/jsapi.h"
#include "ps/Profile.h"
#include "ps/utf16string.h"
class AutoGCRooter;
@@ -40,6 +43,12 @@ namespace boost { class rand48; }
// but as large as necessary for all wrapped functions)
#define SCRIPT_INTERFACE_MAX_ARGS 6
#ifdef NDEBUG
#define ENABLE_SCRIPT_PROFILING 0
#else
#define ENABLE_SCRIPT_PROFILING 1
#endif
struct ScriptInterface_impl;
class ScriptInterface
{
@@ -241,7 +250,7 @@ private:
static JSClass* GetClass(JSContext* cx, JSObject* obj);
static void* GetPrivate(JSContext* cx, JSObject* obj);
void Register(const char* name, JSNative fptr, size_t nargs);
void Register(const char* name, JSFastNative fptr, size_t nargs);
std::auto_ptr<ScriptInterface_impl> m;
// The nasty macro/template bits are split into a separate file so you don't have to look at them
@@ -253,10 +262,10 @@ public:
// void RegisterFunction(const char* functionName);
//
// template <R, T0..., TR (*fptr) (void* cbdata, T0...)>
// static JSNative call;
// static JSFastNative call;
//
// template <R, T0..., JSClass*, TC, TR (TC:*fptr) (T0...)>
// static JSNative callMethod;
// static JSFastNative callMethod;
//
// template <dummy, T0...>
// static size_t nargs();