Unbitrot JS_OPMETER (363529, r=shaver, a=beltzner/sayrer).

This commit is contained in:
brendan@mozilla.org 2008-02-28 16:29:59 -08:00
parent 49a25bd74b
commit fa4dcecfef
3 changed files with 9 additions and 8 deletions

View File

@ -2196,9 +2196,9 @@ UnwindScope(JSContext *cx, JSStackFrame *fp, jsint stackDepth,
* are written to JS_OPMETER_HIST, defaulting to /tmp/ops.hist.
*/
#ifndef JS_OPMETER
# define METER_OP_INIT(op) /* nothing */
# define METER_OP_PAIR(op1,op2) /* nothing */
# define METER_SLOT_OP(op,slot) /* nothing */
# define METER_OP_INIT(op) ((void)0)
# define METER_OP_PAIR(op1,op2) ((void)0)
# define METER_SLOT_OP(op,slot) ((void)0)
#else
# include <stdlib.h>
@ -2264,12 +2264,12 @@ js_DumpOpMeters()
graph = (Edge *) calloc(nedges, sizeof graph[0]);
for (i = nedges = 0; i < JSOP_LIMIT; i++) {
from = js_CodeSpec[i].name;
from = js_CodeName[i];
for (j = 0; j < JSOP_LIMIT; j++) {
count = succeeds[i][j];
if (count != 0 && SIGNIFICANT(count, total)) {
graph[nedges].from = from;
graph[nedges].to = js_CodeSpec[j].name;
graph[nedges].to = js_CodeName[j];
graph[nedges].count = count;
++nedges;
}
@ -2315,7 +2315,7 @@ js_DumpOpMeters()
for (j = 0; j < HIST_NSLOTS; j++) {
if (slot_ops[i][j] != 0) {
/* Reuse j in the next loop, since we break after. */
fprintf(fp, "%-8.8s", js_CodeSpec[i].name);
fprintf(fp, "%-8.8s", js_CodeName[i]);
for (j = 0; j < HIST_NSLOTS; j++)
fprintf(fp, " %7lu", (unsigned long)slot_ops[i][j]);
putc('\n', fp);

View File

@ -101,7 +101,7 @@ static const char *CodeToken[] = {
/*
* Array of JS bytecode names used by DEBUG-only js_Disassemble.
*/
static const char *CodeName[] = {
const char *js_CodeName[] = {
#define OPDEF(op,val,name,token,length,nuses,ndefs,prec,format) \
name,
#include "jsopcode.tbl"
@ -238,7 +238,7 @@ js_Disassemble1(JSContext *cx, JSScript *script, jsbytecode *pc,
fprintf(fp, "%05u:", loc);
if (lines)
fprintf(fp, "%4u", JS_PCToLineNumber(cx, script, pc));
fprintf(fp, " %s", CodeName[op]);
fprintf(fp, " %s", js_CodeName[op]);
type = JOF_TYPE(cs->format);
switch (type) {
case JOF_BYTE:

View File

@ -260,6 +260,7 @@ struct JSCodeSpec {
extern const JSCodeSpec js_CodeSpec[];
extern uintN js_NumCodeSpecs;
extern const char *js_CodeName[];
extern const char js_EscapeMap[];
/*