Replace JS_THIS_OBJECT and JS::CallReceiver in preparation for SpiderMonkey 49 and 61.

Differential Revision: https://code.wildfiregames.com/D2173
Refs #4893, D1699, D2142, D844, 7c2e9027c2, ...
Refs https://bugzilla.mozilla.org/show_bug.cgi?id=1270977
Refs https://bugzilla.mozilla.org/show_bug.cgi?id=1255800
Tested on: clang 8, VS2015, Jenkins

This was SVN commit r22661.
This commit is contained in:
elexis
2019-08-13 14:11:43 +00:00
parent 8dc425be5d
commit 64e80471d0
6 changed files with 75 additions and 76 deletions
+6 -17
View File
@@ -252,15 +252,15 @@ bool ProfileStart(JSContext* cx, uint argc, JS::Value* vp)
return true;
}
bool ProfileStop(JSContext* UNUSED(cx), uint UNUSED(argc), JS::Value* vp)
bool ProfileStop(JSContext* UNUSED(cx), uint argc, JS::Value* vp)
{
JS::CallReceiver rec = JS::CallReceiverFromVp(vp);
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
if (CProfileManager::IsInitialised() && ThreadUtil::IsMainThread())
g_Profiler.Stop();
g_Profiler2.RecordRegionLeave();
rec.rval().setUndefined();
args.rval().setUndefined();
return true;
}
@@ -308,14 +308,14 @@ static double generate_uniform_real(boost::rand48& rng, double min, double max)
}
}
bool Math_random(JSContext* cx, uint UNUSED(argc), JS::Value* vp)
bool Math_random(JSContext* cx, uint argc, JS::Value* vp)
{
JS::CallReceiver rec = JS::CallReceiverFromVp(vp);
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
double r;
if (!ScriptInterface::GetScriptInterfaceAndCBData(cx)->pScriptInterface->MathRandom(r))
return false;
rec.rval().setNumber(r);
args.rval().setNumber(r);
return true;
}
@@ -1104,17 +1104,6 @@ bool ScriptInterface::IsExceptionPending(JSContext* cx)
return JS_IsExceptionPending(cx) ? true : false;
}
const JSClass* ScriptInterface::GetClass(JS::HandleObject obj)
{
return JS_GetClass(obj);
}
void* ScriptInterface::GetPrivate(JS::HandleObject obj)
{
// TODO: use JS_GetInstancePrivate
return JS_GetPrivate(obj);
}
JS::Value ScriptInterface::CloneValueFromOtherContext(const ScriptInterface& otherContext, JS::HandleValue val) const
{
PROFILE("CloneValueFromOtherContext");