Bug 546491 - fix tracevis (r=jorendorff)

This commit is contained in:
Luke Wagner 2010-02-16 13:41:40 -08:00
parent 17ec73c38c
commit 87a5e61db3
7 changed files with 25 additions and 23 deletions

View File

@ -765,7 +765,7 @@ JS_PUBLIC_API(void)
JS_ShutDown(void)
{
#ifdef MOZ_TRACEVIS
JS_StopTraceVis();
StopTraceVis();
#endif
#ifdef JS_OPMETER

View File

@ -2302,7 +2302,7 @@ jstv_Lineno(JSContext *cx, JSStackFrame *fp)
/* Collect states here and distribute to a matching buffer, if any */
JS_FRIEND_API(void)
js_StoreTraceVisState(JSContext *cx, TraceVisState s, TraceVisExitReason r)
js::StoreTraceVisState(JSContext *cx, TraceVisState s, TraceVisExitReason r)
{
JSStackFrame *fp = cx->fp;

View File

@ -2906,12 +2906,12 @@ js_Interpret(JSContext *cx)
#define MONITOR_BRANCH_TRACEVIS \
JS_BEGIN_MACRO \
if (jumpTable != interruptJumpTable) \
js_EnterTraceVisState(cx, S_RECORD, R_NONE); \
EnterTraceVisState(cx, S_RECORD, R_NONE); \
JS_END_MACRO
#else /* !JS_THREADED_INTERP */
#define MONITOR_BRANCH_TRACEVIS \
JS_BEGIN_MACRO \
js_EnterTraceVisState(cx, S_RECORD, R_NONE); \
EnterTraceVisState(cx, S_RECORD, R_NONE); \
JS_END_MACRO
#endif
#else

View File

@ -102,7 +102,7 @@
#if JS_THREADED_INTERP
#ifdef MOZ_TRACEVIS
if (!moreInterrupts)
js_ExitTraceVisState(cx, R_ABORT);
ExitTraceVisState(cx, R_ABORT);
#endif
jumpTable = moreInterrupts ? interruptJumpTable : normalJumpTable;
JS_EXTENSION_(goto *normalJumpTable[op]);

View File

@ -15233,11 +15233,11 @@ FILE* traceVisLogFile = NULL;
JSHashTable *traceVisScriptTable = NULL;
JS_FRIEND_API(bool)
JS_StartTraceVis(const char* filename = "tracevis.dat")
StartTraceVis(const char* filename = "tracevis.dat")
{
if (traceVisLogFile) {
// If we're currently recording, first we must stop.
JS_StopTraceVis();
StopTraceVis();
}
traceVisLogFile = fopen(filename, "wb");
@ -15248,7 +15248,7 @@ JS_StartTraceVis(const char* filename = "tracevis.dat")
}
JS_FRIEND_API(JSBool)
StartTraceVis(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
StartTraceVisNative(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
JSBool ok;
@ -15257,10 +15257,10 @@ StartTraceVis(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval
char *filename = js_DeflateString(cx, str->chars(), str->length());
if (!filename)
goto error;
ok = JS_StartTraceVis(filename);
ok = StartTraceVis(filename);
cx->free(filename);
} else {
ok = JS_StartTraceVis();
ok = StartTraceVis();
}
if (ok) {
@ -15274,7 +15274,7 @@ StartTraceVis(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval
}
JS_FRIEND_API(bool)
JS_StopTraceVis()
StopTraceVis()
{
if (!traceVisLogFile)
return false;
@ -15286,9 +15286,9 @@ JS_StopTraceVis()
}
JS_FRIEND_API(JSBool)
StopTraceVis(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
StopTraceVisNative(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
JSBool ok = JS_StopTraceVis();
JSBool ok = StopTraceVis();
if (ok)
fprintf(stderr, "stopped TraceVis recording\n");

View File

@ -1517,19 +1517,22 @@ SetMaxCodeCacheBytes(JSContext* cx, uint32 bytes);
extern bool
NativeToValue(JSContext* cx, jsval& v, TraceType type, double* slot);
extern jsval *
ConcatPostImacroStackCleanup(uint32 argc, JSFrameRegs &regs,
TraceRecorder *recorder);
#ifdef MOZ_TRACEVIS
extern JS_FRIEND_API(bool)
JS_StartTraceVis(const char* filename);
StartTraceVis(const char* filename);
extern JS_FRIEND_API(JSBool)
StartTraceVis(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
StartTraceVisNative(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
extern JS_FRIEND_API(bool)
JS_StopTraceVis();
StopTraceVis();
extern JS_FRIEND_API(JSBool)
StopTraceVis(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
StopTraceVisNative(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
/* Must contain no more than 16 items. */
enum TraceVisState {
@ -1645,9 +1648,6 @@ struct TraceVisStateObj {
#endif /* MOZ_TRACEVIS */
extern jsval *
ConcatPostImacroStackCleanup(uint32 argc, JSFrameRegs &regs,
TraceRecorder *recorder);
} /* namespace js */
#else /* !JS_TRACER */

View File

@ -97,6 +97,8 @@
#include <windows.h>
#endif
using namespace js;
typedef enum JSShellExitCode {
EXITCODE_RUNTIME_ERROR = 3,
EXITCODE_FILE_NOT_FOUND = 4,
@ -846,7 +848,7 @@ ProcessArgs(JSContext *cx, JSObject *obj, char **argv, int argc)
if (++i == argc)
return usage();
JS_StartTraceVis(argv[i]);
StartTraceVis(argv[i]);
break;
#endif
default:
@ -3773,8 +3775,8 @@ static JSFunctionSpec shell_functions[] = {
JS_FS("resumeVtune", js_ResumeVtune, 0,0,0),
#endif
#ifdef MOZ_TRACEVIS
JS_FS("startTraceVis", js_StartTraceVis, 1,0,0),
JS_FS("stopTraceVis", js_StopTraceVis, 0,0,0),
JS_FS("startTraceVis", StartTraceVisNative, 1,0,0),
JS_FS("stopTraceVis", StopTraceVisNative, 0,0,0),
#endif
#ifdef DEBUG_ARRAYS
JS_FS("arrayInfo", js_ArrayInfo, 1,0,0),