зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1839396 part 15 - Replace Sprinter::jsprintf. r=mgaudet
Sprinter::jsprintf is nowadays the same as GenericPrinter::printf which Sprinter inherit from. This patch removes all calls to Sprinter::jsprintf and replaces them by Sprinter::printf. The advantage of using GenericPrinter::printf is that this reduce the dependency on Sprinter-specific interface and moves us toward being able to move more consumers over to the GenericPrinter. Differential Revision: https://phabricator.services.mozilla.com/D181500
This commit is contained in:
Родитель
d7edbaecdd
Коммит
da63680af6
|
@ -17078,7 +17078,6 @@ neqo_http3conn_is_zero_rtt
|
|||
?ClassName@js@@YA?AV?$Handle@PAVPropertyName@js@@@JS@@W4JSProtoKey@@PAUJSContext@@@Z
|
||||
?FormatStackDump@JS@@YA?AV?$UniquePtr@$$BY0A@DUFreePolicy@JS@@@mozilla@@PAUJSContext@@_N11@Z
|
||||
?callee@FrameIter@js@@QBEPAVJSFunction@@PAUJSContext@@@Z
|
||||
?jsprintf@Sprinter@js@@QAA_NPBDZZ
|
||||
?vprintf@GenericPrinter@js@@QAE_NPBDPAD@Z
|
||||
?release@Sprinter@js@@QAE?AV?$UniquePtr@$$BY0A@DUFreePolicy@JS@@@mozilla@@XZ
|
||||
??1Sprinter@js@@QAE@XZ
|
||||
|
|
|
@ -16849,7 +16849,6 @@ neqo_http3conn_is_zero_rtt
|
|||
?ClassName@js@@YA?AV?$Handle@PEAVPropertyName@js@@@JS@@W4JSProtoKey@@PEAUJSContext@@@Z
|
||||
?FormatStackDump@JS@@YA?AV?$UniquePtr@$$BY0A@DUFreePolicy@JS@@@mozilla@@PEAUJSContext@@_N11@Z
|
||||
?callee@FrameIter@js@@QEBAPEAVJSFunction@@PEAUJSContext@@@Z
|
||||
?jsprintf@Sprinter@js@@QEAA_NPEBDZZ
|
||||
?vprintf@GenericPrinter@js@@QEAA_NPEBDPEAD@Z
|
||||
?release@Sprinter@js@@QEAA?AV?$UniquePtr@$$BY0A@DUFreePolicy@JS@@@mozilla@@XZ
|
||||
??1Sprinter@js@@QEAA@XZ
|
||||
|
|
|
@ -143,11 +143,6 @@ class JS_PUBLIC_API Sprinter final : public GenericPrinter {
|
|||
}
|
||||
virtual size_t index() const override { return length(); }
|
||||
|
||||
// Format the given format/arguments as if by JS_vsmprintf, then put it.
|
||||
// Return true on success, else return false and report an error (typically
|
||||
// OOM).
|
||||
void jsprintf(const char* fmt, ...) MOZ_FORMAT_PRINTF(2, 3);
|
||||
|
||||
void putString(JSString* str);
|
||||
|
||||
size_t length() const;
|
||||
|
|
|
@ -1656,8 +1656,8 @@ static bool DisassembleNative(JSContext* cx, unsigned argc, Value* vp) {
|
|||
if (fun->isAsmJSNative()) {
|
||||
return false;
|
||||
}
|
||||
sprinter.jsprintf("; backend=asmjs\n");
|
||||
sprinter.jsprintf("; backend=wasm\n");
|
||||
sprinter.printf("; backend=asmjs\n");
|
||||
sprinter.printf("; backend=wasm\n");
|
||||
|
||||
js::wasm::Instance& inst = fun->wasmInstance();
|
||||
const js::wasm::Code& code = inst.code();
|
||||
|
@ -1683,11 +1683,11 @@ static bool DisassembleNative(JSContext* cx, unsigned argc, Value* vp) {
|
|||
js::jit::BaselineScript* baseline =
|
||||
script->hasBaselineScript() ? script->baselineScript() : nullptr;
|
||||
if (ion && ion->method()) {
|
||||
sprinter.jsprintf("; backend=ion\n");
|
||||
sprinter.printf("; backend=ion\n");
|
||||
jit_begin = ion->method()->raw();
|
||||
jit_end = ion->method()->rawEnd();
|
||||
} else if (baseline) {
|
||||
sprinter.jsprintf("; backend=baseline\n");
|
||||
sprinter.printf("; backend=baseline\n");
|
||||
jit_begin = baseline->method()->raw();
|
||||
jit_end = baseline->method()->rawEnd();
|
||||
}
|
||||
|
|
|
@ -924,7 +924,7 @@ void js::Nursery::printCollectionProfile(JS::GCReason reason,
|
|||
size_t dedupCount = stats().getStat(gcstats::STAT_STRINGS_DEDUPLICATED);
|
||||
|
||||
#define PRINT_FIELD_VALUE(_1, _2, format, value) \
|
||||
sprinter.jsprintf(" " format, value);
|
||||
sprinter.printf(" " format, value);
|
||||
|
||||
FOR_EACH_NURSERY_PROFILE_METADATA(PRINT_FIELD_VALUE)
|
||||
#undef PRINT_FIELD_VALUE
|
||||
|
@ -946,13 +946,13 @@ void js::Nursery::printProfileHeader() {
|
|||
sprinter.put(gcstats::MinorGCProfilePrefix);
|
||||
|
||||
#define PRINT_FIELD_NAME(name, width, _1, _2) \
|
||||
sprinter.jsprintf(" %-*s", width, name);
|
||||
sprinter.printf(" %-*s", width, name);
|
||||
|
||||
FOR_EACH_NURSERY_PROFILE_METADATA(PRINT_FIELD_NAME)
|
||||
#undef PRINT_FIELD_NAME
|
||||
|
||||
#define PRINT_PROFILE_NAME(_1, text) \
|
||||
sprinter.jsprintf(" %-6.6s", text);
|
||||
sprinter.printf(" %-6.6s", text);
|
||||
|
||||
FOR_EACH_NURSERY_PROFILE_TIME(PRINT_PROFILE_NAME)
|
||||
#undef PRINT_PROFILE_NAME
|
||||
|
@ -971,7 +971,7 @@ void js::Nursery::printProfileDurations(const ProfileDurations& times,
|
|||
Sprinter& sprinter) {
|
||||
for (auto time : times) {
|
||||
int64_t micros = int64_t(time.ToMicroseconds());
|
||||
sprinter.jsprintf(" %6" PRIi64, micros);
|
||||
sprinter.printf(" %6" PRIi64, micros);
|
||||
}
|
||||
|
||||
sprinter.put("\n");
|
||||
|
@ -1013,7 +1013,7 @@ void js::Nursery::printTotalProfileTimes() {
|
|||
MOZ_ASSERT(r > 0 && r < int(sizeof(collections)));
|
||||
|
||||
#define PRINT_FIELD_VALUE(_1, _2, format, value) \
|
||||
sprinter.jsprintf(" " format, value);
|
||||
sprinter.printf(" " format, value);
|
||||
|
||||
FOR_EACH_NURSERY_PROFILE_COMMON_METADATA(PRINT_FIELD_VALUE)
|
||||
#undef PRINT_FIELD_VALUE
|
||||
|
@ -1021,7 +1021,7 @@ void js::Nursery::printTotalProfileTimes() {
|
|||
// Use whole width of per-slice metadata to print total slices so the profile
|
||||
// totals that follow line up.
|
||||
size_t width = NurserySliceMetadataFormatWidth();
|
||||
sprinter.jsprintf(" %-*s", int(width), collections);
|
||||
sprinter.printf(" %-*s", int(width), collections);
|
||||
|
||||
printProfileDurations(totalDurations_, sprinter);
|
||||
|
||||
|
|
|
@ -1646,13 +1646,13 @@ void Statistics::printProfileHeader() {
|
|||
sprinter.put(MajorGCProfilePrefix);
|
||||
|
||||
#define PRINT_METADATA_NAME(name, width, _1, _2) \
|
||||
sprinter.jsprintf(" %-*s", width, name);
|
||||
sprinter.printf(" %-*s", width, name);
|
||||
|
||||
FOR_EACH_GC_PROFILE_METADATA(PRINT_METADATA_NAME)
|
||||
#undef PRINT_METADATA_NAME
|
||||
|
||||
#define PRINT_PROFILE_NAME(_1, text, _2) \
|
||||
sprinter.jsprintf(" %-6.6s", text);
|
||||
sprinter.printf(" %-6.6s", text);
|
||||
|
||||
FOR_EACH_GC_PROFILE_TIME(PRINT_PROFILE_NAME)
|
||||
#undef PRINT_PROFILE_NAME
|
||||
|
@ -1697,7 +1697,7 @@ void Statistics::printSliceProfile() {
|
|||
size_t realmCount = zoneStats.realmCount;
|
||||
|
||||
#define PRINT_FIELD_VALUE(_1, _2, format, value) \
|
||||
sprinter.jsprintf(" " format, value);
|
||||
sprinter.printf(" " format, value);
|
||||
|
||||
FOR_EACH_GC_PROFILE_METADATA(PRINT_FIELD_VALUE)
|
||||
#undef PRINT_FIELD_VALUE
|
||||
|
@ -1777,7 +1777,7 @@ void Statistics::printProfileTimes(const ProfileDurations& times,
|
|||
Sprinter& sprinter) {
|
||||
for (auto time : times) {
|
||||
int64_t millis = int64_t(time.ToMilliseconds());
|
||||
sprinter.jsprintf(" %6" PRIi64, millis);
|
||||
sprinter.printf(" %6" PRIi64, millis);
|
||||
}
|
||||
|
||||
sprinter.put("\n");
|
||||
|
@ -1814,7 +1814,7 @@ void Statistics::printTotalProfileTimes() {
|
|||
JSRuntime* runtime = gc->rt;
|
||||
|
||||
#define PRINT_FIELD_VALUE(_1, _2, format, value) \
|
||||
sprinter.jsprintf(" " format, value);
|
||||
sprinter.printf(" " format, value);
|
||||
|
||||
FOR_EACH_GC_PROFILE_COMMON_METADATA(PRINT_FIELD_VALUE)
|
||||
#undef PRINT_FIELD_VALUE
|
||||
|
@ -1822,7 +1822,7 @@ void Statistics::printTotalProfileTimes() {
|
|||
// Use whole width of per-slice metadata to print total slices so the profile
|
||||
// totals that follow line up.
|
||||
size_t width = SliceMetadataFormatWidth();
|
||||
sprinter.jsprintf(" %-*s", int(width), formatTotalSlices());
|
||||
sprinter.printf(" %-*s", int(width), formatTotalSlices());
|
||||
printProfileTimes(totalTimes_, sprinter);
|
||||
|
||||
JS::UniqueChars str = sprinter.release();
|
||||
|
|
|
@ -516,19 +516,19 @@ static void PrintStackValue(StackValue* stackVal, CompilerFrameInfo& frame,
|
|||
case StackValue::Constant: {
|
||||
js::Value constantVal = stackVal->constant();
|
||||
if (constantVal.isInt32()) {
|
||||
buf.jsprintf("%d", constantVal.toInt32());
|
||||
buf.printf("%d", constantVal.toInt32());
|
||||
} else if (constantVal.isObjectOrNull()) {
|
||||
buf.jsprintf("obj:%p", constantVal.toObjectOrNull());
|
||||
buf.printf("obj:%p", constantVal.toObjectOrNull());
|
||||
} else if (constantVal.isString()) {
|
||||
buf.put("str:");
|
||||
buf.putString(constantVal.toString());
|
||||
} else if (constantVal.isNumber()) {
|
||||
buf.jsprintf("num:%f", constantVal.toNumber());
|
||||
buf.printf("num:%f", constantVal.toNumber());
|
||||
} else if (constantVal.isSymbol()) {
|
||||
buf.put("sym:");
|
||||
constantVal.toSymbol()->dump(buf);
|
||||
} else {
|
||||
buf.jsprintf("raw:%" PRIx64, constantVal.asRawBits());
|
||||
buf.printf("raw:%" PRIx64, constantVal.asRawBits());
|
||||
}
|
||||
} break;
|
||||
/****** Register ******/
|
||||
|
@ -546,16 +546,16 @@ static void PrintStackValue(StackValue* stackVal, CompilerFrameInfo& frame,
|
|||
buf.put("this");
|
||||
# else
|
||||
Address addr = frame.addressOfThis();
|
||||
buf.jsprintf("this:%s(%d)", addr.base.name(), addr.offset);
|
||||
buf.printf("this:%s(%d)", addr.base.name(), addr.offset);
|
||||
# endif
|
||||
} break;
|
||||
/****** LocalSlot ******/
|
||||
case StackValue::LocalSlot:
|
||||
buf.jsprintf("local:%u", stackVal->localSlot());
|
||||
buf.printf("local:%u", stackVal->localSlot());
|
||||
break;
|
||||
/****** ArgSlot ******/
|
||||
case StackValue::ArgSlot:
|
||||
buf.jsprintf("arg:%u", stackVal->argSlot());
|
||||
buf.printf("arg:%u", stackVal->argSlot());
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -3656,11 +3656,11 @@ static bool DisassWithSrc(JSContext* cx, unsigned argc, Value* vp) {
|
|||
if (line2 < line1) {
|
||||
if (bupline != line2) {
|
||||
bupline = line2;
|
||||
sprinter.jsprintf("%s %3u: BACKUP\n", sep, line2);
|
||||
sprinter.printf("%s %3u: BACKUP\n", sep, line2);
|
||||
}
|
||||
} else {
|
||||
if (bupline && line1 == line2) {
|
||||
sprinter.jsprintf("%s %3u: RESTORE\n", sep, line2);
|
||||
sprinter.printf("%s %3u: RESTORE\n", sep, line2);
|
||||
}
|
||||
bupline = 0;
|
||||
while (line1 < line2) {
|
||||
|
@ -3670,7 +3670,7 @@ static bool DisassWithSrc(JSContext* cx, unsigned argc, Value* vp) {
|
|||
return false;
|
||||
}
|
||||
line1++;
|
||||
sprinter.jsprintf("%s %3u: %s", sep, line1, linebuf);
|
||||
sprinter.printf("%s %3u: %s", sep, line1, linebuf);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -105,7 +105,7 @@ static bool DecompileArgumentFromStack(JSContext* cx, int formalIndex,
|
|||
|
||||
[[nodiscard]] static bool DumpIonScriptCounts(Sprinter* sp, HandleScript script,
|
||||
jit::IonScriptCounts* ionCounts) {
|
||||
sp->jsprintf("IonScript [%zu blocks]:\n", ionCounts->numBlocks());
|
||||
sp->printf("IonScript [%zu blocks]:\n", ionCounts->numBlocks());
|
||||
|
||||
for (size_t i = 0; i < ionCounts->numBlocks(); i++) {
|
||||
const jit::IonBlockCounts& block = ionCounts->block(i);
|
||||
|
@ -113,16 +113,16 @@ static bool DecompileArgumentFromStack(JSContext* cx, int formalIndex,
|
|||
JS::LimitedColumnNumberZeroOrigin columnNumber;
|
||||
lineNumber = PCToLineNumber(script, script->offsetToPC(block.offset()),
|
||||
&columnNumber);
|
||||
sp->jsprintf("BB #%" PRIu32 " [%05u,%u,%u]", block.id(), block.offset(),
|
||||
sp->printf("BB #%" PRIu32 " [%05u,%u,%u]", block.id(), block.offset(),
|
||||
lineNumber, columnNumber.zeroOriginValue());
|
||||
if (block.description()) {
|
||||
sp->jsprintf(" [inlined %s]", block.description());
|
||||
sp->printf(" [inlined %s]", block.description());
|
||||
}
|
||||
for (size_t j = 0; j < block.numSuccessors(); j++) {
|
||||
sp->jsprintf(" -> #%" PRIu32, block.successor(j));
|
||||
sp->printf(" -> #%" PRIu32, block.successor(j));
|
||||
}
|
||||
sp->jsprintf(" :: %" PRIu64 " hits\n", block.hitCount());
|
||||
sp->jsprintf("%s\n", block.code());
|
||||
sp->printf(" :: %" PRIu64 " hits\n", block.hitCount());
|
||||
sp->printf("%s\n", block.code());
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -148,7 +148,7 @@ static bool DecompileArgumentFromStack(JSContext* cx, int formalIndex,
|
|||
|
||||
PCCounts* counts = script->maybeGetPCCounts(pc);
|
||||
if (double val = counts ? counts->numExec() : 0.0) {
|
||||
sp->jsprintf("\"%s\": %.0f", PCCounts::numExecName, val);
|
||||
sp->printf("\"%s\": %.0f", PCCounts::numExecName, val);
|
||||
}
|
||||
sp->put("}\n");
|
||||
|
||||
|
@ -1006,7 +1006,7 @@ static unsigned Disassemble1(JSContext* cx, HandleScript script, jsbytecode* pc,
|
|||
}
|
||||
|
||||
if (showAll) {
|
||||
sp->jsprintf("%s:%u\n", script->filename(),
|
||||
sp->printf("%s:%u\n", script->filename(),
|
||||
unsigned(script->lineno()));
|
||||
}
|
||||
|
||||
|
@ -1054,15 +1054,15 @@ static unsigned Disassemble1(JSContext* cx, HandleScript script, jsbytecode* pc,
|
|||
if (!(!next->isTerminator() && next->delta() == 0)) {
|
||||
break;
|
||||
}
|
||||
sp->jsprintf("%s\n ", sn->name());
|
||||
sp->printf("%s\n ", sn->name());
|
||||
sn = *iter;
|
||||
}
|
||||
sp->jsprintf("%s ", sn->name());
|
||||
sp->printf("%s ", sn->name());
|
||||
} else {
|
||||
sp->put(" ");
|
||||
}
|
||||
if (parser && parser->isReachable(next)) {
|
||||
sp->jsprintf("%05u ", parser->stackDepthAtPC(next));
|
||||
sp->printf("%05u ", parser->stackDepthAtPC(next));
|
||||
} else {
|
||||
sp->put(" ");
|
||||
}
|
||||
|
@ -1267,7 +1267,7 @@ static bool DumpJumpOrigins(HandleScript script, jsbytecode* pc,
|
|||
break;
|
||||
}
|
||||
|
||||
sp->jsprintf("from %s @ %05u", CodeName(JSOp(*pc)),
|
||||
sp->printf("from %s @ %05u", CodeName(JSOp(*pc)),
|
||||
unsigned(script->pcToOffset(pc)));
|
||||
|
||||
return true;
|
||||
|
@ -1382,11 +1382,11 @@ static unsigned Disassemble1(JSContext* cx, HandleScript script, jsbytecode* pc,
|
|||
JSOp op = JSOp(*pc);
|
||||
const JSCodeSpec& cs = CodeSpec(op);
|
||||
const unsigned len = cs.length;
|
||||
sp->jsprintf("%05u:", loc);
|
||||
sp->printf("%05u:", loc);
|
||||
if (lines) {
|
||||
sp->jsprintf("%4u", PCToLineNumber(script, pc));
|
||||
sp->printf("%4u", PCToLineNumber(script, pc));
|
||||
}
|
||||
sp->jsprintf(" %s", CodeName(op));
|
||||
sp->printf(" %s", CodeName(op));
|
||||
|
||||
int i;
|
||||
switch (JOF_TYPE(cs.format)) {
|
||||
|
@ -1395,7 +1395,7 @@ static unsigned Disassemble1(JSContext* cx, HandleScript script, jsbytecode* pc,
|
|||
|
||||
case JOF_JUMP: {
|
||||
ptrdiff_t off = GET_JUMP_OFFSET(pc);
|
||||
sp->jsprintf(" %u (%+d)", unsigned(loc + int(off)), int(off));
|
||||
sp->printf(" %u (%+d)", unsigned(loc + int(off)), int(off));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1405,7 +1405,7 @@ static unsigned Disassemble1(JSContext* cx, HandleScript script, jsbytecode* pc,
|
|||
if (!ToDisassemblySource(cx, scope, &bytes)) {
|
||||
return 0;
|
||||
}
|
||||
sp->jsprintf(" %s", bytes.get());
|
||||
sp->printf(" %s", bytes.get());
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1416,12 +1416,12 @@ static unsigned Disassemble1(JSContext* cx, HandleScript script, jsbytecode* pc,
|
|||
return 0;
|
||||
}
|
||||
EnvironmentCoordinate ec(pc);
|
||||
sp->jsprintf(" %s (hops = %u, slot = %u)", bytes.get(), ec.hops(), ec.slot());
|
||||
sp->printf(" %s (hops = %u, slot = %u)", bytes.get(), ec.hops(), ec.slot());
|
||||
break;
|
||||
}
|
||||
case JOF_DEBUGCOORD: {
|
||||
EnvironmentCoordinate ec(pc);
|
||||
sp->jsprintf("(hops = %u, slot = %u)", ec.hops(), ec.slot());
|
||||
sp->printf("(hops = %u, slot = %u)", ec.hops(), ec.slot());
|
||||
break;
|
||||
}
|
||||
case JOF_ATOM: {
|
||||
|
@ -1430,7 +1430,7 @@ static unsigned Disassemble1(JSContext* cx, HandleScript script, jsbytecode* pc,
|
|||
if (!bytes) {
|
||||
return 0;
|
||||
}
|
||||
sp->jsprintf(" %s", bytes.get());
|
||||
sp->printf(" %s", bytes.get());
|
||||
break;
|
||||
}
|
||||
case JOF_STRING: {
|
||||
|
@ -1439,13 +1439,13 @@ static unsigned Disassemble1(JSContext* cx, HandleScript script, jsbytecode* pc,
|
|||
if (!bytes) {
|
||||
return 0;
|
||||
}
|
||||
sp->jsprintf(" %s", bytes.get());
|
||||
sp->printf(" %s", bytes.get());
|
||||
break;
|
||||
}
|
||||
|
||||
case JOF_DOUBLE: {
|
||||
double d = GET_INLINE_VALUE(pc).toDouble();
|
||||
sp->jsprintf(" %lf", d);
|
||||
sp->printf(" %lf", d);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1455,7 +1455,7 @@ static unsigned Disassemble1(JSContext* cx, HandleScript script, jsbytecode* pc,
|
|||
if (!bytes) {
|
||||
return 0;
|
||||
}
|
||||
sp->jsprintf(" %s", bytes.get());
|
||||
sp->printf(" %s", bytes.get());
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1467,7 +1467,7 @@ static unsigned Disassemble1(JSContext* cx, HandleScript script, jsbytecode* pc,
|
|||
if (!bytes) {
|
||||
return 0;
|
||||
}
|
||||
sp->jsprintf(" %s", bytes.get());
|
||||
sp->printf(" %s", bytes.get());
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -1488,7 +1488,7 @@ static unsigned Disassemble1(JSContext* cx, HandleScript script, jsbytecode* pc,
|
|||
if (!bytes) {
|
||||
return 0;
|
||||
}
|
||||
sp->jsprintf(" %s", bytes.get());
|
||||
sp->printf(" %s", bytes.get());
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1501,7 +1501,7 @@ static unsigned Disassemble1(JSContext* cx, HandleScript script, jsbytecode* pc,
|
|||
pc2 += JUMP_OFFSET_LEN;
|
||||
high = GET_JUMP_OFFSET(pc2);
|
||||
pc2 += JUMP_OFFSET_LEN;
|
||||
sp->jsprintf(" defaultOffset %d low %d high %d", int(off), low, high);
|
||||
sp->printf(" defaultOffset %d low %d high %d", int(off), low, high);
|
||||
|
||||
// Display stack dump before diplaying the offsets for each case.
|
||||
if (!dumpStack()) {
|
||||
|
@ -1511,33 +1511,33 @@ static unsigned Disassemble1(JSContext* cx, HandleScript script, jsbytecode* pc,
|
|||
for (i = low; i <= high; i++) {
|
||||
off =
|
||||
script->tableSwitchCaseOffset(pc, i - low) - script->pcToOffset(pc);
|
||||
sp->jsprintf("\n\t%d: %d", i, int(off));
|
||||
sp->printf("\n\t%d: %d", i, int(off));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case JOF_QARG:
|
||||
sp->jsprintf(" %u", GET_ARGNO(pc));
|
||||
sp->printf(" %u", GET_ARGNO(pc));
|
||||
break;
|
||||
|
||||
case JOF_LOCAL:
|
||||
sp->jsprintf(" %u", GET_LOCALNO(pc));
|
||||
sp->printf(" %u", GET_LOCALNO(pc));
|
||||
break;
|
||||
|
||||
case JOF_GCTHING:
|
||||
sp->jsprintf(" %u", unsigned(GET_GCTHING_INDEX(pc)));
|
||||
sp->printf(" %u", unsigned(GET_GCTHING_INDEX(pc)));
|
||||
break;
|
||||
|
||||
case JOF_UINT32:
|
||||
sp->jsprintf(" %u", GET_UINT32(pc));
|
||||
sp->printf(" %u", GET_UINT32(pc));
|
||||
break;
|
||||
|
||||
case JOF_ICINDEX:
|
||||
sp->jsprintf(" (ic: %u)", GET_ICINDEX(pc));
|
||||
sp->printf(" (ic: %u)", GET_ICINDEX(pc));
|
||||
break;
|
||||
|
||||
case JOF_LOOPHEAD:
|
||||
sp->jsprintf(" (ic: %u, depthHint: %u)", GET_ICINDEX(pc),
|
||||
sp->printf(" (ic: %u, depthHint: %u)", GET_ICINDEX(pc),
|
||||
LoopHeadDepthHint(pc));
|
||||
break;
|
||||
|
||||
|
@ -1545,8 +1545,8 @@ static unsigned Disassemble1(JSContext* cx, HandleScript script, jsbytecode* pc,
|
|||
int one = (int)GET_UINT8(pc);
|
||||
int two = (int)GET_UINT8(pc + 1);
|
||||
|
||||
sp->jsprintf(" %d", one);
|
||||
sp->jsprintf(" %d", two);
|
||||
sp->printf(" %d", one);
|
||||
sp->printf(" %d", two);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1573,7 +1573,7 @@ static unsigned Disassemble1(JSContext* cx, HandleScript script, jsbytecode* pc,
|
|||
MOZ_ASSERT(op == JSOp::Int32);
|
||||
i = GET_INT32(pc);
|
||||
print_int:
|
||||
sp->jsprintf(" %d", i);
|
||||
sp->printf(" %d", i);
|
||||
break;
|
||||
|
||||
default: {
|
||||
|
|
|
@ -3502,7 +3502,7 @@ bool JSScript::dump(JSContext* cx, JS::Handle<JSScript*> script,
|
|||
bool JSScript::dumpSrcNotes(JSContext* cx, JS::Handle<JSScript*> script,
|
||||
js::Sprinter* sp) {
|
||||
sp->put("\nSource notes:\n");
|
||||
sp->jsprintf("%4s %4s %6s %5s %6s %-10s %s\n", "ofs", "line", "column",
|
||||
sp->printf("%4s %4s %6s %5s %6s %-10s %s\n", "ofs", "line", "column",
|
||||
"pc", "delta", "desc", "args");
|
||||
sp->put("---- ---- ------ ----- ------ ---------- ------\n");
|
||||
|
||||
|
@ -3517,7 +3517,7 @@ bool JSScript::dumpSrcNotes(JSContext* cx, JS::Handle<JSScript*> script,
|
|||
offset += delta;
|
||||
SrcNoteType type = sn->type();
|
||||
const char* name = sn->name();
|
||||
sp->jsprintf("%3u: %4u %6u %5u [%4u] %-10s", unsigned(sn - notes), lineno,
|
||||
sp->printf("%3u: %4u %6u %5u [%4u] %-10s", unsigned(sn - notes), lineno,
|
||||
column.zeroOriginValue(), offset, delta, name);
|
||||
|
||||
switch (type) {
|
||||
|
@ -3530,14 +3530,14 @@ bool JSScript::dumpSrcNotes(JSContext* cx, JS::Handle<JSScript*> script,
|
|||
|
||||
case SrcNoteType::ColSpan: {
|
||||
JS::ColumnNumberOffset colspan = SrcNote::ColSpan::getSpan(sn);
|
||||
sp->jsprintf(" colspan %u", colspan.value());
|
||||
sp->printf(" colspan %u", colspan.value());
|
||||
column += colspan;
|
||||
break;
|
||||
}
|
||||
|
||||
case SrcNoteType::SetLine:
|
||||
lineno = SrcNote::SetLine::getLine(sn, script->lineno());
|
||||
sp->jsprintf(" lineno %u", lineno);
|
||||
sp->printf(" lineno %u", lineno);
|
||||
column = JS::LimitedColumnNumberZeroOrigin::zero();
|
||||
break;
|
||||
|
||||
|
@ -3582,7 +3582,7 @@ bool JSScript::dumpTryNotes(JSContext* cx, JS::Handle<JSScript*> script,
|
|||
sp->put("\nException table:\nkind stack start end\n");
|
||||
|
||||
for (const js::TryNote& tn : script->trynotes()) {
|
||||
sp->jsprintf(" %-16s %6u %8u %8u\n", TryNoteName(tn.kind()),
|
||||
sp->printf(" %-16s %6u %8u %8u\n", TryNoteName(tn.kind()),
|
||||
tn.stackDepth, tn.start, tn.start + tn.length);
|
||||
}
|
||||
return true;
|
||||
|
@ -3595,16 +3595,16 @@ bool JSScript::dumpScopeNotes(JSContext* cx, JS::Handle<JSScript*> script,
|
|||
|
||||
for (const ScopeNote& note : script->scopeNotes()) {
|
||||
if (note.index == ScopeNote::NoScopeIndex) {
|
||||
sp->jsprintf("%8s ", "(none)");
|
||||
sp->printf("%8s ", "(none)");
|
||||
} else {
|
||||
sp->jsprintf("%8u ", note.index.index);
|
||||
sp->printf("%8u ", note.index.index);
|
||||
}
|
||||
if (note.parent == ScopeNote::NoScopeIndex) {
|
||||
sp->jsprintf("%8s ", "(none)");
|
||||
sp->printf("%8s ", "(none)");
|
||||
} else {
|
||||
sp->jsprintf("%8u ", note.parent);
|
||||
sp->printf("%8u ", note.parent);
|
||||
}
|
||||
sp->jsprintf("%8u %8u\n", note.start, note.start + note.length);
|
||||
sp->printf("%8u %8u\n", note.start, note.start + note.length);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -3616,7 +3616,7 @@ bool JSScript::dumpGCThings(JSContext* cx, JS::Handle<JSScript*> script,
|
|||
|
||||
size_t i = 0;
|
||||
for (JS::GCCellPtr gcThing : script->gcthings()) {
|
||||
sp->jsprintf("%8zu ", i);
|
||||
sp->printf("%8zu ", i);
|
||||
if (gcThing.is<JS::BigInt>()) {
|
||||
sp->put("BigInt ");
|
||||
gcThing.as<JS::BigInt>().dump(*sp);
|
||||
|
@ -3647,7 +3647,7 @@ bool JSScript::dumpGCThings(JSContext* cx, JS::Handle<JSScript*> script,
|
|||
|
||||
if (fun->hasBaseScript()) {
|
||||
BaseScript* script = fun->baseScript();
|
||||
sp->jsprintf(" @ %u:%u\n", script->lineno(),
|
||||
sp->printf(" @ %u:%u\n", script->lineno(),
|
||||
script->column().zeroOriginValue());
|
||||
} else {
|
||||
sp->put(" (no script)\n");
|
||||
|
|
|
@ -281,13 +281,6 @@ void Sprinter::forwardOutOfMemory() {
|
|||
}
|
||||
}
|
||||
|
||||
void Sprinter::jsprintf(const char* format, ...) {
|
||||
va_list ap;
|
||||
va_start(ap, format);
|
||||
vprintf(format, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
const char js_EscapeMap[] = {
|
||||
// clang-format off
|
||||
'\b', 'b',
|
||||
|
@ -367,14 +360,14 @@ JS_PUBLIC_API bool QuoteString(Sprinter* sp,
|
|||
const char* escape;
|
||||
if (!(c >> 8) && c != 0 &&
|
||||
(escape = strchr(escapeMap, int(c))) != nullptr) {
|
||||
sp->jsprintf("\\%c", escape[1]);
|
||||
sp->printf("\\%c", escape[1]);
|
||||
} else {
|
||||
/*
|
||||
* Use \x only if the high byte is 0 and we're in a quoted string,
|
||||
* because ECMA-262 allows only \u, not \x, in Unicode identifiers
|
||||
* (see bug 621814).
|
||||
*/
|
||||
sp->jsprintf((quote && !(c >> 8)) ? "\\x%02X" : "\\u%04X", c);
|
||||
sp->printf((quote && !(c >> 8)) ? "\\x%02X" : "\\u%04X", c);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче