forked from 0ad/0ad
The old debug API has been removed in SpiderMonkey 38, so remove profiler1 script profiling.
Patch by leper, refs #3708 See also https://bugzilla.mozilla.org/show_bug.cgi?id=1069694 This was SVN commit r18580.
This commit is contained in:
parent
72ca6c5f80
commit
4e87fef3da
@ -372,7 +372,6 @@ netwarnings = "true" ; Show warnings if the network connection is b
|
||||
|
||||
[profiler2]
|
||||
autoenable = false ; Enable HTTP server output at startup (default off for security/performance)
|
||||
script.enable = false ; Enable Javascript profiling. Needs to be set before startup and can't be changed later. (default off for performance)
|
||||
gpu.arb.enable = true ; Allow GL_ARB_timer_query timing mode when available
|
||||
gpu.ext.enable = true ; Allow GL_EXT_timer_query timing mode when available
|
||||
gpu.intel.enable = true ; Allow GL_INTEL_performance_queries timing mode when available
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2015 Wildfire Games.
|
||||
/* Copyright (C) 2016 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -15,7 +15,6 @@
|
||||
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include "precompiled.h"
|
||||
|
||||
#include <sstream>
|
||||
@ -35,6 +34,7 @@
|
||||
#include "ps/CLogger.h"
|
||||
#include "ps/CStr.h"
|
||||
#include "ps/Game.h"
|
||||
#include "ps/GameSetup/Config.h"
|
||||
#include "ps/Hotkey.h"
|
||||
#include "simulation2/components/ICmpOverlayRenderer.h"
|
||||
#include "simulation2/components/ICmpRangeManager.h"
|
||||
|
@ -47,6 +47,7 @@
|
||||
#include "lib/utf8.h"
|
||||
#include "ps/CLogger.h"
|
||||
#include "ps/Filesystem.h"
|
||||
#include "ps/GameSetup/Config.h"
|
||||
#include "ps/Globals.h"
|
||||
#include "ps/Hotkey.h"
|
||||
#include "ps/Profile.h"
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2015 Wildfire Games.
|
||||
/* Copyright (C) 2016 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -32,6 +32,7 @@
|
||||
#include "lib/utf8.h"
|
||||
#include "ps/CLogger.h"
|
||||
#include "ps/ConfigDB.h"
|
||||
#include "ps/GameSetup/Config.h"
|
||||
#include "ps/Globals.h"
|
||||
#include "ps/Hotkey.h"
|
||||
#include "renderer/Renderer.h"
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2015 Wildfire Games.
|
||||
/* Copyright (C) 2016 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -22,6 +22,7 @@
|
||||
|
||||
#include "maths/Matrix3D.h"
|
||||
#include "ps/CLogger.h"
|
||||
#include "ps/GameSetup/Config.h"
|
||||
|
||||
extern int g_xres, g_yres;
|
||||
|
||||
|
@ -21,6 +21,8 @@
|
||||
|
||||
#include "gui/scripting/JSInterface_GUITypes.h"
|
||||
#include "gui/scripting/JSInterface_IGUIObject.h"
|
||||
|
||||
#include "ps/GameSetup/Config.h"
|
||||
#include "ps/CLogger.h"
|
||||
#include "ps/Profile.h"
|
||||
#include "scriptinterface/ScriptInterface.h"
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "ps/ConfigDB.h"
|
||||
#include "ps/Filesystem.h"
|
||||
#include "ps/Game.h"
|
||||
#include "ps/GameSetup/Config.h"
|
||||
#include "ps/Profile.h"
|
||||
#include "ps/World.h"
|
||||
#include "ps/XML/Xeromyces.h"
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2015 Wildfire Games.
|
||||
/* Copyright (C) 2016 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -38,6 +38,7 @@
|
||||
#include "network/NetServer.h"
|
||||
#include "ps/CLogger.h"
|
||||
#include "ps/Filesystem.h"
|
||||
#include "ps/GameSetup/Config.h"
|
||||
#include "ps/Globals.h"
|
||||
#include "ps/Hotkey.h"
|
||||
#include "ps/Profile.h"
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2015 Wildfire Games.
|
||||
/* Copyright (C) 2016 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -66,8 +66,6 @@ bool g_VSync = false;
|
||||
bool g_Quickstart = false;
|
||||
bool g_DisableAudio = false;
|
||||
|
||||
bool g_ScriptProfilingEnabled = false;
|
||||
|
||||
// flag to switch on drawing terrain overlays
|
||||
bool g_ShowPathfindingOverlay = false;
|
||||
|
||||
@ -111,8 +109,6 @@ static void LoadGlobals()
|
||||
CFG_GET_VAL("postproc", g_PostProc);
|
||||
CFG_GET_VAL("smoothlos", g_SmoothLOS);
|
||||
CFG_GET_VAL("gui.scale", g_GuiScale);
|
||||
|
||||
CFG_GET_VAL("profiler2.script.enable", g_ScriptProfilingEnabled);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2015 Wildfire Games.
|
||||
/* Copyright (C) 2016 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -91,8 +91,6 @@ extern bool g_VSync;
|
||||
extern bool g_Quickstart;
|
||||
extern bool g_DisableAudio;
|
||||
|
||||
extern bool g_ScriptProfilingEnabled;
|
||||
|
||||
extern CStrW g_CursorName;
|
||||
|
||||
class CmdLineArgs;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2015 Wildfire Games.
|
||||
/* Copyright (C) 2016 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -17,9 +17,11 @@
|
||||
|
||||
#include "precompiled.h"
|
||||
|
||||
#include "ps/scripting/JSInterface_VisualReplay.h"
|
||||
|
||||
#include "ps/CStr.h"
|
||||
#include "ps/Profile.h"
|
||||
#include "ps/VisualReplay.h"
|
||||
#include "ps/scripting/JSInterface_VisualReplay.h"
|
||||
|
||||
void JSI_VisualReplay::StartVisualReplay(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), const CStrW& directory)
|
||||
{
|
||||
|
@ -14,7 +14,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "ps/GameSetup/Config.h"
|
||||
#include "ps/Profile.h"
|
||||
|
||||
// Use the macro below to define types that will be passed by value to C++ functions.
|
||||
@ -118,29 +117,12 @@ struct ScriptInterface_NativeMethodWrapper<void, TC> {
|
||||
#undef OVERLOADS
|
||||
};
|
||||
|
||||
// Fast natives don't trigger the hook we use for profiling, so explicitly
|
||||
// notify the profiler when these functions are being called.
|
||||
// ScriptInterface_impl::Register stores the name in a reserved slot.
|
||||
#define SCRIPT_PROFILE \
|
||||
if (g_ScriptProfilingEnabled) \
|
||||
{ \
|
||||
std::string name = "(unknown)"; \
|
||||
JS::RootedString str(cx, JS_GetFunctionId(JS_ValueToFunction(cx, args.calleev()))); \
|
||||
if (str) \
|
||||
{ \
|
||||
JS::RootedValue strVal(cx, JS::StringValue(str)); \
|
||||
ScriptInterface::FromJSVal(cx, strVal, name); \
|
||||
} \
|
||||
CProfileSampleScript profile(StringFlyweight(name).get().c_str()); \
|
||||
}
|
||||
|
||||
// JSFastNative-compatible function that wraps the function identified in the template argument list
|
||||
#define OVERLOADS(z, i, data) \
|
||||
template <typename R, TYPENAME_T0_HEAD(z,i) R (*fptr) ( ScriptInterface::CxPrivate* T0_TAIL_MAYBE_REF(z,i) )> \
|
||||
bool ScriptInterface::call(JSContext* cx, uint argc, jsval* vp) { \
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp); \
|
||||
JSAutoRequest rq(cx); \
|
||||
SCRIPT_PROFILE \
|
||||
BOOST_PP_REPEAT_##z (i, CONVERT_ARG, ~) \
|
||||
JS::RootedValue rval(cx); \
|
||||
ScriptInterface_NativeWrapper<R>::template call<T0_HEAD(z,i) R( ScriptInterface::CxPrivate* T0_TAIL_MAYBE_REF(z,i))>(cx, &rval, fptr A0_TAIL(z,i)); \
|
||||
@ -156,7 +138,6 @@ BOOST_PP_REPEAT(SCRIPT_INTERFACE_MAX_ARGS, OVERLOADS, ~)
|
||||
bool ScriptInterface::callMethod(JSContext* cx, uint argc, jsval* vp) { \
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp); \
|
||||
JSAutoRequest rq(cx); \
|
||||
SCRIPT_PROFILE \
|
||||
JS::RootedObject thisObj(cx, JS_THIS_OBJECT(cx, vp)); \
|
||||
if (ScriptInterface::GetClass(thisObj) != CLS) return false; \
|
||||
TC* c = static_cast<TC*>(ScriptInterface::GetPrivate(thisObj)); \
|
||||
@ -227,7 +208,6 @@ BOOST_PP_REPEAT(SCRIPT_INTERFACE_MAX_ARGS, OVERLOADS, ~)
|
||||
#undef ASSIGN_OR_TO_JS_VAL
|
||||
|
||||
// Clean up our mess
|
||||
#undef SCRIPT_PROFILE
|
||||
#undef NUMBERED_LIST_HEAD
|
||||
#undef NUMBERED_LIST_TAIL
|
||||
#undef NUMBERED_LIST_TAIL_MAYBE_REF
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2015 Wildfire Games.
|
||||
/* Copyright (C) 2016 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -46,7 +46,6 @@
|
||||
#endif
|
||||
|
||||
#include "jsfriendapi.h"
|
||||
#include "js/OldDebugAPI.h"
|
||||
#include "js/GCAPI.h"
|
||||
#include "js/StructuredClone.h"
|
||||
|
||||
|
@ -122,22 +122,6 @@ ScriptRuntime::ScriptRuntime(shared_ptr<ScriptRuntime> parentRuntime, int runtim
|
||||
m_rt = JS_NewRuntime(runtimeSize, JS_USE_HELPER_THREADS, parentJSRuntime);
|
||||
ENSURE(m_rt); // TODO: error handling
|
||||
|
||||
if (g_ScriptProfilingEnabled)
|
||||
{
|
||||
// Execute and call hooks are disabled if the runtime debug mode is disabled
|
||||
JS_SetRuntimeDebugMode(m_rt, true);
|
||||
|
||||
// Profiler isn't thread-safe, so only enable this on the main thread
|
||||
if (ThreadUtil::IsMainThread())
|
||||
{
|
||||
if (CProfileManager::IsInitialised())
|
||||
{
|
||||
JS_SetExecuteHook(m_rt, jshook_script, this);
|
||||
JS_SetCallHook(m_rt, jshook_function, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
JS::SetGCSliceCallback(m_rt, GCSliceCallbackHook);
|
||||
JS_SetGCCallback(m_rt, ScriptRuntime::GCCallback, this);
|
||||
|
||||
@ -279,58 +263,6 @@ void ScriptRuntime::ShrinkingGC()
|
||||
JS_SetGCParameter(m_rt, JSGC_MODE, JSGC_MODE_INCREMENTAL);
|
||||
}
|
||||
|
||||
void* ScriptRuntime::jshook_script(JSContext* UNUSED(cx), JSAbstractFramePtr UNUSED(fp), bool UNUSED(isConstructing), bool before, bool* UNUSED(ok), void* closure)
|
||||
{
|
||||
if (before)
|
||||
g_Profiler.StartScript("script invocation");
|
||||
else
|
||||
g_Profiler.Stop();
|
||||
|
||||
return closure;
|
||||
}
|
||||
|
||||
void* ScriptRuntime::jshook_function(JSContext* cx, JSAbstractFramePtr fp, bool UNUSED(isConstructing), bool before, bool* UNUSED(ok), void* closure)
|
||||
{
|
||||
JSAutoRequest rq(cx);
|
||||
|
||||
if (!before)
|
||||
{
|
||||
g_Profiler.Stop();
|
||||
return closure;
|
||||
}
|
||||
|
||||
JS::RootedFunction fn(cx, fp.maybeFun());
|
||||
if (!fn)
|
||||
{
|
||||
g_Profiler.StartScript("(function)");
|
||||
return closure;
|
||||
}
|
||||
|
||||
// Try to get the name of non-anonymous functions
|
||||
JS::RootedString name(cx, JS_GetFunctionId(fn));
|
||||
if (name)
|
||||
{
|
||||
char* chars = JS_EncodeString(cx, name);
|
||||
if (chars)
|
||||
{
|
||||
g_Profiler.StartScript(StringFlyweight(chars).get().c_str());
|
||||
JS_free(cx, chars);
|
||||
return closure;
|
||||
}
|
||||
}
|
||||
|
||||
// No name - use fileName and line instead
|
||||
JS::AutoFilename fileName;
|
||||
unsigned lineno;
|
||||
JS::DescribeScriptedCaller(cx, &fileName, &lineno);
|
||||
|
||||
std::stringstream ss;
|
||||
ss << "(" << fileName.get() << ":" << lineno << ")";
|
||||
g_Profiler.StartScript(StringFlyweight(ss.str()).get().c_str());
|
||||
|
||||
return closure;
|
||||
}
|
||||
|
||||
void ScriptRuntime::PrepareContextsForIncrementalGC()
|
||||
{
|
||||
for (JSContext* const& ctx : m_Contexts)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2014 Wildfire Games.
|
||||
/* Copyright (C) 2016 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -87,15 +87,6 @@ private:
|
||||
double m_LastGCCheck;
|
||||
|
||||
static void GCCallback(JSRuntime *rt, JSGCStatus status, void *data);
|
||||
|
||||
static void* jshook_script(JSContext* UNUSED(cx), JSAbstractFramePtr UNUSED(fp),
|
||||
bool UNUSED(isConstructing), bool before,
|
||||
bool* UNUSED(ok), void* closure);
|
||||
|
||||
static void* jshook_function(JSContext* cx, JSAbstractFramePtr fp,
|
||||
bool UNUSED(isConstructing), bool before,
|
||||
bool* UNUSED(ok), void* closure);
|
||||
|
||||
};
|
||||
|
||||
#endif // INCLUDED_SCRIPTRUNTIME
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2015 Wildfire Games.
|
||||
/* Copyright (C) 2016 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -35,6 +35,7 @@
|
||||
#include "graphics/Unit.h"
|
||||
#include "maths/BoundingSphere.h"
|
||||
#include "maths/Matrix3D.h"
|
||||
#include "ps/GameSetup/Config.h"
|
||||
#include "ps/Profile.h"
|
||||
#include "renderer/Scene.h"
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2015 Wildfire Games.
|
||||
/* Copyright (C) 2016 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -24,6 +24,7 @@
|
||||
#include "graphics/LightEnv.h"
|
||||
#include "graphics/Terrain.h"
|
||||
#include "maths/MathUtil.h"
|
||||
#include "ps/CStr.h"
|
||||
#include "ps/Game.h"
|
||||
#include "ps/World.h"
|
||||
#include "renderer/PostprocManager.h"
|
||||
|
Loading…
Reference in New Issue
Block a user