[js] Remove code to handle v8 < 5.0

We require at least node v6 which means v8 5.0, so code to handle
older v8 is no longer useful.
This commit is contained in:
Olly Betts 2021-12-02 14:02:59 +13:00
commit 7c97bd5ab3
7 changed files with 10 additions and 463 deletions

View file

@ -105,17 +105,10 @@ fail:
%{
if(args.Length() == $jsargcount) {
errorHandler.err.Clear();
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903)
self = $jswrapper(args, errorHandler);
if(errorHandler.err.IsEmpty()) {
SWIGV8_ESCAPE(self);
}
#else
$jswrapper(args, errorHandler);
if(errorHandler.err.IsEmpty()) {
return;
}
#endif
}
%}
@ -127,22 +120,8 @@ fail:
%fragment ("js_dtor", "templates")
%{
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710)
static void $jswrapper(v8::Persistent< v8::Value > object, void *parameter) {
SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031900)
static void $jswrapper(v8::Isolate *isolate, v8::Persistent<v8::Value> object, void *parameter) {
SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
static void $jswrapper(v8::Isolate *isolate, v8::Persistent<v8::Object> *object, SWIGV8_Proxy *proxy) {
#elif (V8_MAJOR_VERSION-0) < 5
static void $jswrapper(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &data) {
v8::Local<v8::Object> object = data.GetValue();
static void $jswrapper(const v8::WeakCallbackInfo<SWIGV8_Proxy> &data) {
SWIGV8_Proxy *proxy = data.GetParameter();
#else
static void $jswrapper(const v8::WeakCallbackInfo<SWIGV8_Proxy> &data) {
SWIGV8_Proxy *proxy = data.GetParameter();
#endif
if(proxy->swigCMemOwn && proxy->swigCObject) {
#ifdef SWIGRUNTIME_DEBUG
@ -151,20 +130,6 @@ static void $jswrapper(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &dat
$jsfree proxy->swigCObject;
}
delete proxy;
#if (V8_MAJOR_VERSION-0) < 5
object.Clear();
#endif
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710)
object.Dispose();
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031900)
object.Dispose(isolate);
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032100)
object->Dispose(isolate);
#elif (V8_MAJOR_VERSION-0) < 5
object->Dispose();
#endif
}
%}
@ -176,40 +141,14 @@ static void $jswrapper(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &dat
* ----------------------------------------------------------------------------- */
%fragment ("js_dtoroverride", "templates")
%{
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710)
static void $jswrapper(v8::Persistent<v8::Value> object, void *parameter) {
SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031900)
static void $jswrapper(v8::Isolate *isolate, v8::Persistent<v8::Value> object, void *parameter) {
SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
static void $jswrapper(v8::Isolate *isolate, v8::Persistent< v8::Object> *object, SWIGV8_Proxy *proxy) {
#elif (V8_MAJOR_VERSION-0) < 5
static void $jswrapper(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &data) {
v8::Local<v8::Object> object = data.GetValue();
SWIGV8_Proxy *proxy = data.GetParameter();
#else
static void $jswrapper(const v8::WeakCallbackInfo<SWIGV8_Proxy> &data) {
SWIGV8_Proxy *proxy = data.GetParameter();
#endif
if(proxy->swigCMemOwn && proxy->swigCObject) {
$jstype arg1 = ($jstype)proxy->swigCObject;
${destructor_action}
}
delete proxy;
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710)
object.Dispose();
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031900)
object.Dispose(isolate);
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032100)
object->Dispose(isolate);
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
object->Dispose();
#elif (V8_MAJOR_VERSION-0) < 5
object.Clear();
#endif
}
%}
@ -221,11 +160,7 @@ static void $jswrapper(const v8::WeakCallbackInfo<SWIGV8_Proxy> &data) {
* ----------------------------------------------------------------------------- */
%fragment("js_getter", "templates")
%{
#if (V8_MAJOR_VERSION-0) < 5
static SwigV8ReturnValue $jswrapper(v8::Local<v8::String> property, const SwigV8PropertyCallbackInfo &info) {
#else
static SwigV8ReturnValue $jswrapper(v8::Local<v8::Name> property, const SwigV8PropertyCallbackInfo &info) {
#endif
SWIGV8_HANDLESCOPE();
SWIGV8_VALUE jsresult;
@ -247,11 +182,7 @@ fail:
* ----------------------------------------------------------------------------- */
%fragment("js_setter", "templates")
%{
#if (V8_MAJOR_VERSION-0) < 5
static void $jswrapper(v8::Local<v8::String> property, v8::Local<v8::Value> value, const SwigV8PropertyCallbackInfoVoid &info) {
#else
static void $jswrapper(v8::Local<v8::Name> property, v8::Local<v8::Value> value, const SwigV8PropertyCallbackInfoVoid &info) {
#endif
SWIGV8_HANDLESCOPE();
$jslocals
@ -344,17 +275,10 @@ fail:
if(args.Length() == $jsargcount) {
errorHandler.err.Clear();
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903)
jsresult = $jswrapper(args, errorHandler);
if(errorHandler.err.IsEmpty()) {
SWIGV8_ESCAPE(jsresult);
}
#else
$jswrapper(args, errorHandler);
if(errorHandler.err.IsEmpty()) {
return;
}
#endif
}
%}
@ -394,15 +318,11 @@ fail:
%{
if (SWIGTYPE_p$jsbaseclass->clientdata && !(static_cast<SWIGV8_ClientData *>(SWIGTYPE_p$jsbaseclass->clientdata)->class_templ.IsEmpty()))
{
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903)
$jsmangledname_class->Inherit(static_cast<SWIGV8_ClientData *>(SWIGTYPE_p$jsbaseclass->clientdata)->class_templ);
#else
$jsmangledname_class->Inherit(
v8::Local<v8::FunctionTemplate>::New(
v8::Isolate::GetCurrent(),
static_cast<SWIGV8_ClientData *>(SWIGTYPE_p$jsbaseclass->clientdata)->class_templ)
);
#endif
#ifdef SWIGRUNTIME_DEBUG
printf("Inheritance successful $jsmangledname $jsbaseclass\n");
@ -425,10 +345,7 @@ fail:
SWIGV8_FUNCTION_TEMPLATE $jsmangledname_class_0 = SWIGV8_CreateClassTemplate("$jsname");
$jsmangledname_class_0->SetCallHandler($jsctor);
$jsmangledname_class_0->Inherit($jsmangledname_class);
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903)
$jsmangledname_class_0->SetHiddenPrototype(true);
v8::Handle<v8::Object> $jsmangledname_obj = $jsmangledname_class_0->GetFunction();
#elif (SWIG_V8_VERSION < 0x0704)
#if (SWIG_V8_VERSION < 0x0704)
$jsmangledname_class_0->SetHiddenPrototype(true);
v8::Local<v8::Object> $jsmangledname_obj = $jsmangledname_class_0->GetFunction();
#else
@ -444,12 +361,7 @@ fail:
* ----------------------------------------------------------------------------- */
%fragment("jsv8_register_class", "templates")
%{
#if (V8_MAJOR_VERSION-0) < 5
$jsparent_obj->Set(SWIGV8_SYMBOL_NEW("$jsname"), $jsmangledname_obj);
#else
SWIGV8_MAYBE_CHECK($jsparent_obj->Set(context, SWIGV8_SYMBOL_NEW("$jsname"), $jsmangledname_obj));
#endif
%}
/* -----------------------------------------------------------------------------
@ -469,11 +381,7 @@ fail:
* ----------------------------------------------------------------------------- */
%fragment("jsv8_register_namespace", "templates")
%{
#if (V8_MAJOR_VERSION-0) < 5
$jsparent_obj->Set(SWIGV8_SYMBOL_NEW("$jsname"), $jsmangledname_obj);
#else
SWIGV8_MAYBE_CHECK($jsparent_obj->Set(context, SWIGV8_SYMBOL_NEW("$jsname"), $jsmangledname_obj));
#endif
%}
/* -----------------------------------------------------------------------------