mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 671035 - Remove windows.h from jsprobes.h by moving ETW support into jsprobes.cpp (r=dmandelin)
--HG-- extra : rebase_source : a290b4a967fe86ce4ba70dc3c8f2f6a3698f6b48
This commit is contained in:
parent
4f9e57bfe0
commit
d2ab0d6e3f
@ -1019,7 +1019,7 @@ ifdef MOZ_ETW
|
||||
ETWProvider.h ETWProvider.rc ETWProvider.mof: ETWProvider.man
|
||||
$(MC) -um -mof $^
|
||||
|
||||
$(CPPSRCS:%.cpp=%.$(OBJ_SUFFIX)): ETWProvider.h
|
||||
jsprobes.$(OBJ_SUFFIX): ETWProvider.h
|
||||
|
||||
ETWProvider.res: ETWProvider.rc
|
||||
$(RC) -r -i "$(SDKDIR)Include" $^
|
||||
|
@ -746,9 +746,6 @@ JS_PUBLIC_API(JSRuntime *)
|
||||
JS_NewRuntime(uint32 maxbytes)
|
||||
{
|
||||
if (!js_NewRuntimeWasCalled) {
|
||||
#ifdef MOZ_ETW
|
||||
EventRegisterMozillaSpiderMonkey();
|
||||
#endif
|
||||
#ifdef DEBUG
|
||||
/*
|
||||
* This code asserts that the numbers associated with the error names
|
||||
@ -789,18 +786,22 @@ JS_NewRuntime(uint32 maxbytes)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Probes::createRuntime(rt);
|
||||
return rt;
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(void)
|
||||
JS_DestroyRuntime(JSRuntime *rt)
|
||||
{
|
||||
Probes::destroyRuntime(rt);
|
||||
Foreground::delete_(rt);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(void)
|
||||
JS_ShutDown(void)
|
||||
{
|
||||
Probes::shutdown();
|
||||
|
||||
#ifdef MOZ_TRACEVIS
|
||||
StopTraceVis();
|
||||
#endif
|
||||
@ -809,10 +810,6 @@ JS_ShutDown(void)
|
||||
js_CleanupLocks();
|
||||
#endif
|
||||
PRMJ_NowShutdown();
|
||||
|
||||
#ifdef MOZ_ETW
|
||||
EventUnregisterMozillaSpiderMonkey();
|
||||
#endif
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(void *)
|
||||
|
@ -33,6 +33,14 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifdef MOZ_ETW
|
||||
#include "jswin.h"
|
||||
#include <evntprov.h>
|
||||
|
||||
/* Generated from ETWProvider.man */
|
||||
#include "ETWProvider.h"
|
||||
#endif
|
||||
|
||||
#include "jsapi.h"
|
||||
#include "jsutil.h"
|
||||
#include "jsatom.h"
|
||||
@ -180,3 +188,243 @@ Probes::stopProfiling()
|
||||
Shark::Stop();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#ifdef MOZ_ETW
|
||||
/*
|
||||
* ETW (Event Tracing for Windows)
|
||||
*
|
||||
* These are here rather than in the .h file to avoid having to include
|
||||
* windows.h in a header.
|
||||
*/
|
||||
bool
|
||||
Probes::ETWCallTrackingActive(JSContext *cx)
|
||||
{
|
||||
return MCGEN_ENABLE_CHECK(MozillaSpiderMonkey_Context, EvtFunctionEntry);
|
||||
}
|
||||
|
||||
bool
|
||||
Probes::ETWCreateRuntime(JSRuntime *rt)
|
||||
{
|
||||
static bool registered = false;
|
||||
if (!registered) {
|
||||
EventRegisterMozillaSpiderMonkey();
|
||||
registered = true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
Probes::ETWDestroyRuntime(JSRuntime *rt)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
Probes::ETWShutdown()
|
||||
{
|
||||
EventUnregisterMozillaSpiderMonkey();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
Probes::ETWEnterJSFun(JSContext *cx, JSFunction *fun, JSScript *script, int counter)
|
||||
{
|
||||
int lineno = script ? script->lineno : -1;
|
||||
JSAutoByteString bytes;
|
||||
return (EventWriteEvtFunctionEntry(ScriptFilename(script), lineno,
|
||||
ObjectClassname((JSObject *)fun),
|
||||
FunctionName(cx, fun, &bytes)) == ERROR_SUCCESS);
|
||||
}
|
||||
|
||||
bool
|
||||
Probes::ETWExitJSFun(JSContext *cx, JSFunction *fun, JSScript *script, int counter)
|
||||
{
|
||||
int lineno = script ? script->lineno : -1;
|
||||
JSAutoByteString bytes;
|
||||
return (EventWriteEvtFunctionExit(ScriptFilename(script), lineno,
|
||||
ObjectClassname((JSObject *)fun),
|
||||
FunctionName(cx, fun, &bytes)) == ERROR_SUCCESS);
|
||||
}
|
||||
|
||||
bool
|
||||
Probes::ETWCreateObject(JSContext *cx, JSObject *obj)
|
||||
{
|
||||
int lineno;
|
||||
const char * script_filename;
|
||||
current_location(cx, &lineno, &script_filename);
|
||||
|
||||
return EventWriteEvtObjectCreate(script_filename, lineno,
|
||||
ObjectClassname(obj), reinterpret_cast<JSUint64>(obj),
|
||||
obj ? obj->slotsAndStructSize() : 0) == ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
bool
|
||||
Probes::ETWFinalizeObject(JSObject *obj)
|
||||
{
|
||||
return EventWriteEvtObjectFinalize(ObjectClassname(obj),
|
||||
reinterpret_cast<JSUint64>(obj)) == ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
bool
|
||||
Probes::ETWResizeObject(JSContext *cx, JSObject *obj, size_t oldSize, size_t newSize)
|
||||
{
|
||||
int lineno;
|
||||
const char *script_filename;
|
||||
current_location(cx, &lineno, &script_filename);
|
||||
|
||||
return EventWriteEvtObjectResize(script_filename, lineno,
|
||||
ObjectClassname(obj), reinterpret_cast<JSUint64>(obj),
|
||||
oldSize, newSize) == ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
bool
|
||||
Probes::ETWCreateString(JSContext *cx, JSString *string, size_t length)
|
||||
{
|
||||
int lineno;
|
||||
const char *script_filename;
|
||||
current_location(cx, &lineno, &script_filename);
|
||||
|
||||
return EventWriteEvtStringCreate(script_filename, lineno,
|
||||
reinterpret_cast<JSUint64>(string), length) == ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
bool
|
||||
Probes::ETWFinalizeString(JSString *string)
|
||||
{
|
||||
return EventWriteEvtStringFinalize(reinterpret_cast<JSUint64>(string), string->length()) == ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
bool
|
||||
Probes::ETWCompileScriptBegin(const char *filename, int lineno)
|
||||
{
|
||||
return EventWriteEvtScriptCompileBegin(filename, lineno) == ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
bool
|
||||
Probes::ETWCompileScriptEnd(const char *filename, int lineno)
|
||||
{
|
||||
return EventWriteEvtScriptCompileEnd(filename, lineno) == ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
bool
|
||||
Probes::ETWCalloutBegin(JSContext *cx, JSFunction *fun)
|
||||
{
|
||||
const char *script_filename;
|
||||
int lineno;
|
||||
JSAutoByteString bytes;
|
||||
current_location(cx, &lineno, &script_filename);
|
||||
|
||||
return EventWriteEvtCalloutBegin(script_filename,
|
||||
lineno,
|
||||
ObjectClassname((JSObject *)fun),
|
||||
FunctionName(cx, fun, &bytes)) == ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
bool
|
||||
Probes::ETWCalloutEnd(JSContext *cx, JSFunction *fun)
|
||||
{
|
||||
const char *script_filename;
|
||||
int lineno;
|
||||
JSAutoByteString bytes;
|
||||
current_location(cx, &lineno, &script_filename);
|
||||
|
||||
return EventWriteEvtCalloutEnd(script_filename,
|
||||
lineno,
|
||||
ObjectClassname((JSObject *)fun),
|
||||
FunctionName(cx, fun, &bytes)) == ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
bool
|
||||
Probes::ETWAcquireMemory(JSContext *cx, void *address, size_t nbytes)
|
||||
{
|
||||
return EventWriteEvtMemoryAcquire(reinterpret_cast<JSUint64>(cx->compartment),
|
||||
reinterpret_cast<JSUint64>(address),
|
||||
nbytes) == ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
bool
|
||||
Probes::ETWReleaseMemory(JSContext *cx, void *address, size_t nbytes)
|
||||
{
|
||||
return EventWriteEvtMemoryRelease(reinterpret_cast<JSUint64>(cx->compartment),
|
||||
reinterpret_cast<JSUint64>(address),
|
||||
nbytes) == ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
bool
|
||||
Probes::ETWGCStart(JSCompartment *compartment)
|
||||
{
|
||||
return EventWriteEvtGCStart(reinterpret_cast<JSUint64>(compartment)) == ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
bool
|
||||
Probes::ETWGCEnd(JSCompartment *compartment)
|
||||
{
|
||||
return EventWriteEvtGCEnd(reinterpret_cast<JSUint64>(compartment)) == ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
bool
|
||||
Probes::ETWGCStartMarkPhase(JSCompartment *compartment)
|
||||
{
|
||||
return EventWriteEvtGCStartMarkPhase(reinterpret_cast<JSUint64>(compartment)) == ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
bool
|
||||
Probes::ETWGCEndMarkPhase(JSCompartment *compartment)
|
||||
{
|
||||
return EventWriteEvtGCEndMarkPhase(reinterpret_cast<JSUint64>(compartment)) == ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
bool
|
||||
Probes::ETWGCStartSweepPhase(JSCompartment *compartment)
|
||||
{
|
||||
return EventWriteEvtGCStartSweepPhase(reinterpret_cast<JSUint64>(compartment)) == ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
bool
|
||||
Probes::ETWGCEndSweepPhase(JSCompartment *compartment)
|
||||
{
|
||||
return EventWriteEvtGCEndSweepPhase(reinterpret_cast<JSUint64>(compartment)) == ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
bool
|
||||
Probes::ETWCustomMark(JSString *string)
|
||||
{
|
||||
const jschar *chars = string->getCharsZ(NULL);
|
||||
return !chars || EventWriteEvtCustomString(chars) == ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
bool
|
||||
Probes::ETWCustomMark(const char *string)
|
||||
{
|
||||
return EventWriteEvtCustomANSIString(string) == ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
bool
|
||||
Probes::ETWCustomMark(int marker)
|
||||
{
|
||||
return EventWriteEvtCustomInt(marker) == ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
bool
|
||||
Probes::ETWStartExecution(JSContext *cx, JSScript *script)
|
||||
{
|
||||
int lineno = script ? script->lineno : -1;
|
||||
return EventWriteEvtExecuteStart(ScriptFilename(script), lineno) == ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
bool
|
||||
Probes::ETWStopExecution(JSContext *cx, JSScript *script)
|
||||
{
|
||||
int lineno = script ? script->lineno : -1;
|
||||
return EventWriteEvtExecuteDone(ScriptFilename(script), lineno) == ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
bool
|
||||
Probes::ETWResizeHeap(JSCompartment *compartment, size_t oldSize, size_t newSize)
|
||||
{
|
||||
return EventWriteEvtHeapResize(reinterpret_cast<JSUint64>(compartment),
|
||||
oldSize, newSize) == ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -44,14 +44,6 @@
|
||||
|
||||
namespace js {
|
||||
|
||||
#ifdef MOZ_ETW
|
||||
#include "jswin.h"
|
||||
#include <evntprov.h>
|
||||
|
||||
/* Generated from ETWProvider.man */
|
||||
#include "ETWProvider.h"
|
||||
#endif
|
||||
|
||||
class Probes {
|
||||
static bool ProfilingActive;
|
||||
static bool controlProfilers(JSContext *cx, bool toState);
|
||||
@ -99,6 +91,10 @@ class Probes {
|
||||
static void handleFunctionReturn(JSContext *cx, JSFunction *fun, JSScript *script);
|
||||
static void finalizeObjectImpl(JSObject *obj);
|
||||
public:
|
||||
static bool createRuntime(JSRuntime *rt);
|
||||
static bool destroyRuntime(JSRuntime *rt);
|
||||
static bool shutdown();
|
||||
|
||||
/*
|
||||
* Pause/resume whatever profiling mechanism is currently compiled
|
||||
* in, if applicable. This will not affect things like dtrace.
|
||||
@ -176,8 +172,74 @@ class Probes {
|
||||
|
||||
static bool startProfiling();
|
||||
static void stopProfiling();
|
||||
|
||||
#ifdef MOZ_ETW
|
||||
// ETW Handlers
|
||||
static bool ETWCreateRuntime(JSRuntime *rt);
|
||||
static bool ETWDestroyRuntime(JSRuntime *rt);
|
||||
static bool ETWShutdown();
|
||||
static bool ETWCallTrackingActive(JSContext *cx);
|
||||
static bool ETWEnterJSFun(JSContext *cx, JSFunction *fun, JSScript *script, int counter);
|
||||
static bool ETWExitJSFun(JSContext *cx, JSFunction *fun, JSScript *script, int counter);
|
||||
static bool ETWCreateObject(JSContext *cx, JSObject *obj);
|
||||
static bool ETWFinalizeObject(JSObject *obj);
|
||||
static bool ETWResizeObject(JSContext *cx, JSObject *obj, size_t oldSize, size_t newSize);
|
||||
static bool ETWCreateString(JSContext *cx, JSString *string, size_t length);
|
||||
static bool ETWFinalizeString(JSString *string);
|
||||
static bool ETWCompileScriptBegin(const char *filename, int lineno);
|
||||
static bool ETWCompileScriptEnd(const char *filename, int lineno);
|
||||
static bool ETWCalloutBegin(JSContext *cx, JSFunction *fun);
|
||||
static bool ETWCalloutEnd(JSContext *cx, JSFunction *fun);
|
||||
static bool ETWAcquireMemory(JSContext *cx, void *address, size_t nbytes);
|
||||
static bool ETWReleaseMemory(JSContext *cx, void *address, size_t nbytes);
|
||||
static bool ETWGCStart(JSCompartment *compartment);
|
||||
static bool ETWGCEnd(JSCompartment *compartment);
|
||||
static bool ETWGCStartMarkPhase(JSCompartment *compartment);
|
||||
static bool ETWGCEndMarkPhase(JSCompartment *compartment);
|
||||
static bool ETWGCStartSweepPhase(JSCompartment *compartment);
|
||||
static bool ETWGCEndSweepPhase(JSCompartment *compartment);
|
||||
static bool ETWCustomMark(JSString *string);
|
||||
static bool ETWCustomMark(const char *string);
|
||||
static bool ETWCustomMark(int marker);
|
||||
static bool ETWStartExecution(JSContext *cx, JSScript *script);
|
||||
static bool ETWStopExecution(JSContext *cx, JSScript *script);
|
||||
static bool ETWResizeHeap(JSCompartment *compartment, size_t oldSize, size_t newSize);
|
||||
#endif
|
||||
};
|
||||
|
||||
inline bool
|
||||
Probes::createRuntime(JSRuntime *rt)
|
||||
{
|
||||
bool ok = true;
|
||||
#ifdef MOZ_ETW
|
||||
if (!ETWCreateRuntime(rt))
|
||||
ok = false;
|
||||
#endif
|
||||
return ok;
|
||||
}
|
||||
|
||||
inline bool
|
||||
Probes::destroyRuntime(JSRuntime *rt)
|
||||
{
|
||||
bool ok = true;
|
||||
#ifdef MOZ_ETW
|
||||
if (!ETWDestroyRuntime(rt))
|
||||
ok = false;
|
||||
#endif
|
||||
return ok;
|
||||
}
|
||||
|
||||
inline bool
|
||||
Probes::shutdown()
|
||||
{
|
||||
bool ok = true;
|
||||
#ifdef MOZ_ETW
|
||||
if (!ETWShutdown())
|
||||
ok = false;
|
||||
#endif
|
||||
return ok;
|
||||
}
|
||||
|
||||
inline bool
|
||||
Probes::callTrackingActive(JSContext *cx)
|
||||
{
|
||||
@ -190,7 +252,7 @@ Probes::callTrackingActive(JSContext *cx)
|
||||
return true;
|
||||
#endif
|
||||
#ifdef MOZ_ETW
|
||||
if (ProfilingActive && MCGEN_ENABLE_CHECK(MozillaSpiderMonkey_Context, EvtFunctionEntry))
|
||||
if (ProfilingActive && ETWCallTrackingActive(cx))
|
||||
return true;
|
||||
#endif
|
||||
return false;
|
||||
@ -225,15 +287,8 @@ Probes::enterJSFun(JSContext *cx, JSFunction *fun, JSScript *script, int counter
|
||||
cx->doFunctionCallback(fun, script, counter);
|
||||
#endif
|
||||
#ifdef MOZ_ETW
|
||||
if (ProfilingActive) {
|
||||
JSScript* script = fun ? FUN_SCRIPT(fun) : NULL;
|
||||
int lineno = script ? script->lineno : -1;
|
||||
JSAutoByteString bytes;
|
||||
if (EventWriteEvtFunctionEntry(ScriptFilename(script), lineno,
|
||||
ObjectClassname((JSObject *)fun),
|
||||
FunctionName(cx, fun, &bytes)) != ERROR_SUCCESS)
|
||||
ok = false;
|
||||
}
|
||||
if (ProfilingActive && !ETWEnterJSFun(cx, fun, script, counter))
|
||||
ok = false;
|
||||
#endif
|
||||
|
||||
return ok;
|
||||
@ -254,15 +309,8 @@ Probes::exitJSFun(JSContext *cx, JSFunction *fun, JSScript *script, int counter)
|
||||
cx->doFunctionCallback(fun, script, counter);
|
||||
#endif
|
||||
#ifdef MOZ_ETW
|
||||
if (ProfilingActive) {
|
||||
JSScript* script = fun ? FUN_SCRIPT(fun) : NULL;
|
||||
int lineno = script ? script->lineno : -1;
|
||||
JSAutoByteString bytes;
|
||||
if (EventWriteEvtFunctionExit(ScriptFilename(script), lineno,
|
||||
ObjectClassname((JSObject *)fun),
|
||||
FunctionName(cx, fun, &bytes)) != ERROR_SUCCESS)
|
||||
ok = false;
|
||||
}
|
||||
if (ProfilingActive && !ETWExitJSFun(cx, fun, script, counter))
|
||||
ok = false;
|
||||
#endif
|
||||
|
||||
return ok;
|
||||
@ -274,9 +322,8 @@ Probes::resizeHeap(JSCompartment *compartment, size_t oldSize, size_t newSize)
|
||||
bool ok = true;
|
||||
|
||||
#ifdef MOZ_ETW
|
||||
if (ProfilingActive)
|
||||
if (EventWriteEvtHeapResize(reinterpret_cast<JSUint64>(compartment), oldSize, newSize) != ERROR_SUCCESS)
|
||||
ok = false;
|
||||
if (ProfilingActive && !ETWResizeHeap(compartment, oldSize, newSize))
|
||||
ok = false;
|
||||
#endif
|
||||
|
||||
return ok;
|
||||
@ -292,16 +339,8 @@ Probes::createObject(JSContext *cx, JSObject *obj)
|
||||
JAVASCRIPT_OBJECT_CREATE(ObjectClassname(obj), (uintptr_t)obj);
|
||||
#endif
|
||||
#ifdef MOZ_ETW
|
||||
if (ProfilingActive) {
|
||||
int lineno;
|
||||
const char * script_filename;
|
||||
current_location(cx, &lineno, &script_filename);
|
||||
|
||||
if (EventWriteEvtObjectCreate(script_filename, lineno,
|
||||
ObjectClassname(obj), reinterpret_cast<JSUint64>(obj),
|
||||
obj ? obj->slotsAndStructSize() : 0) != ERROR_SUCCESS)
|
||||
ok = false;
|
||||
}
|
||||
if (ProfilingActive && !ETWCreateObject(cx, obj))
|
||||
ok = false;
|
||||
#endif
|
||||
|
||||
return ok;
|
||||
@ -321,10 +360,8 @@ Probes::finalizeObject(JSObject *obj)
|
||||
}
|
||||
#endif
|
||||
#ifdef MOZ_ETW
|
||||
if (ProfilingActive)
|
||||
if (EventWriteEvtObjectFinalize(ObjectClassname(obj),
|
||||
reinterpret_cast<JSUint64>(obj)) != ERROR_SUCCESS)
|
||||
ok = false;
|
||||
if (ProfilingActive && !ETWFinalizeObject(obj))
|
||||
ok = false;
|
||||
#endif
|
||||
|
||||
return ok;
|
||||
@ -336,16 +373,8 @@ Probes::resizeObject(JSContext *cx, JSObject *obj, size_t oldSize, size_t newSiz
|
||||
bool ok = true;
|
||||
|
||||
#ifdef MOZ_ETW
|
||||
if (ProfilingActive) {
|
||||
int lineno;
|
||||
const char *script_filename;
|
||||
current_location(cx, &lineno, &script_filename);
|
||||
|
||||
if (EventWriteEvtObjectResize(script_filename, lineno,
|
||||
ObjectClassname(obj), reinterpret_cast<JSUint64>(obj),
|
||||
oldSize, newSize) != ERROR_SUCCESS)
|
||||
ok = false;
|
||||
}
|
||||
if (ProfilingActive && !ETWResizeObject(cx, obj, oldSize, newSize))
|
||||
ok = false;
|
||||
#endif
|
||||
|
||||
return ok;
|
||||
@ -357,15 +386,8 @@ Probes::createString(JSContext *cx, JSString *string, size_t length)
|
||||
bool ok = true;
|
||||
|
||||
#ifdef MOZ_ETW
|
||||
if (ProfilingActive) {
|
||||
int lineno;
|
||||
const char *script_filename;
|
||||
current_location(cx, &lineno, &script_filename);
|
||||
|
||||
if (EventWriteEvtStringCreate(script_filename, lineno,
|
||||
reinterpret_cast<JSUint64>(string), length) != ERROR_SUCCESS)
|
||||
ok = 0;
|
||||
}
|
||||
if (ProfilingActive && !ETWCreateString(cx, string, length))
|
||||
ok = false;
|
||||
#endif
|
||||
|
||||
return ok;
|
||||
@ -377,9 +399,8 @@ Probes::finalizeString(JSString *string)
|
||||
bool ok = true;
|
||||
|
||||
#ifdef MOZ_ETW
|
||||
if (ProfilingActive)
|
||||
if (EventWriteEvtStringFinalize(reinterpret_cast<JSUint64>(string), string->length()) != ERROR_SUCCESS)
|
||||
ok = false;
|
||||
if (ProfilingActive && !ETWFinalizeString(string))
|
||||
ok = false;
|
||||
#endif
|
||||
|
||||
return ok;
|
||||
@ -391,9 +412,8 @@ Probes::compileScriptBegin(JSContext *cx, const char *filename, int lineno)
|
||||
bool ok = true;
|
||||
|
||||
#ifdef MOZ_ETW
|
||||
if (ProfilingActive)
|
||||
if (EventWriteEvtScriptCompileBegin(filename, lineno) != ERROR_SUCCESS)
|
||||
ok = false;
|
||||
if (ProfilingActive && !ETWCompileScriptBegin(filename, lineno))
|
||||
ok = false;
|
||||
#endif
|
||||
|
||||
return ok;
|
||||
@ -405,9 +425,8 @@ Probes::compileScriptEnd(JSContext *cx, JSScript *script, const char *filename,
|
||||
bool ok = true;
|
||||
|
||||
#ifdef MOZ_ETW
|
||||
if (ProfilingActive)
|
||||
if (EventWriteEvtScriptCompileEnd(filename, lineno) != ERROR_SUCCESS)
|
||||
ok = false;
|
||||
if (ProfilingActive && !ETWCompileScriptEnd(filename, lineno))
|
||||
ok = false;
|
||||
#endif
|
||||
|
||||
return ok;
|
||||
@ -419,18 +438,8 @@ Probes::calloutBegin(JSContext *cx, JSFunction *fun)
|
||||
bool ok = true;
|
||||
|
||||
#ifdef MOZ_ETW
|
||||
if (ProfilingActive) {
|
||||
const char *script_filename;
|
||||
int lineno;
|
||||
JSAutoByteString bytes;
|
||||
current_location(cx, &lineno, &script_filename);
|
||||
|
||||
if (EventWriteEvtCalloutBegin(script_filename,
|
||||
lineno,
|
||||
ObjectClassname((JSObject *)fun),
|
||||
FunctionName(cx, fun, &bytes)) != ERROR_SUCCESS)
|
||||
ok = false;
|
||||
}
|
||||
if (ProfilingActive && !ETWCalloutBegin(cx, fun))
|
||||
ok = false;
|
||||
#endif
|
||||
|
||||
return ok;
|
||||
@ -442,18 +451,8 @@ Probes::calloutEnd(JSContext *cx, JSFunction *fun)
|
||||
bool ok = true;
|
||||
|
||||
#ifdef MOZ_ETW
|
||||
if (ProfilingActive) {
|
||||
const char *script_filename;
|
||||
int lineno;
|
||||
JSAutoByteString bytes;
|
||||
current_location(cx, &lineno, &script_filename);
|
||||
|
||||
if (EventWriteEvtCalloutEnd(script_filename,
|
||||
lineno,
|
||||
ObjectClassname((JSObject *)fun),
|
||||
FunctionName(cx, fun, &bytes)) != ERROR_SUCCESS)
|
||||
ok = false;
|
||||
}
|
||||
if (ProfilingActive && !ETWCalloutEnd(cx, fun))
|
||||
ok = false;
|
||||
#endif
|
||||
|
||||
return ok;
|
||||
@ -465,11 +464,8 @@ Probes::acquireMemory(JSContext *cx, void *address, size_t nbytes)
|
||||
bool ok = true;
|
||||
|
||||
#ifdef MOZ_ETW
|
||||
if (ProfilingActive)
|
||||
if (EventWriteEvtMemoryAcquire(reinterpret_cast<JSUint64>(cx->compartment),
|
||||
reinterpret_cast<JSUint64>(address),
|
||||
nbytes) != ERROR_SUCCESS)
|
||||
ok = false;
|
||||
if (ProfilingActive && !ETWAcquireMemory(cx, address, nbytes))
|
||||
ok = false;
|
||||
#endif
|
||||
|
||||
return ok;
|
||||
@ -481,11 +477,8 @@ Probes::releaseMemory(JSContext *cx, void *address, size_t nbytes)
|
||||
bool ok = true;
|
||||
|
||||
#ifdef MOZ_ETW
|
||||
if (ProfilingActive)
|
||||
if (EventWriteEvtMemoryRelease(reinterpret_cast<JSUint64>(cx->compartment),
|
||||
reinterpret_cast<JSUint64>(address),
|
||||
nbytes) != ERROR_SUCCESS)
|
||||
ok = false;
|
||||
if (ProfilingActive && !ETWReleaseMemory(cx, address, nbytes))
|
||||
ok = false;
|
||||
#endif
|
||||
|
||||
return ok;
|
||||
@ -497,9 +490,8 @@ Probes::GCStart(JSCompartment *compartment)
|
||||
bool ok = true;
|
||||
|
||||
#ifdef MOZ_ETW
|
||||
if (ProfilingActive)
|
||||
if (EventWriteEvtGCStart(reinterpret_cast<JSUint64>(compartment)) != ERROR_SUCCESS)
|
||||
ok = false;
|
||||
if (ProfilingActive && !ETWGCStart(compartment))
|
||||
ok = false;
|
||||
#endif
|
||||
|
||||
return ok;
|
||||
@ -511,9 +503,8 @@ Probes::GCEnd(JSCompartment *compartment)
|
||||
bool ok = true;
|
||||
|
||||
#ifdef MOZ_ETW
|
||||
if (ProfilingActive)
|
||||
if (EventWriteEvtGCEnd(reinterpret_cast<JSUint64>(compartment)) != ERROR_SUCCESS)
|
||||
ok = false;
|
||||
if (ProfilingActive && !ETWGCEnd(compartment))
|
||||
ok = false;
|
||||
#endif
|
||||
|
||||
return ok;
|
||||
@ -525,9 +516,8 @@ Probes::GCStartMarkPhase(JSCompartment *compartment)
|
||||
bool ok = true;
|
||||
|
||||
#ifdef MOZ_ETW
|
||||
if (ProfilingActive)
|
||||
if (EventWriteEvtGCStartMarkPhase(reinterpret_cast<JSUint64>(compartment)) != ERROR_SUCCESS)
|
||||
ok = false;
|
||||
if (ProfilingActive && !ETWGCStartMarkPhase(compartment))
|
||||
ok = false;
|
||||
#endif
|
||||
|
||||
return ok;
|
||||
@ -539,9 +529,8 @@ Probes::GCEndMarkPhase(JSCompartment *compartment)
|
||||
bool ok = true;
|
||||
|
||||
#ifdef MOZ_ETW
|
||||
if (ProfilingActive)
|
||||
if (EventWriteEvtGCEndMarkPhase(reinterpret_cast<JSUint64>(compartment)) != ERROR_SUCCESS)
|
||||
ok = false;
|
||||
if (ProfilingActive && !ETWGCEndMarkPhase(compartment))
|
||||
ok = false;
|
||||
#endif
|
||||
|
||||
return ok;
|
||||
@ -553,9 +542,8 @@ Probes::GCStartSweepPhase(JSCompartment *compartment)
|
||||
bool ok = true;
|
||||
|
||||
#ifdef MOZ_ETW
|
||||
if (ProfilingActive)
|
||||
if (EventWriteEvtGCStartSweepPhase(reinterpret_cast<JSUint64>(compartment)) != ERROR_SUCCESS)
|
||||
ok = false;
|
||||
if (ProfilingActive && !ETWGCStartSweepPhase(compartment))
|
||||
ok = false;
|
||||
#endif
|
||||
|
||||
return ok;
|
||||
@ -567,9 +555,8 @@ Probes::GCEndSweepPhase(JSCompartment *compartment)
|
||||
bool ok = true;
|
||||
|
||||
#ifdef MOZ_ETW
|
||||
if (ProfilingActive)
|
||||
if (EventWriteEvtGCEndSweepPhase(reinterpret_cast<JSUint64>(compartment)) != ERROR_SUCCESS)
|
||||
ok = false;
|
||||
if (ProfilingActive && !ETWGCEndSweepPhase(compartment))
|
||||
ok = false;
|
||||
#endif
|
||||
|
||||
return ok;
|
||||
@ -581,11 +568,8 @@ Probes::CustomMark(JSString *string)
|
||||
bool ok = true;
|
||||
|
||||
#ifdef MOZ_ETW
|
||||
if (ProfilingActive) {
|
||||
const jschar *chars = string->getCharsZ(NULL);
|
||||
if (!chars || EventWriteEvtCustomString(chars) != ERROR_SUCCESS)
|
||||
ok = false;
|
||||
}
|
||||
if (ProfilingActive && !ETWCustomMark(string))
|
||||
ok = false;
|
||||
#endif
|
||||
|
||||
return ok;
|
||||
@ -597,9 +581,8 @@ Probes::CustomMark(const char *string)
|
||||
bool ok = true;
|
||||
|
||||
#ifdef MOZ_ETW
|
||||
if (ProfilingActive)
|
||||
if (EventWriteEvtCustomANSIString(string) != ERROR_SUCCESS)
|
||||
ok = false;
|
||||
if (ProfilingActive && !ETWCustomMark(string))
|
||||
ok = false;
|
||||
#endif
|
||||
|
||||
return ok;
|
||||
@ -611,9 +594,8 @@ Probes::CustomMark(int marker)
|
||||
bool ok = true;
|
||||
|
||||
#ifdef MOZ_ETW
|
||||
if (ProfilingActive)
|
||||
if (EventWriteEvtCustomInt(marker) != ERROR_SUCCESS)
|
||||
ok = false;
|
||||
if (ProfilingActive && !ETWCustomMark(marker))
|
||||
ok = false;
|
||||
#endif
|
||||
|
||||
return ok;
|
||||
@ -630,11 +612,8 @@ Probes::startExecution(JSContext *cx, JSScript *script)
|
||||
script->lineno);
|
||||
#endif
|
||||
#ifdef MOZ_ETW
|
||||
if (ProfilingActive) {
|
||||
int lineno = script ? script->lineno : -1;
|
||||
if (EventWriteEvtExecuteStart(ScriptFilename(script), lineno) != ERROR_SUCCESS)
|
||||
ok = false;
|
||||
}
|
||||
if (ProfilingActive && !ETWStartExecution(cx, script))
|
||||
ok = false;
|
||||
#endif
|
||||
|
||||
return ok;
|
||||
@ -651,11 +630,8 @@ Probes::stopExecution(JSContext *cx, JSScript *script)
|
||||
script->lineno);
|
||||
#endif
|
||||
#ifdef MOZ_ETW
|
||||
if (ProfilingActive) {
|
||||
int lineno = script ? script->lineno : -1;
|
||||
if (EventWriteEvtExecuteDone(ScriptFilename(script), lineno) != ERROR_SUCCESS)
|
||||
ok = false;
|
||||
}
|
||||
if (ProfilingActive && !ETWStopExecution(cx, script))
|
||||
ok = false;
|
||||
#endif
|
||||
|
||||
return ok;
|
||||
|
Loading…
Reference in New Issue
Block a user