зеркало из https://github.com/mozilla/gecko-dev.git
Bug 553032 - use MOZ_FORMAT_PRINTF in js; r=evilpie
MozReview-Commit-ID: DD3DJRkOxmC --HG-- extra : rebase_source : 4f98705e5e2c5ff9860f04384abbc6f5dc18a7a9
This commit is contained in:
Родитель
b371901056
Коммит
5b851428f8
|
@ -154,8 +154,8 @@ inline void SetPendingExceptionASCII(JSContext *cx, const char *aMsg)
|
||||||
|
|
||||||
inline void SetPendingException(JSContext *cx, const char16_t *aMsg)
|
inline void SetPendingException(JSContext *cx, const char16_t *aMsg)
|
||||||
{
|
{
|
||||||
// FIXME: Need to convert to UTF-8 (bug XXX).
|
NS_ConvertUTF16toUTF8 msg(aMsg);
|
||||||
JS_ReportErrorLatin1(cx, "%hs", aMsg);
|
JS_ReportErrorUTF8(cx, "%s", msg.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper class to get stuff from the ClassInfo and not waste extra time with
|
// Helper class to get stuff from the ClassInfo and not waste extra time with
|
||||||
|
|
|
@ -638,7 +638,7 @@ ThrowJSExceptionASCII(JSContext *cx, const char *message)
|
||||||
|
|
||||||
PopException();
|
PopException();
|
||||||
} else {
|
} else {
|
||||||
::JS_ReportErrorASCII(cx, message);
|
::JS_ReportErrorASCII(cx, "%s", message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2250,7 +2250,7 @@ class MOZ_STACK_CLASS ModuleValidator
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool failfOffset(uint32_t offset, const char* fmt, ...) {
|
bool failfOffset(uint32_t offset, const char* fmt, ...) MOZ_FORMAT_PRINTF(3, 4) {
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
failfVAOffset(offset, fmt, ap);
|
failfVAOffset(offset, fmt, ap);
|
||||||
|
@ -2258,7 +2258,7 @@ class MOZ_STACK_CLASS ModuleValidator
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool failf(ParseNode* pn, const char* fmt, ...) {
|
bool failf(ParseNode* pn, const char* fmt, ...) MOZ_FORMAT_PRINTF(3, 4) {
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
failfVAOffset(pn->pn_pos.begin, fmt, ap);
|
failfVAOffset(pn->pn_pos.begin, fmt, ap);
|
||||||
|
@ -2944,7 +2944,7 @@ class MOZ_STACK_CLASS FunctionValidator
|
||||||
return m_.fail(pn, str);
|
return m_.fail(pn, str);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool failf(ParseNode* pn, const char* fmt, ...) {
|
bool failf(ParseNode* pn, const char* fmt, ...) MOZ_FORMAT_PRINTF(3, 4) {
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
m_.failfVAOffset(pn->pn_pos.begin, fmt, ap);
|
m_.failfVAOffset(pn->pn_pos.begin, fmt, ap);
|
||||||
|
@ -4720,7 +4720,8 @@ static bool
|
||||||
CheckSignatureAgainstExisting(ModuleValidator& m, ParseNode* usepn, const Sig& sig, const Sig& existing)
|
CheckSignatureAgainstExisting(ModuleValidator& m, ParseNode* usepn, const Sig& sig, const Sig& existing)
|
||||||
{
|
{
|
||||||
if (sig.args().length() != existing.args().length()) {
|
if (sig.args().length() != existing.args().length()) {
|
||||||
return m.failf(usepn, "incompatible number of arguments (%u here vs. %u before)",
|
return m.failf(usepn, "incompatible number of arguments (%" PRIuSIZE
|
||||||
|
" here vs. %" PRIuSIZE " before)",
|
||||||
sig.args().length(), existing.args().length());
|
sig.args().length(), existing.args().length());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ wasm::DecodePreamble(Decoder& d)
|
||||||
return d.fail("failed to match magic number");
|
return d.fail("failed to match magic number");
|
||||||
|
|
||||||
if (!d.readFixedU32(&u32) || u32 != EncodingVersion)
|
if (!d.readFixedU32(&u32) || u32 != EncodingVersion)
|
||||||
return d.fail("binary version 0x%lx does not match expected version 0x%lx",
|
return d.fail("binary version 0x%" PRIx32 " does not match expected version 0x%" PRIx32,
|
||||||
u32, EncodingVersion);
|
u32, EncodingVersion);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -151,7 +151,7 @@ wasm::DecodeLimits(Decoder& d, Limits* limits)
|
||||||
// TODO (bug 1310149): tighten this check (s/3/1) when the AngryBots demo
|
// TODO (bug 1310149): tighten this check (s/3/1) when the AngryBots demo
|
||||||
// gets updated.
|
// gets updated.
|
||||||
if (flags & ~uint32_t(0x3))
|
if (flags & ~uint32_t(0x3))
|
||||||
return d.fail("unexpected bits set in flags: %lu", (flags & ~uint32_t(0x3)));
|
return d.fail("unexpected bits set in flags: %" PRIu32, (flags & ~uint32_t(0x3)));
|
||||||
|
|
||||||
if (!d.readVarU32(&limits->initial))
|
if (!d.readVarU32(&limits->initial))
|
||||||
return d.fail("expected initial length");
|
return d.fail("expected initial length");
|
||||||
|
@ -163,7 +163,7 @@ wasm::DecodeLimits(Decoder& d, Limits* limits)
|
||||||
|
|
||||||
if (limits->initial > maximum) {
|
if (limits->initial > maximum) {
|
||||||
return d.fail("memory size minimum must not be greater than maximum; "
|
return d.fail("memory size minimum must not be greater than maximum; "
|
||||||
"maximum length %lu is less than initial length %lu",
|
"maximum length %" PRIu32 " is less than initial length %" PRIu32 ,
|
||||||
maximum, limits->initial);
|
maximum, limits->initial);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -778,7 +778,7 @@ class Decoder
|
||||||
error_(error)
|
error_(error)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
bool fail(const char* msg, ...);
|
bool fail(const char* msg, ...) MOZ_FORMAT_PRINTF(2, 3);
|
||||||
bool fail(UniqueChars msg);
|
bool fail(UniqueChars msg);
|
||||||
void clearError() {
|
void clearError() {
|
||||||
if (error_)
|
if (error_)
|
||||||
|
|
|
@ -725,7 +725,7 @@ template <typename Policy>
|
||||||
bool
|
bool
|
||||||
ExprIter<Policy>::fail(const char* msg)
|
ExprIter<Policy>::fail(const char* msg)
|
||||||
{
|
{
|
||||||
return d_.fail(msg);
|
return d_.fail("%s", msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Policy>
|
template <typename Policy>
|
||||||
|
|
|
@ -796,8 +796,10 @@ Code::ensureProfilingState(JSContext* cx, bool newProfilingEnabled)
|
||||||
if (!name.append('\0'))
|
if (!name.append('\0'))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
UniqueChars label(JS_smprintf("%hs (%s:%u)",
|
TwoByteChars chars(name.begin(), name.length());
|
||||||
name.begin(),
|
UniqueChars utf8Name(JS::CharsToNewUTF8CharsZ(nullptr, chars).c_str());
|
||||||
|
UniqueChars label(JS_smprintf("%s (%s:%u)",
|
||||||
|
utf8Name.get(),
|
||||||
metadata_->filename.get(),
|
metadata_->filename.get(),
|
||||||
codeRange.funcLineOrBytecode()));
|
codeRange.funcLineOrBytecode()));
|
||||||
if (!label) {
|
if (!label) {
|
||||||
|
|
|
@ -1488,7 +1488,7 @@ struct WasmParseContext
|
||||||
{}
|
{}
|
||||||
|
|
||||||
bool fail(const char* message) {
|
bool fail(const char* message) {
|
||||||
error->reset(JS_smprintf(message));
|
error->reset(js_strdup(message));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
~WasmParseContext() {
|
~WasmParseContext() {
|
||||||
|
@ -3336,12 +3336,9 @@ class Resolver
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bool failResolveLabel(const char* kind, AstName name) {
|
bool failResolveLabel(const char* kind, AstName name) {
|
||||||
Vector<char16_t, 0, SystemAllocPolicy> nameWithNull;
|
TwoByteChars chars(name.begin(), name.length());
|
||||||
if (!nameWithNull.append(name.begin(), name.length()))
|
UniqueChars utf8Chars(CharsToNewUTF8CharsZ(nullptr, chars).c_str());
|
||||||
return false;
|
error_->reset(JS_smprintf("%s label '%s' not found", kind, utf8Chars.get()));
|
||||||
if (!nameWithNull.append(0))
|
|
||||||
return false;
|
|
||||||
error_->reset(JS_smprintf("%s label '%hs' not found", kind, nameWithNull.begin()));
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -165,6 +165,7 @@ Array<Array<uint64_t, MaxLifetimeBins>, MaxClasses> finalizedHeapObjectCountByCl
|
||||||
std::vector<Array<Array<uint64_t, MaxLifetimeBins>, HeapKinds> > objectCountByTypeHeapAndLifetime;
|
std::vector<Array<Array<uint64_t, MaxLifetimeBins>, HeapKinds> > objectCountByTypeHeapAndLifetime;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
MOZ_FORMAT_PRINTF(1, 2)
|
||||||
die(const char* format, ...)
|
die(const char* format, ...)
|
||||||
{
|
{
|
||||||
va_list va;
|
va_list va;
|
||||||
|
|
|
@ -1872,7 +1872,7 @@ irregexp::CompilePattern(JSContext* cx, RegExpShared* shared, RegExpCompileData*
|
||||||
Analysis analysis(cx, ignore_case, is_ascii, unicode);
|
Analysis analysis(cx, ignore_case, is_ascii, unicode);
|
||||||
analysis.EnsureAnalyzed(node);
|
analysis.EnsureAnalyzed(node);
|
||||||
if (analysis.has_failed()) {
|
if (analysis.has_failed()) {
|
||||||
JS_ReportErrorASCII(cx, analysis.errorMessage());
|
JS_ReportErrorASCII(cx, "%s", analysis.errorMessage());
|
||||||
return RegExpCode();
|
return RegExpCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1245,7 +1245,7 @@ bool
|
||||||
BacktrackingAllocator::processBundle(MIRGenerator* mir, LiveBundle* bundle)
|
BacktrackingAllocator::processBundle(MIRGenerator* mir, LiveBundle* bundle)
|
||||||
{
|
{
|
||||||
if (JitSpewEnabled(JitSpew_RegAlloc)) {
|
if (JitSpewEnabled(JitSpew_RegAlloc)) {
|
||||||
JitSpew(JitSpew_RegAlloc, "Allocating %s [priority %lu] [weight %lu]",
|
JitSpew(JitSpew_RegAlloc, "Allocating %s [priority %" PRIuSIZE "] [weight %" PRIuSIZE "]",
|
||||||
bundle->toString().get(), computePriority(bundle), computeSpillWeight(bundle));
|
bundle->toString().get(), computePriority(bundle), computeSpillWeight(bundle));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1437,13 +1437,13 @@ BacktrackingAllocator::tryAllocateRegister(PhysicalRegister& r, LiveBundle* bund
|
||||||
if (JitSpewEnabled(JitSpew_RegAlloc)) {
|
if (JitSpewEnabled(JitSpew_RegAlloc)) {
|
||||||
if (aliasedConflicting.length() == 1) {
|
if (aliasedConflicting.length() == 1) {
|
||||||
LiveBundle* existing = aliasedConflicting[0];
|
LiveBundle* existing = aliasedConflicting[0];
|
||||||
JitSpew(JitSpew_RegAlloc, " %s collides with %s [weight %lu]",
|
JitSpew(JitSpew_RegAlloc, " %s collides with %s [weight %" PRIuSIZE "]",
|
||||||
r.reg.name(), existing->toString().get(), computeSpillWeight(existing));
|
r.reg.name(), existing->toString().get(), computeSpillWeight(existing));
|
||||||
} else {
|
} else {
|
||||||
JitSpew(JitSpew_RegAlloc, " %s collides with the following", r.reg.name());
|
JitSpew(JitSpew_RegAlloc, " %s collides with the following", r.reg.name());
|
||||||
for (size_t i = 0; i < aliasedConflicting.length(); i++) {
|
for (size_t i = 0; i < aliasedConflicting.length(); i++) {
|
||||||
LiveBundle* existing = aliasedConflicting[i];
|
LiveBundle* existing = aliasedConflicting[i];
|
||||||
JitSpew(JitSpew_RegAlloc, " %s [weight %lu]",
|
JitSpew(JitSpew_RegAlloc, " %s [weight %" PRIuSIZE "]",
|
||||||
existing->toString().get(), computeSpillWeight(existing));
|
existing->toString().get(), computeSpillWeight(existing));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1482,7 +1482,7 @@ bool
|
||||||
BacktrackingAllocator::evictBundle(LiveBundle* bundle)
|
BacktrackingAllocator::evictBundle(LiveBundle* bundle)
|
||||||
{
|
{
|
||||||
if (JitSpewEnabled(JitSpew_RegAlloc)) {
|
if (JitSpewEnabled(JitSpew_RegAlloc)) {
|
||||||
JitSpew(JitSpew_RegAlloc, " Evicting %s [priority %lu] [weight %lu]",
|
JitSpew(JitSpew_RegAlloc, " Evicting %s [priority %" PRIuSIZE "] [weight %" PRIuSIZE "]",
|
||||||
bundle->toString().get(), computePriority(bundle), computeSpillWeight(bundle));
|
bundle->toString().get(), computePriority(bundle), computeSpillWeight(bundle));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2296,7 +2296,8 @@ LiveBundle::toString() const
|
||||||
{
|
{
|
||||||
AutoEnterOOMUnsafeRegion oomUnsafe;
|
AutoEnterOOMUnsafeRegion oomUnsafe;
|
||||||
|
|
||||||
char *buf = JS_smprintf("");
|
// Suppress -Wformat warning.
|
||||||
|
char *buf = JS_smprintf("%s", "");
|
||||||
|
|
||||||
for (LiveRange::BundleLinkIterator iter = rangesBegin(); buf && iter; iter++) {
|
for (LiveRange::BundleLinkIterator iter = rangesBegin(); buf && iter; iter++) {
|
||||||
buf = JS_sprintf_append(buf, "%s %s",
|
buf = JS_sprintf_append(buf, "%s %s",
|
||||||
|
|
|
@ -230,11 +230,11 @@ struct BaselineStackBuilder
|
||||||
if (info) {
|
if (info) {
|
||||||
if (sizeof(size_t) == 4) {
|
if (sizeof(size_t) == 4) {
|
||||||
JitSpew(JitSpew_BaselineBailouts,
|
JitSpew(JitSpew_BaselineBailouts,
|
||||||
" WRITE_WRD %p/%p %-15s %08x",
|
" WRITE_WRD %p/%p %-15s %08" PRIxSIZE,
|
||||||
header_->copyStackBottom, virtualPointerAtStackOffset(0), info, w);
|
header_->copyStackBottom, virtualPointerAtStackOffset(0), info, w);
|
||||||
} else {
|
} else {
|
||||||
JitSpew(JitSpew_BaselineBailouts,
|
JitSpew(JitSpew_BaselineBailouts,
|
||||||
" WRITE_WRD %p/%p %-15s %016llx",
|
" WRITE_WRD %p/%p %-15s %016" PRIxSIZE,
|
||||||
header_->copyStackBottom, virtualPointerAtStackOffset(0), info, w);
|
header_->copyStackBottom, virtualPointerAtStackOffset(0), info, w);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -246,7 +246,7 @@ struct BaselineStackBuilder
|
||||||
return false;
|
return false;
|
||||||
if (info) {
|
if (info) {
|
||||||
JitSpew(JitSpew_BaselineBailouts,
|
JitSpew(JitSpew_BaselineBailouts,
|
||||||
" WRITE_VAL %p/%p %-15s %016llx",
|
" WRITE_VAL %p/%p %-15s %016" PRIx64,
|
||||||
header_->copyStackBottom, virtualPointerAtStackOffset(0), info,
|
header_->copyStackBottom, virtualPointerAtStackOffset(0), info,
|
||||||
*((uint64_t*) &val));
|
*((uint64_t*) &val));
|
||||||
}
|
}
|
||||||
|
@ -637,7 +637,7 @@ InitFromBailout(JSContext* cx, HandleScript caller, jsbytecode* callerPC,
|
||||||
// | ReturnAddr | <-- return into main jitcode after IC
|
// | ReturnAddr | <-- return into main jitcode after IC
|
||||||
// +===============+
|
// +===============+
|
||||||
|
|
||||||
JitSpew(JitSpew_BaselineBailouts, " Unpacking %s:%d", script->filename(), script->lineno());
|
JitSpew(JitSpew_BaselineBailouts, " Unpacking %s:%" PRIuSIZE, script->filename(), script->lineno());
|
||||||
JitSpew(JitSpew_BaselineBailouts, " [BASELINE-JS FRAME]");
|
JitSpew(JitSpew_BaselineBailouts, " [BASELINE-JS FRAME]");
|
||||||
|
|
||||||
// Calculate and write the previous frame pointer value.
|
// Calculate and write the previous frame pointer value.
|
||||||
|
@ -749,7 +749,7 @@ InitFromBailout(JSContext* cx, HandleScript caller, jsbytecode* callerPC,
|
||||||
}
|
}
|
||||||
JitSpew(JitSpew_BaselineBailouts, " EnvChain=%p", envChain);
|
JitSpew(JitSpew_BaselineBailouts, " EnvChain=%p", envChain);
|
||||||
blFrame->setEnvironmentChain(envChain);
|
blFrame->setEnvironmentChain(envChain);
|
||||||
JitSpew(JitSpew_BaselineBailouts, " ReturnValue=%016llx", *((uint64_t*) &returnValue));
|
JitSpew(JitSpew_BaselineBailouts, " ReturnValue=%016" PRIx64, *((uint64_t*) &returnValue));
|
||||||
blFrame->setReturnValue(returnValue);
|
blFrame->setReturnValue(returnValue);
|
||||||
|
|
||||||
// Do not need to initialize scratchValue field in BaselineFrame.
|
// Do not need to initialize scratchValue field in BaselineFrame.
|
||||||
|
@ -764,13 +764,13 @@ InitFromBailout(JSContext* cx, HandleScript caller, jsbytecode* callerPC,
|
||||||
// in the calling frame.
|
// in the calling frame.
|
||||||
Value thisv = iter.read();
|
Value thisv = iter.read();
|
||||||
JitSpew(JitSpew_BaselineBailouts, " Is function!");
|
JitSpew(JitSpew_BaselineBailouts, " Is function!");
|
||||||
JitSpew(JitSpew_BaselineBailouts, " thisv=%016llx", *((uint64_t*) &thisv));
|
JitSpew(JitSpew_BaselineBailouts, " thisv=%016" PRIx64, *((uint64_t*) &thisv));
|
||||||
|
|
||||||
size_t thisvOffset = builder.framePushed() + JitFrameLayout::offsetOfThis();
|
size_t thisvOffset = builder.framePushed() + JitFrameLayout::offsetOfThis();
|
||||||
builder.valuePointerAtStackOffset(thisvOffset).set(thisv);
|
builder.valuePointerAtStackOffset(thisvOffset).set(thisv);
|
||||||
|
|
||||||
MOZ_ASSERT(iter.numAllocations() >= CountArgSlots(script, fun));
|
MOZ_ASSERT(iter.numAllocations() >= CountArgSlots(script, fun));
|
||||||
JitSpew(JitSpew_BaselineBailouts, " frame slots %u, nargs %u, nfixed %u",
|
JitSpew(JitSpew_BaselineBailouts, " frame slots %u, nargs %" PRIuSIZE ", nfixed %" PRIuSIZE,
|
||||||
iter.numAllocations(), fun->nargs(), script->nfixed());
|
iter.numAllocations(), fun->nargs(), script->nfixed());
|
||||||
|
|
||||||
if (!callerPC) {
|
if (!callerPC) {
|
||||||
|
@ -786,7 +786,7 @@ InitFromBailout(JSContext* cx, HandleScript caller, jsbytecode* callerPC,
|
||||||
|
|
||||||
for (uint32_t i = 0; i < fun->nargs(); i++) {
|
for (uint32_t i = 0; i < fun->nargs(); i++) {
|
||||||
Value arg = iter.read();
|
Value arg = iter.read();
|
||||||
JitSpew(JitSpew_BaselineBailouts, " arg %d = %016llx",
|
JitSpew(JitSpew_BaselineBailouts, " arg %d = %016" PRIx64,
|
||||||
(int) i, *((uint64_t*) &arg));
|
(int) i, *((uint64_t*) &arg));
|
||||||
if (callerPC) {
|
if (callerPC) {
|
||||||
size_t argOffset = builder.framePushed() + JitFrameLayout::offsetOfActualArg(i);
|
size_t argOffset = builder.framePushed() + JitFrameLayout::offsetOfActualArg(i);
|
||||||
|
@ -1314,7 +1314,7 @@ InitFromBailout(JSContext* cx, HandleScript caller, jsbytecode* callerPC,
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Push callee token (must be a JS Function)
|
// Push callee token (must be a JS Function)
|
||||||
JitSpew(JitSpew_BaselineBailouts, " Callee = %016llx", callee.asRawBits());
|
JitSpew(JitSpew_BaselineBailouts, " Callee = %016" PRIx64, callee.asRawBits());
|
||||||
|
|
||||||
JSFunction* calleeFun = &callee.toObject().as<JSFunction>();
|
JSFunction* calleeFun = &callee.toObject().as<JSFunction>();
|
||||||
if (!builder.writePtr(CalleeToToken(calleeFun, JSOp(*pc) == JSOP_NEW), "CalleeToken"))
|
if (!builder.writePtr(CalleeToToken(calleeFun, JSOp(*pc) == JSOP_NEW), "CalleeToken"))
|
||||||
|
@ -1494,7 +1494,7 @@ jit::BailoutIonToBaseline(JSContext* cx, JitActivation* activation, JitFrameIter
|
||||||
// | ||||| |
|
// | ||||| |
|
||||||
// +---------------+
|
// +---------------+
|
||||||
|
|
||||||
JitSpew(JitSpew_BaselineBailouts, "Bailing to baseline %s:%u (IonScript=%p) (FrameType=%d)",
|
JitSpew(JitSpew_BaselineBailouts, "Bailing to baseline %s:%" PRIuSIZE " (IonScript=%p) (FrameType=%d)",
|
||||||
iter.script()->filename(), iter.script()->lineno(), (void*) iter.ionScript(),
|
iter.script()->filename(), iter.script()->lineno(), (void*) iter.ionScript(),
|
||||||
(int) prevFrameType);
|
(int) prevFrameType);
|
||||||
|
|
||||||
|
@ -1514,7 +1514,7 @@ jit::BailoutIonToBaseline(JSContext* cx, JitActivation* activation, JitFrameIter
|
||||||
propagatingExceptionForDebugMode = false;
|
propagatingExceptionForDebugMode = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
JitSpew(JitSpew_BaselineBailouts, " Reading from snapshot offset %u size %u",
|
JitSpew(JitSpew_BaselineBailouts, " Reading from snapshot offset %u size %" PRIuSIZE,
|
||||||
iter.snapshotOffset(), iter.ionScript()->snapshotsListSize());
|
iter.snapshotOffset(), iter.ionScript()->snapshotsListSize());
|
||||||
|
|
||||||
if (!excInfo)
|
if (!excInfo)
|
||||||
|
@ -1540,7 +1540,7 @@ jit::BailoutIonToBaseline(JSContext* cx, JitActivation* activation, JitFrameIter
|
||||||
RootedFunction callee(cx, iter.maybeCallee());
|
RootedFunction callee(cx, iter.maybeCallee());
|
||||||
RootedScript scr(cx, iter.script());
|
RootedScript scr(cx, iter.script());
|
||||||
if (callee) {
|
if (callee) {
|
||||||
JitSpew(JitSpew_BaselineBailouts, " Callee function (%s:%u)",
|
JitSpew(JitSpew_BaselineBailouts, " Callee function (%s:%" PRIuSIZE ")",
|
||||||
scr->filename(), scr->lineno());
|
scr->filename(), scr->lineno());
|
||||||
} else {
|
} else {
|
||||||
JitSpew(JitSpew_BaselineBailouts, " No callee!");
|
JitSpew(JitSpew_BaselineBailouts, " No callee!");
|
||||||
|
@ -1575,7 +1575,7 @@ jit::BailoutIonToBaseline(JSContext* cx, JitActivation* activation, JitFrameIter
|
||||||
TraceLogStartEvent(logger, TraceLogger_Baseline);
|
TraceLogStartEvent(logger, TraceLogger_Baseline);
|
||||||
}
|
}
|
||||||
|
|
||||||
JitSpew(JitSpew_BaselineBailouts, " FrameNo %d", frameNo);
|
JitSpew(JitSpew_BaselineBailouts, " FrameNo %" PRIuSIZE, frameNo);
|
||||||
|
|
||||||
// If we are bailing out to a catch or finally block in this frame,
|
// If we are bailing out to a catch or finally block in this frame,
|
||||||
// pass excInfo to InitFromBailout and don't unpack any other frames.
|
// pass excInfo to InitFromBailout and don't unpack any other frames.
|
||||||
|
@ -1671,7 +1671,7 @@ InvalidateAfterBailout(JSContext* cx, HandleScript outerScript, const char* reas
|
||||||
static void
|
static void
|
||||||
HandleBoundsCheckFailure(JSContext* cx, HandleScript outerScript, HandleScript innerScript)
|
HandleBoundsCheckFailure(JSContext* cx, HandleScript outerScript, HandleScript innerScript)
|
||||||
{
|
{
|
||||||
JitSpew(JitSpew_IonBailouts, "Bounds check failure %s:%d, inlined into %s:%d",
|
JitSpew(JitSpew_IonBailouts, "Bounds check failure %s:%" PRIuSIZE ", inlined into %s:%" PRIuSIZE,
|
||||||
innerScript->filename(), innerScript->lineno(),
|
innerScript->filename(), innerScript->lineno(),
|
||||||
outerScript->filename(), outerScript->lineno());
|
outerScript->filename(), outerScript->lineno());
|
||||||
|
|
||||||
|
@ -1686,7 +1686,7 @@ HandleBoundsCheckFailure(JSContext* cx, HandleScript outerScript, HandleScript i
|
||||||
static void
|
static void
|
||||||
HandleShapeGuardFailure(JSContext* cx, HandleScript outerScript, HandleScript innerScript)
|
HandleShapeGuardFailure(JSContext* cx, HandleScript outerScript, HandleScript innerScript)
|
||||||
{
|
{
|
||||||
JitSpew(JitSpew_IonBailouts, "Shape guard failure %s:%d, inlined into %s:%d",
|
JitSpew(JitSpew_IonBailouts, "Shape guard failure %s:%" PRIuSIZE ", inlined into %s:%" PRIuSIZE,
|
||||||
innerScript->filename(), innerScript->lineno(),
|
innerScript->filename(), innerScript->lineno(),
|
||||||
outerScript->filename(), outerScript->lineno());
|
outerScript->filename(), outerScript->lineno());
|
||||||
|
|
||||||
|
@ -1701,7 +1701,7 @@ HandleShapeGuardFailure(JSContext* cx, HandleScript outerScript, HandleScript in
|
||||||
static void
|
static void
|
||||||
HandleBaselineInfoBailout(JSContext* cx, HandleScript outerScript, HandleScript innerScript)
|
HandleBaselineInfoBailout(JSContext* cx, HandleScript outerScript, HandleScript innerScript)
|
||||||
{
|
{
|
||||||
JitSpew(JitSpew_IonBailouts, "Baseline info failure %s:%d, inlined into %s:%d",
|
JitSpew(JitSpew_IonBailouts, "Baseline info failure %s:%" PRIuSIZE ", inlined into %s:%" PRIuSIZE,
|
||||||
innerScript->filename(), innerScript->lineno(),
|
innerScript->filename(), innerScript->lineno(),
|
||||||
outerScript->filename(), outerScript->lineno());
|
outerScript->filename(), outerScript->lineno());
|
||||||
|
|
||||||
|
@ -1711,7 +1711,7 @@ HandleBaselineInfoBailout(JSContext* cx, HandleScript outerScript, HandleScript
|
||||||
static void
|
static void
|
||||||
HandleLexicalCheckFailure(JSContext* cx, HandleScript outerScript, HandleScript innerScript)
|
HandleLexicalCheckFailure(JSContext* cx, HandleScript outerScript, HandleScript innerScript)
|
||||||
{
|
{
|
||||||
JitSpew(JitSpew_IonBailouts, "Lexical check failure %s:%d, inlined into %s:%d",
|
JitSpew(JitSpew_IonBailouts, "Lexical check failure %s:%" PRIuSIZE ", inlined into %s:%" PRIuSIZE,
|
||||||
innerScript->filename(), innerScript->lineno(),
|
innerScript->filename(), innerScript->lineno(),
|
||||||
outerScript->filename(), outerScript->lineno());
|
outerScript->filename(), outerScript->lineno());
|
||||||
|
|
||||||
|
@ -1754,7 +1754,7 @@ CopyFromRematerializedFrame(JSContext* cx, JitActivation* act, uint8_t* fp, size
|
||||||
frame->setHasCachedSavedFrame();
|
frame->setHasCachedSavedFrame();
|
||||||
|
|
||||||
JitSpew(JitSpew_BaselineBailouts,
|
JitSpew(JitSpew_BaselineBailouts,
|
||||||
" Copied from rematerialized frame at (%p,%u)",
|
" Copied from rematerialized frame at (%p,%" PRIuSIZE ")",
|
||||||
fp, inlineDepth);
|
fp, inlineDepth);
|
||||||
|
|
||||||
// Propagate the debuggee frame flag. For the case where the Debugger did
|
// Propagate the debuggee frame flag. For the case where the Debugger did
|
||||||
|
@ -1891,7 +1891,7 @@ jit::FinishBailoutToBaseline(BaselineBailoutInfo* bailoutInfo)
|
||||||
}
|
}
|
||||||
|
|
||||||
JitSpew(JitSpew_BaselineBailouts,
|
JitSpew(JitSpew_BaselineBailouts,
|
||||||
" Restored outerScript=(%s:%u,%u) innerScript=(%s:%u,%u) (bailoutKind=%u)",
|
" Restored outerScript=(%s:%" PRIuSIZE ",%u) innerScript=(%s:%" PRIuSIZE ",%u) (bailoutKind=%u)",
|
||||||
outerScript->filename(), outerScript->lineno(), outerScript->getWarmUpCount(),
|
outerScript->filename(), outerScript->lineno(), outerScript->getWarmUpCount(),
|
||||||
innerScript->filename(), innerScript->lineno(), innerScript->getWarmUpCount(),
|
innerScript->filename(), innerScript->lineno(), innerScript->getWarmUpCount(),
|
||||||
(unsigned) bailoutKind);
|
(unsigned) bailoutKind);
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include "jit/BaselineCompiler.h"
|
#include "jit/BaselineCompiler.h"
|
||||||
|
|
||||||
#include "mozilla/Casting.h"
|
#include "mozilla/Casting.h"
|
||||||
|
#include "mozilla/SizePrintfMacros.h"
|
||||||
|
|
||||||
#include "jit/BaselineIC.h"
|
#include "jit/BaselineIC.h"
|
||||||
#include "jit/BaselineJIT.h"
|
#include "jit/BaselineJIT.h"
|
||||||
|
@ -82,10 +83,10 @@ BaselineCompiler::addPCMappingEntry(bool addIndexEntry)
|
||||||
MethodStatus
|
MethodStatus
|
||||||
BaselineCompiler::compile()
|
BaselineCompiler::compile()
|
||||||
{
|
{
|
||||||
JitSpew(JitSpew_BaselineScripts, "Baseline compiling script %s:%d (%p)",
|
JitSpew(JitSpew_BaselineScripts, "Baseline compiling script %s:%" PRIuSIZE " (%p)",
|
||||||
script->filename(), script->lineno(), script);
|
script->filename(), script->lineno(), script);
|
||||||
|
|
||||||
JitSpew(JitSpew_Codegen, "# Emitting baseline code for script %s:%d",
|
JitSpew(JitSpew_Codegen, "# Emitting baseline code for script %s:%" PRIuSIZE,
|
||||||
script->filename(), script->lineno());
|
script->filename(), script->lineno());
|
||||||
|
|
||||||
TraceLoggerThread* logger = TraceLoggerForMainThread(cx->runtime());
|
TraceLoggerThread* logger = TraceLoggerForMainThread(cx->runtime());
|
||||||
|
@ -217,7 +218,7 @@ BaselineCompiler::compile()
|
||||||
baselineScript->setMethod(code);
|
baselineScript->setMethod(code);
|
||||||
baselineScript->setTemplateEnvironment(templateEnv);
|
baselineScript->setTemplateEnvironment(templateEnv);
|
||||||
|
|
||||||
JitSpew(JitSpew_BaselineScripts, "Created BaselineScript %p (raw %p) for %s:%d",
|
JitSpew(JitSpew_BaselineScripts, "Created BaselineScript %p (raw %p) for %s:%" PRIuSIZE,
|
||||||
(void*) baselineScript.get(), (void*) code->raw(),
|
(void*) baselineScript.get(), (void*) code->raw(),
|
||||||
script->filename(), script->lineno());
|
script->filename(), script->lineno());
|
||||||
|
|
||||||
|
@ -279,7 +280,7 @@ BaselineCompiler::compile()
|
||||||
// Always register a native => bytecode mapping entry, since profiler can be
|
// Always register a native => bytecode mapping entry, since profiler can be
|
||||||
// turned on with baseline jitcode on stack, and baseline jitcode cannot be invalidated.
|
// turned on with baseline jitcode on stack, and baseline jitcode cannot be invalidated.
|
||||||
{
|
{
|
||||||
JitSpew(JitSpew_Profiling, "Added JitcodeGlobalEntry for baseline script %s:%d (%p)",
|
JitSpew(JitSpew_Profiling, "Added JitcodeGlobalEntry for baseline script %s:%" PRIuSIZE " (%p)",
|
||||||
script->filename(), script->lineno(), baselineScript.get());
|
script->filename(), script->lineno(), baselineScript.get());
|
||||||
|
|
||||||
// Generate profiling string.
|
// Generate profiling string.
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include "jit/BaselineDebugModeOSR.h"
|
#include "jit/BaselineDebugModeOSR.h"
|
||||||
|
|
||||||
#include "mozilla/DebugOnly.h"
|
#include "mozilla/DebugOnly.h"
|
||||||
|
#include "mozilla/SizePrintfMacros.h"
|
||||||
|
|
||||||
#include "jit/BaselineIC.h"
|
#include "jit/BaselineIC.h"
|
||||||
#include "jit/JitcodeMap.h"
|
#include "jit/JitcodeMap.h"
|
||||||
|
@ -322,7 +323,7 @@ SpewPatchBaselineFrame(uint8_t* oldReturnAddress, uint8_t* newReturnAddress,
|
||||||
JSScript* script, ICEntry::Kind frameKind, jsbytecode* pc)
|
JSScript* script, ICEntry::Kind frameKind, jsbytecode* pc)
|
||||||
{
|
{
|
||||||
JitSpew(JitSpew_BaselineDebugModeOSR,
|
JitSpew(JitSpew_BaselineDebugModeOSR,
|
||||||
"Patch return %p -> %p on BaselineJS frame (%s:%d) from %s at %s",
|
"Patch return %p -> %p on BaselineJS frame (%s:%" PRIuSIZE ") from %s at %s",
|
||||||
oldReturnAddress, newReturnAddress, script->filename(), script->lineno(),
|
oldReturnAddress, newReturnAddress, script->filename(), script->lineno(),
|
||||||
ICEntryKindToString(frameKind), CodeName[(JSOp)*pc]);
|
ICEntryKindToString(frameKind), CodeName[(JSOp)*pc]);
|
||||||
}
|
}
|
||||||
|
@ -332,7 +333,7 @@ SpewPatchBaselineFrameFromExceptionHandler(uint8_t* oldReturnAddress, uint8_t* n
|
||||||
JSScript* script, jsbytecode* pc)
|
JSScript* script, jsbytecode* pc)
|
||||||
{
|
{
|
||||||
JitSpew(JitSpew_BaselineDebugModeOSR,
|
JitSpew(JitSpew_BaselineDebugModeOSR,
|
||||||
"Patch return %p -> %p on BaselineJS frame (%s:%d) from exception handler at %s",
|
"Patch return %p -> %p on BaselineJS frame (%s:%" PRIuSIZE ") from exception handler at %s",
|
||||||
oldReturnAddress, newReturnAddress, script->filename(), script->lineno(),
|
oldReturnAddress, newReturnAddress, script->filename(), script->lineno(),
|
||||||
CodeName[(JSOp)*pc]);
|
CodeName[(JSOp)*pc]);
|
||||||
}
|
}
|
||||||
|
@ -667,7 +668,7 @@ RecompileBaselineScriptForDebugMode(JSContext* cx, JSScript* script,
|
||||||
if (oldBaselineScript->hasDebugInstrumentation() == observing)
|
if (oldBaselineScript->hasDebugInstrumentation() == observing)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
JitSpew(JitSpew_BaselineDebugModeOSR, "Recompiling (%s:%d) for %s",
|
JitSpew(JitSpew_BaselineDebugModeOSR, "Recompiling (%s:%" PRIuSIZE ") for %s",
|
||||||
script->filename(), script->lineno(), observing ? "DEBUGGING" : "NORMAL EXECUTION");
|
script->filename(), script->lineno(), observing ? "DEBUGGING" : "NORMAL EXECUTION");
|
||||||
|
|
||||||
script->setBaselineScript(cx->runtime(), nullptr);
|
script->setBaselineScript(cx->runtime(), nullptr);
|
||||||
|
|
|
@ -2586,7 +2586,7 @@ DoSetElemFallback(JSContext* cx, BaselineFrame* frame, ICSetElem_Fallback* stub_
|
||||||
{
|
{
|
||||||
JitSpew(JitSpew_BaselineIC,
|
JitSpew(JitSpew_BaselineIC,
|
||||||
" Generating SetElem_DenseOrUnboxedArrayAdd stub "
|
" Generating SetElem_DenseOrUnboxedArrayAdd stub "
|
||||||
"(shape=%p, group=%p, protoDepth=%u)",
|
"(shape=%p, group=%p, protoDepth=%" PRIuSIZE ")",
|
||||||
shape.get(), group.get(), protoDepth);
|
shape.get(), group.get(), protoDepth);
|
||||||
ICSetElemDenseOrUnboxedArrayAddCompiler compiler(cx, obj, protoDepth);
|
ICSetElemDenseOrUnboxedArrayAddCompiler compiler(cx, obj, protoDepth);
|
||||||
ICUpdatedStub* newStub = compiler.getStub(compiler.getStubSpace(outerScript));
|
ICUpdatedStub* newStub = compiler.getStub(compiler.getStubSpace(outerScript));
|
||||||
|
|
|
@ -9244,7 +9244,7 @@ CodeGenerator::generateWasm(wasm::SigIdDesc sigId, wasm::TrapOffset trapOffset,
|
||||||
bool
|
bool
|
||||||
CodeGenerator::generate()
|
CodeGenerator::generate()
|
||||||
{
|
{
|
||||||
JitSpew(JitSpew_Codegen, "# Emitting code for script %s:%d",
|
JitSpew(JitSpew_Codegen, "# Emitting code for script %s:%" PRIuSIZE,
|
||||||
gen->info().script()->filename(),
|
gen->info().script()->filename(),
|
||||||
gen->info().script()->lineno());
|
gen->info().script()->lineno());
|
||||||
|
|
||||||
|
|
|
@ -402,7 +402,7 @@ DumpImprovement(MDefinition *load, MDefinitionVector& input, MDefinitionVector&
|
||||||
if (JitSpewEnabled(JitSpew_Alias)) {
|
if (JitSpewEnabled(JitSpew_Alias)) {
|
||||||
Fprinter &print = JitSpewPrinter();
|
Fprinter &print = JitSpewPrinter();
|
||||||
JitSpewHeader(JitSpew_Alias);
|
JitSpewHeader(JitSpew_Alias);
|
||||||
print.printf(" Improve dependency from ", load->id());
|
print.printf(" Improve dependency from %d", load->id());
|
||||||
DumpStoreList(input);
|
DumpStoreList(input);
|
||||||
print.printf(" to ");
|
print.printf(" to ");
|
||||||
DumpStoreList(output);
|
DumpStoreList(output);
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
#include "jit/Ion.h"
|
#include "jit/Ion.h"
|
||||||
|
|
||||||
|
#include "mozilla/IntegerPrintfMacros.h"
|
||||||
#include "mozilla/MemoryReporting.h"
|
#include "mozilla/MemoryReporting.h"
|
||||||
#include "mozilla/SizePrintfMacros.h"
|
#include "mozilla/SizePrintfMacros.h"
|
||||||
#include "mozilla/ThreadLocal.h"
|
#include "mozilla/ThreadLocal.h"
|
||||||
|
@ -2136,7 +2137,7 @@ TrackIonAbort(JSContext* cx, JSScript* script, jsbytecode* pc, const char* messa
|
||||||
static void
|
static void
|
||||||
TrackAndSpewIonAbort(JSContext* cx, JSScript* script, const char* message)
|
TrackAndSpewIonAbort(JSContext* cx, JSScript* script, const char* message)
|
||||||
{
|
{
|
||||||
JitSpew(JitSpew_IonAbort, message);
|
JitSpew(JitSpew_IonAbort, "%s", message);
|
||||||
TrackIonAbort(cx, script, script->code(), message);
|
TrackIonAbort(cx, script, script->code(), message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2395,7 +2396,7 @@ CheckScriptSize(JSContext* cx, JSScript* script)
|
||||||
numLocalsAndArgs > MAX_MAIN_THREAD_LOCALS_AND_ARGS)
|
numLocalsAndArgs > MAX_MAIN_THREAD_LOCALS_AND_ARGS)
|
||||||
{
|
{
|
||||||
if (!OffThreadCompilationAvailable(cx)) {
|
if (!OffThreadCompilationAvailable(cx)) {
|
||||||
JitSpew(JitSpew_IonAbort, "Script too large (%u bytes) (%u locals/args)",
|
JitSpew(JitSpew_IonAbort, "Script too large (%" PRIuSIZE " bytes) (%u locals/args)",
|
||||||
script->length(), numLocalsAndArgs);
|
script->length(), numLocalsAndArgs);
|
||||||
TrackIonAbort(cx, script, script->code(), "too large");
|
TrackIonAbort(cx, script, script->code(), "too large");
|
||||||
return Method_CantCompile;
|
return Method_CantCompile;
|
||||||
|
@ -3014,7 +3015,7 @@ InvalidateActivation(FreeOp* fop, const JitActivationIterator& activations, bool
|
||||||
#ifdef JS_JITSPEW
|
#ifdef JS_JITSPEW
|
||||||
switch (it.type()) {
|
switch (it.type()) {
|
||||||
case JitFrame_Exit:
|
case JitFrame_Exit:
|
||||||
JitSpew(JitSpew_IonInvalidate, "#%d exit frame @ %p", frameno, it.fp());
|
JitSpew(JitSpew_IonInvalidate, "#%" PRIuSIZE " exit frame @ %p", frameno, it.fp());
|
||||||
break;
|
break;
|
||||||
case JitFrame_BaselineJS:
|
case JitFrame_BaselineJS:
|
||||||
case JitFrame_IonJS:
|
case JitFrame_IonJS:
|
||||||
|
@ -3029,26 +3030,26 @@ InvalidateActivation(FreeOp* fop, const JitActivationIterator& activations, bool
|
||||||
else if (it.isBailoutJS())
|
else if (it.isBailoutJS())
|
||||||
type = "Bailing";
|
type = "Bailing";
|
||||||
JitSpew(JitSpew_IonInvalidate,
|
JitSpew(JitSpew_IonInvalidate,
|
||||||
"#%d %s JS frame @ %p, %s:%" PRIuSIZE " (fun: %p, script: %p, pc %p)",
|
"#%" PRIuSIZE " %s JS frame @ %p, %s:%" PRIuSIZE " (fun: %p, script: %p, pc %p)",
|
||||||
frameno, type, it.fp(), it.script()->maybeForwardedFilename(),
|
frameno, type, it.fp(), it.script()->maybeForwardedFilename(),
|
||||||
it.script()->lineno(), it.maybeCallee(), (JSScript*)it.script(),
|
it.script()->lineno(), it.maybeCallee(), (JSScript*)it.script(),
|
||||||
it.returnAddressToFp());
|
it.returnAddressToFp());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case JitFrame_IonStub:
|
case JitFrame_IonStub:
|
||||||
JitSpew(JitSpew_IonInvalidate, "#%d ion stub frame @ %p", frameno, it.fp());
|
JitSpew(JitSpew_IonInvalidate, "#%" PRIuSIZE " ion stub frame @ %p", frameno, it.fp());
|
||||||
break;
|
break;
|
||||||
case JitFrame_BaselineStub:
|
case JitFrame_BaselineStub:
|
||||||
JitSpew(JitSpew_IonInvalidate, "#%d baseline stub frame @ %p", frameno, it.fp());
|
JitSpew(JitSpew_IonInvalidate, "#%" PRIuSIZE " baseline stub frame @ %p", frameno, it.fp());
|
||||||
break;
|
break;
|
||||||
case JitFrame_Rectifier:
|
case JitFrame_Rectifier:
|
||||||
JitSpew(JitSpew_IonInvalidate, "#%d rectifier frame @ %p", frameno, it.fp());
|
JitSpew(JitSpew_IonInvalidate, "#%" PRIuSIZE " rectifier frame @ %p", frameno, it.fp());
|
||||||
break;
|
break;
|
||||||
case JitFrame_IonAccessorIC:
|
case JitFrame_IonAccessorIC:
|
||||||
JitSpew(JitSpew_IonInvalidate, "#%d ion IC getter/setter frame @ %p", frameno, it.fp());
|
JitSpew(JitSpew_IonInvalidate, "#%" PRIuSIZE " ion IC getter/setter frame @ %p", frameno, it.fp());
|
||||||
break;
|
break;
|
||||||
case JitFrame_Entry:
|
case JitFrame_Entry:
|
||||||
JitSpew(JitSpew_IonInvalidate, "#%d entry frame @ %p", frameno, it.fp());
|
JitSpew(JitSpew_IonInvalidate, "#%" PRIuSIZE " entry frame @ %p", frameno, it.fp());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif // JS_JITSPEW
|
#endif // JS_JITSPEW
|
||||||
|
@ -3143,7 +3144,7 @@ InvalidateActivation(FreeOp* fop, const JitActivationIterator& activations, bool
|
||||||
CodeLocationLabel osiPatchPoint = SafepointReader::InvalidationPatchPoint(ionScript, si);
|
CodeLocationLabel osiPatchPoint = SafepointReader::InvalidationPatchPoint(ionScript, si);
|
||||||
CodeLocationLabel invalidateEpilogue(ionCode, CodeOffset(ionScript->invalidateEpilogueOffset()));
|
CodeLocationLabel invalidateEpilogue(ionCode, CodeOffset(ionScript->invalidateEpilogueOffset()));
|
||||||
|
|
||||||
JitSpew(JitSpew_IonInvalidate, " ! Invalidate ionScript %p (inv count %u) -> patching osipoint %p",
|
JitSpew(JitSpew_IonInvalidate, " ! Invalidate ionScript %p (inv count %" PRIuSIZE ") -> patching osipoint %p",
|
||||||
ionScript, ionScript->invalidationCount(), (void*) osiPatchPoint.raw());
|
ionScript, ionScript->invalidationCount(), (void*) osiPatchPoint.raw());
|
||||||
Assembler::PatchWrite_NearCall(osiPatchPoint, invalidateEpilogue);
|
Assembler::PatchWrite_NearCall(osiPatchPoint, invalidateEpilogue);
|
||||||
}
|
}
|
||||||
|
@ -3360,7 +3361,7 @@ AutoFlushICache::setRange(uintptr_t start, size_t len)
|
||||||
AutoFlushICache* afc = TlsPerThreadData.get()->PerThreadData::autoFlushICache();
|
AutoFlushICache* afc = TlsPerThreadData.get()->PerThreadData::autoFlushICache();
|
||||||
MOZ_ASSERT(afc);
|
MOZ_ASSERT(afc);
|
||||||
MOZ_ASSERT(!afc->start_);
|
MOZ_ASSERT(!afc->start_);
|
||||||
JitSpewCont(JitSpew_CacheFlush, "(%x %x):", start, len);
|
JitSpewCont(JitSpew_CacheFlush, "(%" PRIxPTR " %" PRIxSIZE "):", start, len);
|
||||||
|
|
||||||
uintptr_t stop = start + len;
|
uintptr_t stop = start + len;
|
||||||
afc->start_ = start;
|
afc->start_ = start;
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
|
|
||||||
#include "jit/IonAnalysis.h"
|
#include "jit/IonAnalysis.h"
|
||||||
|
|
||||||
|
#include "mozilla/SizePrintfMacros.h"
|
||||||
|
|
||||||
#include "jit/AliasAnalysis.h"
|
#include "jit/AliasAnalysis.h"
|
||||||
#include "jit/BaselineInspector.h"
|
#include "jit/BaselineInspector.h"
|
||||||
#include "jit/BaselineJIT.h"
|
#include "jit/BaselineJIT.h"
|
||||||
|
@ -445,9 +447,10 @@ jit::PruneUnusedBranches(MIRGenerator* mir, MIRGraph& graph)
|
||||||
shouldBailout = false;
|
shouldBailout = false;
|
||||||
|
|
||||||
JitSpew(JitSpew_Prune, "info: block %d,"
|
JitSpew(JitSpew_Prune, "info: block %d,"
|
||||||
" predCount: %lu, domInst: %lu, span: %lu, effectful: %lu, "
|
" predCount: %" PRIuSIZE ", domInst: %" PRIuSIZE
|
||||||
" isLoopExit: %s, numSuccessorsOfPred: %lu."
|
", span: %" PRIuSIZE ", effectful: %" PRIuSIZE ", "
|
||||||
" (score: %lu, shouldBailout: %s)",
|
" isLoopExit: %s, numSuccessorsOfPred: %" PRIuSIZE "."
|
||||||
|
" (score: %" PRIuSIZE ", shouldBailout: %s)",
|
||||||
block->id(), predCount, numDominatedInst, branchSpan, numEffectfulInst,
|
block->id(), predCount, numDominatedInst, branchSpan, numEffectfulInst,
|
||||||
isLoopExit ? "true" : "false", numSuccessorsOfPreds,
|
isLoopExit ? "true" : "false", numSuccessorsOfPreds,
|
||||||
score, shouldBailout ? "true" : "false");
|
score, shouldBailout ? "true" : "false");
|
||||||
|
|
|
@ -229,7 +229,7 @@ class IonBuilder
|
||||||
MOZ_MUST_USE bool inspectOpcode(JSOp op);
|
MOZ_MUST_USE bool inspectOpcode(JSOp op);
|
||||||
uint32_t readIndex(jsbytecode* pc);
|
uint32_t readIndex(jsbytecode* pc);
|
||||||
JSAtom* readAtom(jsbytecode* pc);
|
JSAtom* readAtom(jsbytecode* pc);
|
||||||
bool abort(const char* message, ...);
|
bool abort(const char* message, ...) MOZ_FORMAT_PRINTF(2, 3);
|
||||||
void trackActionableAbort(const char* message);
|
void trackActionableAbort(const char* message);
|
||||||
void spew(const char* message);
|
void spew(const char* message);
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
|
|
||||||
#include "jit/JSONSpewer.h"
|
#include "jit/JSONSpewer.h"
|
||||||
|
|
||||||
|
#include "mozilla/SizePrintfMacros.h"
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
#include "jit/BacktrackingAllocator.h"
|
#include "jit/BacktrackingAllocator.h"
|
||||||
|
@ -146,7 +148,7 @@ JSONSpewer::beginFunction(JSScript* script)
|
||||||
{
|
{
|
||||||
beginObject();
|
beginObject();
|
||||||
if (script)
|
if (script)
|
||||||
stringProperty("name", "%s:%d", script->filename(), script->lineno());
|
stringProperty("name", "%s:%" PRIuSIZE, script->filename(), script->lineno());
|
||||||
else
|
else
|
||||||
stringProperty("name", "asm.js compilation");
|
stringProperty("name", "asm.js compilation");
|
||||||
beginListProperty("passes");
|
beginListProperty("passes");
|
||||||
|
@ -156,7 +158,7 @@ void
|
||||||
JSONSpewer::beginPass(const char* pass)
|
JSONSpewer::beginPass(const char* pass)
|
||||||
{
|
{
|
||||||
beginObject();
|
beginObject();
|
||||||
stringProperty("name", pass);
|
stringProperty("name", "%s", pass);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -36,8 +36,8 @@ class JSONSpewer
|
||||||
void beginObject();
|
void beginObject();
|
||||||
void beginObjectProperty(const char* name);
|
void beginObjectProperty(const char* name);
|
||||||
void beginListProperty(const char* name);
|
void beginListProperty(const char* name);
|
||||||
void stringValue(const char* format, ...);
|
void stringValue(const char* format, ...) MOZ_FORMAT_PRINTF(2, 3);
|
||||||
void stringProperty(const char* name, const char* format, ...);
|
void stringProperty(const char* name, const char* format, ...) MOZ_FORMAT_PRINTF(3, 4);
|
||||||
void beginStringProperty(const char* name);
|
void beginStringProperty(const char* name);
|
||||||
void endStringProperty();
|
void endStringProperty();
|
||||||
void integerValue(int value);
|
void integerValue(int value);
|
||||||
|
|
|
@ -172,9 +172,9 @@ class JitSpewIndent
|
||||||
~JitSpewIndent();
|
~JitSpewIndent();
|
||||||
};
|
};
|
||||||
|
|
||||||
void JitSpew(JitSpewChannel channel, const char* fmt, ...);
|
void JitSpew(JitSpewChannel channel, const char* fmt, ...) MOZ_FORMAT_PRINTF(2, 3);
|
||||||
void JitSpewStart(JitSpewChannel channel, const char* fmt, ...);
|
void JitSpewStart(JitSpewChannel channel, const char* fmt, ...) MOZ_FORMAT_PRINTF(2, 3);
|
||||||
void JitSpewCont(JitSpewChannel channel, const char* fmt, ...);
|
void JitSpewCont(JitSpewChannel channel, const char* fmt, ...) MOZ_FORMAT_PRINTF(2, 3);
|
||||||
void JitSpewFin(JitSpewChannel channel);
|
void JitSpewFin(JitSpewChannel channel);
|
||||||
void JitSpewHeader(JitSpewChannel channel);
|
void JitSpewHeader(JitSpewChannel channel);
|
||||||
bool JitSpewEnabled(JitSpewChannel channel);
|
bool JitSpewEnabled(JitSpewChannel channel);
|
||||||
|
|
|
@ -72,7 +72,7 @@ class MIRGenerator
|
||||||
|
|
||||||
// Set an error state and prints a message. Returns false so errors can be
|
// Set an error state and prints a message. Returns false so errors can be
|
||||||
// propagated up.
|
// propagated up.
|
||||||
bool abort(const char* message, ...); // always returns false
|
bool abort(const char* message, ...) MOZ_FORMAT_PRINTF(2, 3); // always returns false
|
||||||
bool abortFmt(const char* message, va_list ap); // always returns false
|
bool abortFmt(const char* message, va_list ap); // always returns false
|
||||||
|
|
||||||
bool errored() const {
|
bool errored() const {
|
||||||
|
|
|
@ -326,7 +326,7 @@ UniqueTrackedOptimizations::sortByFrequency(JSContext* cx)
|
||||||
MOZ_ASSERT(p);
|
MOZ_ASSERT(p);
|
||||||
p->value().index = sorted_.length();
|
p->value().index = sorted_.length();
|
||||||
|
|
||||||
JitSpew(JitSpew_OptimizationTracking, " Entry %u has frequency %u",
|
JitSpew(JitSpew_OptimizationTracking, " Entry %" PRIuSIZE " has frequency %" PRIu32,
|
||||||
sorted_.length(), p->value().frequency);
|
sorted_.length(), p->value().frequency);
|
||||||
|
|
||||||
if (!sorted_.append(entries[i]))
|
if (!sorted_.append(entries[i]))
|
||||||
|
@ -765,14 +765,14 @@ IonTrackedOptimizationsRegion::WriteRun(CompactBufferWriter& writer,
|
||||||
const UniqueTrackedOptimizations& unique)
|
const UniqueTrackedOptimizations& unique)
|
||||||
{
|
{
|
||||||
// Write the header, which is the range that this whole run encompasses.
|
// Write the header, which is the range that this whole run encompasses.
|
||||||
JitSpew(JitSpew_OptimizationTracking, " Header: [%u, %u]",
|
JitSpew(JitSpew_OptimizationTracking, " Header: [%" PRIuSIZE ", %" PRIuSIZE "]",
|
||||||
start->startOffset.offset(), (end - 1)->endOffset.offset());
|
start->startOffset.offset(), (end - 1)->endOffset.offset());
|
||||||
writer.writeUnsigned(start->startOffset.offset());
|
writer.writeUnsigned(start->startOffset.offset());
|
||||||
writer.writeUnsigned((end - 1)->endOffset.offset());
|
writer.writeUnsigned((end - 1)->endOffset.offset());
|
||||||
|
|
||||||
// Write the first entry of the run, which is not delta-encoded.
|
// Write the first entry of the run, which is not delta-encoded.
|
||||||
JitSpew(JitSpew_OptimizationTracking,
|
JitSpew(JitSpew_OptimizationTracking,
|
||||||
" [%6u, %6u] vector %3u, offset %4u",
|
" [%6" PRIuSIZE ", %6" PRIuSIZE "] vector %3u, offset %4" PRIuSIZE,
|
||||||
start->startOffset.offset(), start->endOffset.offset(),
|
start->startOffset.offset(), start->endOffset.offset(),
|
||||||
unique.indexOf(start->optimizations), writer.length());
|
unique.indexOf(start->optimizations), writer.length());
|
||||||
uint32_t prevEndOffset = start->endOffset.offset();
|
uint32_t prevEndOffset = start->endOffset.offset();
|
||||||
|
@ -789,7 +789,7 @@ IonTrackedOptimizationsRegion::WriteRun(CompactBufferWriter& writer,
|
||||||
uint8_t index = unique.indexOf(entry->optimizations);
|
uint8_t index = unique.indexOf(entry->optimizations);
|
||||||
|
|
||||||
JitSpew(JitSpew_OptimizationTracking,
|
JitSpew(JitSpew_OptimizationTracking,
|
||||||
" [%6u, %6u] delta [+%5u, +%5u] vector %3u, offset %4u",
|
" [%6u, %6u] delta [+%5u, +%5u] vector %3u, offset %4" PRIuSIZE,
|
||||||
startOffset, endOffset, startDelta, length, index, writer.length());
|
startOffset, endOffset, startDelta, length, index, writer.length());
|
||||||
|
|
||||||
WriteDelta(writer, startDelta, length, index);
|
WriteDelta(writer, startDelta, length, index);
|
||||||
|
@ -825,7 +825,7 @@ WriteOffsetsTable(CompactBufferWriter& writer, const Vector<uint32_t, 16>& offse
|
||||||
|
|
||||||
// Write entry offset table.
|
// Write entry offset table.
|
||||||
for (size_t i = 0; i < offsets.length(); i++) {
|
for (size_t i = 0; i < offsets.length(); i++) {
|
||||||
JitSpew(JitSpew_OptimizationTracking, " Entry %u reverse offset %u",
|
JitSpew(JitSpew_OptimizationTracking, " Entry %" PRIuSIZE " reverse offset %u",
|
||||||
i, tableOffset - padding - offsets[i]);
|
i, tableOffset - padding - offsets[i]);
|
||||||
writer.writeNativeEndianUint32_t(tableOffset - padding - offsets[i]);
|
writer.writeNativeEndianUint32_t(tableOffset - padding - offsets[i]);
|
||||||
}
|
}
|
||||||
|
@ -919,7 +919,7 @@ jit::WriteIonTrackedOptimizationsTable(JSContext* cx, CompactBufferWriter& write
|
||||||
if (JitSpewEnabled(JitSpew_OptimizationTracking)) {
|
if (JitSpewEnabled(JitSpew_OptimizationTracking)) {
|
||||||
JitSpewStart(JitSpew_OptimizationTracking, "=> Training data: ");
|
JitSpewStart(JitSpew_OptimizationTracking, "=> Training data: ");
|
||||||
for (const NativeToTrackedOptimizations* entry = start; entry != end; entry++) {
|
for (const NativeToTrackedOptimizations* entry = start; entry != end; entry++) {
|
||||||
JitSpewCont(JitSpew_OptimizationTracking, "%u,%u,%u ",
|
JitSpewCont(JitSpew_OptimizationTracking, "%" PRIuSIZE ",%" PRIuSIZE ",%u ",
|
||||||
entry->startOffset.offset(), entry->endOffset.offset(),
|
entry->startOffset.offset(), entry->endOffset.offset(),
|
||||||
unique.indexOf(entry->optimizations));
|
unique.indexOf(entry->optimizations));
|
||||||
}
|
}
|
||||||
|
@ -934,7 +934,8 @@ jit::WriteIonTrackedOptimizationsTable(JSContext* cx, CompactBufferWriter& write
|
||||||
JitSpew(JitSpew_Profiling, "=> Writing regions");
|
JitSpew(JitSpew_Profiling, "=> Writing regions");
|
||||||
while (entry != end) {
|
while (entry != end) {
|
||||||
uint32_t runLength = IonTrackedOptimizationsRegion::ExpectedRunLength(entry, end);
|
uint32_t runLength = IonTrackedOptimizationsRegion::ExpectedRunLength(entry, end);
|
||||||
JitSpew(JitSpew_OptimizationTracking, " Run at entry %u, length %u, offset %u",
|
JitSpew(JitSpew_OptimizationTracking,
|
||||||
|
" Run at entry %" PRIuSIZE ", length %" PRIu32 ", offset %" PRIuSIZE,
|
||||||
entry - start, runLength, writer.length());
|
entry - start, runLength, writer.length());
|
||||||
|
|
||||||
if (!offsets.append(writer.length()))
|
if (!offsets.append(writer.length()))
|
||||||
|
@ -957,7 +958,7 @@ jit::WriteIonTrackedOptimizationsTable(JSContext* cx, CompactBufferWriter& write
|
||||||
offsets.clear();
|
offsets.clear();
|
||||||
|
|
||||||
const UniqueTrackedOptimizations::SortedVector& vec = unique.sortedVector();
|
const UniqueTrackedOptimizations::SortedVector& vec = unique.sortedVector();
|
||||||
JitSpew(JitSpew_OptimizationTracking, "=> Writing unique optimizations table with %u entr%s",
|
JitSpew(JitSpew_OptimizationTracking, "=> Writing unique optimizations table with %" PRIuSIZE " entr%s",
|
||||||
vec.length(), vec.length() == 1 ? "y" : "ies");
|
vec.length(), vec.length() == 1 ? "y" : "ies");
|
||||||
|
|
||||||
// Write out type info payloads.
|
// Write out type info payloads.
|
||||||
|
@ -967,7 +968,8 @@ jit::WriteIonTrackedOptimizationsTable(JSContext* cx, CompactBufferWriter& write
|
||||||
|
|
||||||
for (const UniqueTrackedOptimizations::SortEntry* p = vec.begin(); p != vec.end(); p++) {
|
for (const UniqueTrackedOptimizations::SortEntry* p = vec.begin(); p != vec.end(); p++) {
|
||||||
const TempOptimizationTypeInfoVector* v = p->types;
|
const TempOptimizationTypeInfoVector* v = p->types;
|
||||||
JitSpew(JitSpew_OptimizationTracking, " Type info entry %u of length %u, offset %u",
|
JitSpew(JitSpew_OptimizationTracking,
|
||||||
|
" Type info entry %" PRIuSIZE " of length %" PRIuSIZE ", offset %" PRIuSIZE,
|
||||||
p - vec.begin(), v->length(), writer.length());
|
p - vec.begin(), v->length(), writer.length());
|
||||||
SpewTempOptimizationTypeInfoVector(v, " ");
|
SpewTempOptimizationTypeInfoVector(v, " ");
|
||||||
|
|
||||||
|
@ -1017,7 +1019,8 @@ jit::WriteIonTrackedOptimizationsTable(JSContext* cx, CompactBufferWriter& write
|
||||||
// Write out attempts payloads.
|
// Write out attempts payloads.
|
||||||
for (const UniqueTrackedOptimizations::SortEntry* p = vec.begin(); p != vec.end(); p++) {
|
for (const UniqueTrackedOptimizations::SortEntry* p = vec.begin(); p != vec.end(); p++) {
|
||||||
const TempOptimizationAttemptsVector* v = p->attempts;
|
const TempOptimizationAttemptsVector* v = p->attempts;
|
||||||
JitSpew(JitSpew_OptimizationTracking, " Attempts entry %u of length %u, offset %u",
|
JitSpew(JitSpew_OptimizationTracking,
|
||||||
|
" Attempts entry %" PRIuSIZE " of length %" PRIuSIZE ", offset %" PRIuSIZE,
|
||||||
p - vec.begin(), v->length(), writer.length());
|
p - vec.begin(), v->length(), writer.length());
|
||||||
SpewTempOptimizationAttemptsVector(v, " ");
|
SpewTempOptimizationAttemptsVector(v, " ");
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
|
|
||||||
#include "jit/Recover.h"
|
#include "jit/Recover.h"
|
||||||
|
|
||||||
|
#include "mozilla/SizePrintfMacros.h"
|
||||||
|
|
||||||
#include "jsapi.h"
|
#include "jsapi.h"
|
||||||
#include "jscntxt.h"
|
#include "jscntxt.h"
|
||||||
#include "jsmath.h"
|
#include "jsmath.h"
|
||||||
|
@ -123,7 +125,7 @@ MResumePoint::writeRecoverData(CompactBufferWriter& writer) const
|
||||||
uint32_t formalArgs = CountArgSlots(script, fun);
|
uint32_t formalArgs = CountArgSlots(script, fun);
|
||||||
uint32_t nallocs = formalArgs + script->nfixed() + exprStack;
|
uint32_t nallocs = formalArgs + script->nfixed() + exprStack;
|
||||||
|
|
||||||
JitSpew(JitSpew_IonSnapshots, "Starting frame; implicit %u, formals %u, fixed %u, exprs %u",
|
JitSpew(JitSpew_IonSnapshots, "Starting frame; implicit %u, formals %u, fixed %" PRIuSIZE ", exprs %u",
|
||||||
implicit, formalArgs - implicit, script->nfixed(), exprStack);
|
implicit, formalArgs - implicit, script->nfixed(), exprStack);
|
||||||
|
|
||||||
uint32_t pcoff = script->pcToOffset(pc());
|
uint32_t pcoff = script->pcToOffset(pc());
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include "jit/Safepoints.h"
|
#include "jit/Safepoints.h"
|
||||||
|
|
||||||
#include "mozilla/MathAlgorithms.h"
|
#include "mozilla/MathAlgorithms.h"
|
||||||
|
#include "mozilla/SizePrintfMacros.h"
|
||||||
|
|
||||||
#include "jit/BitSet.h"
|
#include "jit/BitSet.h"
|
||||||
#include "jit/JitSpewer.h"
|
#include "jit/JitSpewer.h"
|
||||||
|
@ -31,7 +32,7 @@ SafepointWriter::init(TempAllocator& alloc)
|
||||||
uint32_t
|
uint32_t
|
||||||
SafepointWriter::startEntry()
|
SafepointWriter::startEntry()
|
||||||
{
|
{
|
||||||
JitSpew(JitSpew_Safepoints, "Encoding safepoint (position %d):", stream_.length());
|
JitSpew(JitSpew_Safepoints, "Encoding safepoint (position %" PRIuSIZE "):", stream_.length());
|
||||||
return uint32_t(stream_.length());
|
return uint32_t(stream_.length());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2132,7 +2132,7 @@ UpdateExistingGenerationalDOMProxyStub(ICGetProp_Fallback* stub,
|
||||||
// Update generation
|
// Update generation
|
||||||
uint64_t generation = expandoAndGeneration->generation;
|
uint64_t generation = expandoAndGeneration->generation;
|
||||||
JitSpew(JitSpew_BaselineIC,
|
JitSpew(JitSpew_BaselineIC,
|
||||||
" Updating existing stub with generation, old value: %i, "
|
" Updating existing stub with generation, old value: %" PRIu64 ", "
|
||||||
"new value: %" PRIu64 "", updateStub->generation(),
|
"new value: %" PRIu64 "", updateStub->generation(),
|
||||||
generation);
|
generation);
|
||||||
updateStub->setGeneration(generation);
|
updateStub->setGeneration(generation);
|
||||||
|
|
|
@ -202,8 +202,10 @@ class ICFallbackStub;
|
||||||
#undef FORWARD_DECLARE_STUBS
|
#undef FORWARD_DECLARE_STUBS
|
||||||
|
|
||||||
#ifdef JS_JITSPEW
|
#ifdef JS_JITSPEW
|
||||||
void FallbackICSpew(JSContext* cx, ICFallbackStub* stub, const char* fmt, ...);
|
void FallbackICSpew(JSContext* cx, ICFallbackStub* stub, const char* fmt, ...)
|
||||||
void TypeFallbackICSpew(JSContext* cx, ICTypeMonitor_Fallback* stub, const char* fmt, ...);
|
MOZ_FORMAT_PRINTF(3, 4);
|
||||||
|
void TypeFallbackICSpew(JSContext* cx, ICTypeMonitor_Fallback* stub, const char* fmt, ...)
|
||||||
|
MOZ_FORMAT_PRINTF(3, 4);
|
||||||
#else
|
#else
|
||||||
#define FallbackICSpew(...)
|
#define FallbackICSpew(...)
|
||||||
#define TypeFallbackICSpew(...)
|
#define TypeFallbackICSpew(...)
|
||||||
|
|
|
@ -996,7 +996,7 @@ ValueNumberer::visitBlock(MBasicBlock* block, const MBasicBlock* dominatorRoot)
|
||||||
bool
|
bool
|
||||||
ValueNumberer::visitDominatorTree(MBasicBlock* dominatorRoot)
|
ValueNumberer::visitDominatorTree(MBasicBlock* dominatorRoot)
|
||||||
{
|
{
|
||||||
JitSpew(JitSpew_GVN, " Visiting dominator tree (with %llu blocks) rooted at block%u%s",
|
JitSpew(JitSpew_GVN, " Visiting dominator tree (with %" PRIu64 " blocks) rooted at block%u%s",
|
||||||
uint64_t(dominatorRoot->numDominated()), dominatorRoot->id(),
|
uint64_t(dominatorRoot->numDominated()), dominatorRoot->id(),
|
||||||
dominatorRoot == graph_.entryBlock() ? " (normal entry block)" :
|
dominatorRoot == graph_.entryBlock() ? " (normal entry block)" :
|
||||||
dominatorRoot == graph_.osrBlock() ? " (OSR entry block)" :
|
dominatorRoot == graph_.osrBlock() ? " (OSR entry block)" :
|
||||||
|
@ -1222,7 +1222,7 @@ ValueNumberer::run(UpdateAliasAnalysisFlag updateAliasAnalysis)
|
||||||
{
|
{
|
||||||
updateAliasAnalysis_ = updateAliasAnalysis == UpdateAliasAnalysis;
|
updateAliasAnalysis_ = updateAliasAnalysis == UpdateAliasAnalysis;
|
||||||
|
|
||||||
JitSpew(JitSpew_GVN, "Running GVN on graph (with %llu blocks)",
|
JitSpew(JitSpew_GVN, "Running GVN on graph (with %" PRIu64 " blocks)",
|
||||||
uint64_t(graph_.numBlocks()));
|
uint64_t(graph_.numBlocks()));
|
||||||
|
|
||||||
// Adding fixup blocks only make sense iff we have a second entry point into
|
// Adding fixup blocks only make sense iff we have a second entry point into
|
||||||
|
@ -1282,7 +1282,7 @@ ValueNumberer::run(UpdateAliasAnalysisFlag updateAliasAnalysis)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
JitSpew(JitSpew_GVN, "Re-running GVN on graph (run %d, now with %llu blocks)",
|
JitSpew(JitSpew_GVN, "Re-running GVN on graph (run %d, now with %" PRIu64 " blocks)",
|
||||||
runs, uint64_t(graph_.numBlocks()));
|
runs, uint64_t(graph_.numBlocks()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1363,7 +1363,7 @@ class Assembler : public AssemblerShared
|
||||||
uint32_t spewResolve(Label* l);
|
uint32_t spewResolve(Label* l);
|
||||||
uint32_t spewProbe(Label* l);
|
uint32_t spewProbe(Label* l);
|
||||||
uint32_t spewDefine(Label* l);
|
uint32_t spewDefine(Label* l);
|
||||||
void spew(const char* fmt, ...);
|
void spew(const char* fmt, ...) MOZ_FORMAT_PRINTF(2, 3);
|
||||||
void spew(const char* fmt, va_list args);
|
void spew(const char* fmt, va_list args);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,7 @@ namespace disasm {
|
||||||
|
|
||||||
// Helper function for printing to a Vector.
|
// Helper function for printing to a Vector.
|
||||||
static int
|
static int
|
||||||
|
MOZ_FORMAT_PRINTF(2, 3)
|
||||||
SNPrintF(V8Vector<char> str, const char* format, ...)
|
SNPrintF(V8Vector<char> str, const char* format, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include "jit/shared/CodeGenerator-shared-inl.h"
|
#include "jit/shared/CodeGenerator-shared-inl.h"
|
||||||
|
|
||||||
#include "mozilla/DebugOnly.h"
|
#include "mozilla/DebugOnly.h"
|
||||||
|
#include "mozilla/SizePrintfMacros.h"
|
||||||
|
|
||||||
#include "jit/CompactBuffer.h"
|
#include "jit/CompactBuffer.h"
|
||||||
#include "jit/IonCaches.h"
|
#include "jit/IonCaches.h"
|
||||||
|
@ -233,7 +234,7 @@ CodeGeneratorShared::addNativeToBytecodeEntry(const BytecodeSite* site)
|
||||||
// bytecodeOffset, but the nativeOffset has changed, do nothing.
|
// bytecodeOffset, but the nativeOffset has changed, do nothing.
|
||||||
// The same site just generated some more code.
|
// The same site just generated some more code.
|
||||||
if (lastEntry.tree == tree && lastEntry.pc == pc) {
|
if (lastEntry.tree == tree && lastEntry.pc == pc) {
|
||||||
JitSpew(JitSpew_Profiling, " => In-place update [%u-%u]",
|
JitSpew(JitSpew_Profiling, " => In-place update [%" PRIuSIZE "-%" PRIu32 "]",
|
||||||
lastEntry.nativeOffset.offset(), nativeOffset);
|
lastEntry.nativeOffset.offset(), nativeOffset);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -280,7 +281,7 @@ CodeGeneratorShared::dumpNativeToBytecodeEntries()
|
||||||
{
|
{
|
||||||
#ifdef JS_JITSPEW
|
#ifdef JS_JITSPEW
|
||||||
InlineScriptTree* topTree = gen->info().inlineScriptTree();
|
InlineScriptTree* topTree = gen->info().inlineScriptTree();
|
||||||
JitSpewStart(JitSpew_Profiling, "Native To Bytecode Entries for %s:%d\n",
|
JitSpewStart(JitSpew_Profiling, "Native To Bytecode Entries for %s:%" PRIuSIZE "\n",
|
||||||
topTree->script()->filename(), topTree->script()->lineno());
|
topTree->script()->filename(), topTree->script()->lineno());
|
||||||
for (unsigned i = 0; i < nativeToBytecodeList_.length(); i++)
|
for (unsigned i = 0; i < nativeToBytecodeList_.length(); i++)
|
||||||
dumpNativeToBytecodeEntry(i);
|
dumpNativeToBytecodeEntry(i);
|
||||||
|
@ -303,16 +304,16 @@ CodeGeneratorShared::dumpNativeToBytecodeEntry(uint32_t idx)
|
||||||
if (nextRef->tree == ref.tree)
|
if (nextRef->tree == ref.tree)
|
||||||
pcDelta = nextRef->pc - ref.pc;
|
pcDelta = nextRef->pc - ref.pc;
|
||||||
}
|
}
|
||||||
JitSpewStart(JitSpew_Profiling, " %08x [+%-6d] => %-6d [%-4d] {%-10s} (%s:%d",
|
JitSpewStart(JitSpew_Profiling, " %08" PRIxSIZE " [+%-6d] => %-6ld [%-4d] {%-10s} (%s:%" PRIuSIZE,
|
||||||
ref.nativeOffset.offset(),
|
ref.nativeOffset.offset(),
|
||||||
nativeDelta,
|
nativeDelta,
|
||||||
ref.pc - script->code(),
|
(long) (ref.pc - script->code()),
|
||||||
pcDelta,
|
pcDelta,
|
||||||
CodeName[JSOp(*ref.pc)],
|
CodeName[JSOp(*ref.pc)],
|
||||||
script->filename(), script->lineno());
|
script->filename(), script->lineno());
|
||||||
|
|
||||||
for (tree = tree->caller(); tree; tree = tree->caller()) {
|
for (tree = tree->caller(); tree; tree = tree->caller()) {
|
||||||
JitSpewCont(JitSpew_Profiling, " <= %s:%d", tree->script()->filename(),
|
JitSpewCont(JitSpew_Profiling, " <= %s:%" PRIuSIZE, tree->script()->filename(),
|
||||||
tree->script()->lineno());
|
tree->script()->lineno());
|
||||||
}
|
}
|
||||||
JitSpewCont(JitSpew_Profiling, ")");
|
JitSpewCont(JitSpew_Profiling, ")");
|
||||||
|
@ -927,7 +928,7 @@ CodeGeneratorShared::generateCompactTrackedOptimizationsMap(JSContext* cx, JitCo
|
||||||
"== Compact Native To Optimizations Map [%p-%p] size %u",
|
"== Compact Native To Optimizations Map [%p-%p] size %u",
|
||||||
data, data + trackedOptimizationsMapSize_, trackedOptimizationsMapSize_);
|
data, data + trackedOptimizationsMapSize_, trackedOptimizationsMapSize_);
|
||||||
JitSpew(JitSpew_OptimizationTracking,
|
JitSpew(JitSpew_OptimizationTracking,
|
||||||
" with type list of length %u, size %u",
|
" with type list of length %" PRIuSIZE ", size %" PRIuSIZE,
|
||||||
allTypes->length(), allTypes->length() * sizeof(IonTrackedTypeWithAddendum));
|
allTypes->length(), allTypes->length() * sizeof(IonTrackedTypeWithAddendum));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#define jit_shared_IonAssemblerBufferWithConstantPools_h
|
#define jit_shared_IonAssemblerBufferWithConstantPools_h
|
||||||
|
|
||||||
#include "mozilla/MathAlgorithms.h"
|
#include "mozilla/MathAlgorithms.h"
|
||||||
|
#include "mozilla/SizePrintfMacros.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
@ -792,7 +793,7 @@ struct AssemblerBufferWithConstantPools : public AssemblerBuffer<SliceSize, Inst
|
||||||
if (numPoolEntries)
|
if (numPoolEntries)
|
||||||
JitSpew(JitSpew_Pools, "[%d] Inserting pool entry caused a spill", id);
|
JitSpew(JitSpew_Pools, "[%d] Inserting pool entry caused a spill", id);
|
||||||
else
|
else
|
||||||
JitSpew(JitSpew_Pools, "[%d] Inserting instruction(%d) caused a spill", id,
|
JitSpew(JitSpew_Pools, "[%d] Inserting instruction(%" PRIuSIZE ") caused a spill", id,
|
||||||
sizeExcludingCurrentPool());
|
sizeExcludingCurrentPool());
|
||||||
|
|
||||||
finishPool();
|
finishPool();
|
||||||
|
@ -863,7 +864,7 @@ struct AssemblerBufferWithConstantPools : public AssemblerBuffer<SliceSize, Inst
|
||||||
// Now to get an instruction to write.
|
// Now to get an instruction to write.
|
||||||
PoolEntry retPE;
|
PoolEntry retPE;
|
||||||
if (numPoolEntries) {
|
if (numPoolEntries) {
|
||||||
JitSpew(JitSpew_Pools, "[%d] Entry has index %u, offset %u", id, index,
|
JitSpew(JitSpew_Pools, "[%d] Entry has index %u, offset %" PRIuSIZE, id, index,
|
||||||
sizeExcludingCurrentPool());
|
sizeExcludingCurrentPool());
|
||||||
Asm::InsertIndexIntoTag(inst, index);
|
Asm::InsertIndexIntoTag(inst, index);
|
||||||
// Figure out the offset within the pool entries.
|
// Figure out the offset within the pool entries.
|
||||||
|
@ -935,8 +936,8 @@ struct AssemblerBufferWithConstantPools : public AssemblerBuffer<SliceSize, Inst
|
||||||
}
|
}
|
||||||
|
|
||||||
void finishPool() {
|
void finishPool() {
|
||||||
JitSpew(JitSpew_Pools, "[%d] Attempting to finish pool %d with %d entries.", id,
|
JitSpew(JitSpew_Pools, "[%d] Attempting to finish pool %" PRIuSIZE " with %u entries.",
|
||||||
poolInfo_.length(), pool_.numEntries());
|
id, poolInfo_.length(), pool_.numEntries());
|
||||||
|
|
||||||
if (pool_.numEntries() == 0 && !hasExpirableShortRangeBranches()) {
|
if (pool_.numEntries() == 0 && !hasExpirableShortRangeBranches()) {
|
||||||
// If there is no data in the pool being dumped, don't dump anything.
|
// If there is no data in the pool being dumped, don't dump anything.
|
||||||
|
@ -1004,7 +1005,7 @@ struct AssemblerBufferWithConstantPools : public AssemblerBuffer<SliceSize, Inst
|
||||||
// the pool entry that is being loaded. We need to do a non-trivial
|
// the pool entry that is being loaded. We need to do a non-trivial
|
||||||
// amount of math here, since the pool that we've made does not
|
// amount of math here, since the pool that we've made does not
|
||||||
// actually reside there in memory.
|
// actually reside there in memory.
|
||||||
JitSpew(JitSpew_Pools, "[%d] Fixing entry %d offset to %u", id, idx, codeOffset);
|
JitSpew(JitSpew_Pools, "[%d] Fixing entry %d offset to %" PRIuSIZE, id, idx, codeOffset);
|
||||||
Asm::PatchConstantPoolLoad(inst, (uint8_t*)inst + codeOffset);
|
Asm::PatchConstantPoolLoad(inst, (uint8_t*)inst + codeOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1037,7 +1038,7 @@ struct AssemblerBufferWithConstantPools : public AssemblerBuffer<SliceSize, Inst
|
||||||
// assumed that no pool entries are allocated in a no-pool region and
|
// assumed that no pool entries are allocated in a no-pool region and
|
||||||
// this is asserted when allocating entries.
|
// this is asserted when allocating entries.
|
||||||
if (!hasSpaceForInsts(maxInst, 0)) {
|
if (!hasSpaceForInsts(maxInst, 0)) {
|
||||||
JitSpew(JitSpew_Pools, "[%d] No-Pool instruction(%d) caused a spill.", id,
|
JitSpew(JitSpew_Pools, "[%d] No-Pool instruction(%" PRIuSIZE ") caused a spill.", id,
|
||||||
sizeExcludingCurrentPool());
|
sizeExcludingCurrentPool());
|
||||||
finishPool();
|
finishPool();
|
||||||
}
|
}
|
||||||
|
@ -1077,8 +1078,8 @@ struct AssemblerBufferWithConstantPools : public AssemblerBuffer<SliceSize, Inst
|
||||||
// dumped at the aligned code position.
|
// dumped at the aligned code position.
|
||||||
if (!hasSpaceForInsts(requiredFill / InstSize + 1, 0)) {
|
if (!hasSpaceForInsts(requiredFill / InstSize + 1, 0)) {
|
||||||
// Alignment would cause a pool dump, so dump the pool now.
|
// Alignment would cause a pool dump, so dump the pool now.
|
||||||
JitSpew(JitSpew_Pools, "[%d] Alignment of %d at %d caused a spill.", id, alignment,
|
JitSpew(JitSpew_Pools, "[%d] Alignment of %d at %" PRIuSIZE " caused a spill.",
|
||||||
sizeExcludingCurrentPool());
|
id, alignment, sizeExcludingCurrentPool());
|
||||||
finishPool();
|
finishPool();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5199,13 +5199,16 @@ const uint16_t MaxNumErrorArguments = 10;
|
||||||
* and its arguments.
|
* and its arguments.
|
||||||
*/
|
*/
|
||||||
extern JS_PUBLIC_API(void)
|
extern JS_PUBLIC_API(void)
|
||||||
JS_ReportErrorASCII(JSContext* cx, const char* format, ...);
|
JS_ReportErrorASCII(JSContext* cx, const char* format, ...)
|
||||||
|
MOZ_FORMAT_PRINTF(2, 3);
|
||||||
|
|
||||||
extern JS_PUBLIC_API(void)
|
extern JS_PUBLIC_API(void)
|
||||||
JS_ReportErrorLatin1(JSContext* cx, const char* format, ...);
|
JS_ReportErrorLatin1(JSContext* cx, const char* format, ...)
|
||||||
|
MOZ_FORMAT_PRINTF(2, 3);
|
||||||
|
|
||||||
extern JS_PUBLIC_API(void)
|
extern JS_PUBLIC_API(void)
|
||||||
JS_ReportErrorUTF8(JSContext* cx, const char* format, ...);
|
JS_ReportErrorUTF8(JSContext* cx, const char* format, ...)
|
||||||
|
MOZ_FORMAT_PRINTF(2, 3);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Use an errorNumber to retrieve the format string, args are char*
|
* Use an errorNumber to retrieve the format string, args are char*
|
||||||
|
@ -5257,13 +5260,16 @@ JS_ReportErrorNumberUCArray(JSContext* cx, JSErrorCallback errorCallback,
|
||||||
* being set, false otherwise.
|
* being set, false otherwise.
|
||||||
*/
|
*/
|
||||||
extern JS_PUBLIC_API(bool)
|
extern JS_PUBLIC_API(bool)
|
||||||
JS_ReportWarningASCII(JSContext* cx, const char* format, ...);
|
JS_ReportWarningASCII(JSContext* cx, const char* format, ...)
|
||||||
|
MOZ_FORMAT_PRINTF(2, 3);
|
||||||
|
|
||||||
extern JS_PUBLIC_API(bool)
|
extern JS_PUBLIC_API(bool)
|
||||||
JS_ReportWarningLatin1(JSContext* cx, const char* format, ...);
|
JS_ReportWarningLatin1(JSContext* cx, const char* format, ...)
|
||||||
|
MOZ_FORMAT_PRINTF(2, 3);
|
||||||
|
|
||||||
extern JS_PUBLIC_API(bool)
|
extern JS_PUBLIC_API(bool)
|
||||||
JS_ReportWarningUTF8(JSContext* cx, const char* format, ...);
|
JS_ReportWarningUTF8(JSContext* cx, const char* format, ...)
|
||||||
|
MOZ_FORMAT_PRINTF(2, 3);
|
||||||
|
|
||||||
extern JS_PUBLIC_API(bool)
|
extern JS_PUBLIC_API(bool)
|
||||||
JS_ReportErrorFlagsAndNumberASCII(JSContext* cx, unsigned flags,
|
JS_ReportErrorFlagsAndNumberASCII(JSContext* cx, unsigned flags,
|
||||||
|
|
|
@ -3630,11 +3630,11 @@ js::DumpBacktrace(JSContext* cx, FILE* fp)
|
||||||
i.isWasm() ? 'W' :
|
i.isWasm() ? 'W' :
|
||||||
'?';
|
'?';
|
||||||
|
|
||||||
sprinter.printf("#%d %14p %c %s:%d",
|
sprinter.printf("#%" PRIuSIZE " %14p %c %s:%d",
|
||||||
depth, i.rawFramePtr(), frameType, filename, line);
|
depth, i.rawFramePtr(), frameType, filename, line);
|
||||||
|
|
||||||
if (i.hasScript()) {
|
if (i.hasScript()) {
|
||||||
sprinter.printf(" (%p @ %d)\n",
|
sprinter.printf(" (%p @ %" PRIuSIZE ")\n",
|
||||||
i.script(), i.script()->pcToOffset(i.pc()));
|
i.script(), i.script()->pcToOffset(i.pc()));
|
||||||
} else {
|
} else {
|
||||||
sprinter.printf(" (%p)\n", i.pc());
|
sprinter.printf(" (%p)\n", i.pc());
|
||||||
|
|
|
@ -151,14 +151,14 @@ const char * PCCounts::numExecName = "interp";
|
||||||
static MOZ_MUST_USE bool
|
static MOZ_MUST_USE bool
|
||||||
DumpIonScriptCounts(Sprinter* sp, HandleScript script, jit::IonScriptCounts* ionCounts)
|
DumpIonScriptCounts(Sprinter* sp, HandleScript script, jit::IonScriptCounts* ionCounts)
|
||||||
{
|
{
|
||||||
if (!sp->jsprintf("IonScript [%lu blocks]:\n", ionCounts->numBlocks()))
|
if (!sp->jsprintf("IonScript [%" PRIuSIZE " blocks]:\n", ionCounts->numBlocks()))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (size_t i = 0; i < ionCounts->numBlocks(); i++) {
|
for (size_t i = 0; i < ionCounts->numBlocks(); i++) {
|
||||||
const jit::IonBlockCounts& block = ionCounts->block(i);
|
const jit::IonBlockCounts& block = ionCounts->block(i);
|
||||||
unsigned lineNumber = 0, columnNumber = 0;
|
unsigned lineNumber = 0, columnNumber = 0;
|
||||||
lineNumber = PCToLineNumber(script, script->offsetToPC(block.offset()), &columnNumber);
|
lineNumber = PCToLineNumber(script, script->offsetToPC(block.offset()), &columnNumber);
|
||||||
if (!sp->jsprintf("BB #%lu [%05u,%u,%u]",
|
if (!sp->jsprintf("BB #%" PRIu32 " [%05u,%u,%u]",
|
||||||
block.id(), block.offset(), lineNumber, columnNumber))
|
block.id(), block.offset(), lineNumber, columnNumber))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -168,10 +168,10 @@ DumpIonScriptCounts(Sprinter* sp, HandleScript script, jit::IonScriptCounts* ion
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for (size_t j = 0; j < block.numSuccessors(); j++) {
|
for (size_t j = 0; j < block.numSuccessors(); j++) {
|
||||||
if (!sp->jsprintf(" -> #%lu", block.successor(j)))
|
if (!sp->jsprintf(" -> #%" PRIu32, block.successor(j)))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!sp->jsprintf(" :: %llu hits\n", block.hitCount()))
|
if (!sp->jsprintf(" :: %" PRIu64 " hits\n", block.hitCount()))
|
||||||
return false;
|
return false;
|
||||||
if (!sp->jsprintf("%s\n", block.code()))
|
if (!sp->jsprintf("%s\n", block.code()))
|
||||||
return false;
|
return false;
|
||||||
|
|
169
js/src/jsprf.cpp
169
js/src/jsprf.cpp
|
@ -63,18 +63,18 @@ struct NumArgState
|
||||||
typedef mozilla::Vector<NumArgState, 20, js::SystemAllocPolicy> NumArgStateVector;
|
typedef mozilla::Vector<NumArgState, 20, js::SystemAllocPolicy> NumArgStateVector;
|
||||||
|
|
||||||
|
|
||||||
#define TYPE_INT16 0
|
#define TYPE_SHORT 0
|
||||||
#define TYPE_UINT16 1
|
#define TYPE_USHORT 1
|
||||||
#define TYPE_INTN 2
|
#define TYPE_INTN 2
|
||||||
#define TYPE_UINTN 3
|
#define TYPE_UINTN 3
|
||||||
#define TYPE_INT32 4
|
#define TYPE_LONG 4
|
||||||
#define TYPE_UINT32 5
|
#define TYPE_ULONG 5
|
||||||
#define TYPE_INT64 6
|
#define TYPE_LONGLONG 6
|
||||||
#define TYPE_UINT64 7
|
#define TYPE_ULONGLONG 7
|
||||||
#define TYPE_STRING 8
|
#define TYPE_STRING 8
|
||||||
#define TYPE_DOUBLE 9
|
#define TYPE_DOUBLE 9
|
||||||
#define TYPE_INTSTR 10
|
#define TYPE_INTSTR 10
|
||||||
#define TYPE_WSTRING 11
|
#define TYPE_POINTER 11
|
||||||
#define TYPE_UNKNOWN 20
|
#define TYPE_UNKNOWN 20
|
||||||
|
|
||||||
#define FLAG_LEFT 0x1
|
#define FLAG_LEFT 0x1
|
||||||
|
@ -89,31 +89,9 @@ generic_write(SprintfState* ss, const char* src, size_t srclen)
|
||||||
return (*ss->stuff)(ss, src, srclen);
|
return (*ss->stuff)(ss, src, srclen);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool
|
|
||||||
generic_write(SprintfState* ss, const char16_t* src, size_t srclen)
|
|
||||||
{
|
|
||||||
const size_t CHUNK_SIZE = 64;
|
|
||||||
char chunk[CHUNK_SIZE];
|
|
||||||
|
|
||||||
size_t j = 0;
|
|
||||||
size_t i = 0;
|
|
||||||
while (i < srclen) {
|
|
||||||
// FIXME: truncates characters to 8 bits
|
|
||||||
chunk[j++] = char(src[i++]);
|
|
||||||
|
|
||||||
if (j == CHUNK_SIZE || i == srclen) {
|
|
||||||
if (!(*ss->stuff)(ss, chunk, j))
|
|
||||||
return false;
|
|
||||||
j = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fill into the buffer using the data in src
|
// Fill into the buffer using the data in src
|
||||||
template <typename Char>
|
|
||||||
static bool
|
static bool
|
||||||
fill2(SprintfState* ss, const Char* src, int srclen, int width, int flags)
|
fill2(SprintfState* ss, const char* src, int srclen, int width, int flags)
|
||||||
{
|
{
|
||||||
char space = ' ';
|
char space = ' ';
|
||||||
|
|
||||||
|
@ -318,19 +296,16 @@ static bool cvt_f(SprintfState* ss, double d, const char* fmt0, const char* fmt1
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline const char* generic_null_str(const char*) { return "(null)"; }
|
static inline const char* generic_null_str(const char*) { return "(null)"; }
|
||||||
static inline const char16_t* generic_null_str(const char16_t*) { return u"(null)"; }
|
|
||||||
|
|
||||||
static inline size_t generic_strlen(const char* s) { return strlen(s); }
|
static inline size_t generic_strlen(const char* s) { return strlen(s); }
|
||||||
static inline size_t generic_strlen(const char16_t* s) { return js_strlen(s); }
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Convert a string into its printable form. "width" is the output
|
* Convert a string into its printable form. "width" is the output
|
||||||
* width. "prec" is the maximum number of characters of "s" to output,
|
* width. "prec" is the maximum number of characters of "s" to output,
|
||||||
* where -1 means until NUL.
|
* where -1 means until NUL.
|
||||||
*/
|
*/
|
||||||
template <typename Char>
|
|
||||||
static bool
|
static bool
|
||||||
cvt_s(SprintfState* ss, const Char* s, int width, int prec, int flags)
|
cvt_s(SprintfState* ss, const char* s, int width, int prec, int flags)
|
||||||
{
|
{
|
||||||
if (prec == 0)
|
if (prec == 0)
|
||||||
return true;
|
return true;
|
||||||
|
@ -452,23 +427,24 @@ BuildArgArray(const char* fmt, va_list ap, NumArgStateVector& nas)
|
||||||
// size
|
// size
|
||||||
nas[cn].type = TYPE_INTN;
|
nas[cn].type = TYPE_INTN;
|
||||||
if (c == 'h') {
|
if (c == 'h') {
|
||||||
nas[cn].type = TYPE_INT16;
|
nas[cn].type = TYPE_SHORT;
|
||||||
c = *p++;
|
c = *p++;
|
||||||
} else if (c == 'L') {
|
} else if (c == 'L') {
|
||||||
// XXX not quite sure here
|
nas[cn].type = TYPE_LONGLONG;
|
||||||
nas[cn].type = TYPE_INT64;
|
|
||||||
c = *p++;
|
c = *p++;
|
||||||
} else if (c == 'l') {
|
} else if (c == 'l') {
|
||||||
nas[cn].type = TYPE_INT32;
|
nas[cn].type = TYPE_LONG;
|
||||||
c = *p++;
|
c = *p++;
|
||||||
if (c == 'l') {
|
if (c == 'l') {
|
||||||
nas[cn].type = TYPE_INT64;
|
nas[cn].type = TYPE_LONGLONG;
|
||||||
c = *p++;
|
c = *p++;
|
||||||
}
|
}
|
||||||
} else if (c == 'z' || c == 'I') {
|
} else if (c == 'z' || c == 'I') {
|
||||||
static_assert(sizeof(size_t) == sizeof(int32_t) || sizeof(size_t) == sizeof(int64_t),
|
static_assert(sizeof(size_t) == sizeof(int) || sizeof(size_t) == sizeof(long) ||
|
||||||
|
sizeof(size_t) == sizeof(long long),
|
||||||
"size_t is not one of the expected sizes");
|
"size_t is not one of the expected sizes");
|
||||||
nas[cn].type = sizeof(size_t) == sizeof(int64_t) ? TYPE_INT64 : TYPE_INT32;
|
nas[cn].type = sizeof(size_t) == sizeof(int) ? TYPE_INTN :
|
||||||
|
sizeof(size_t) == sizeof(long) ? TYPE_LONG : TYPE_LONGLONG;
|
||||||
c = *p++;
|
c = *p++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -490,16 +466,7 @@ BuildArgArray(const char* fmt, va_list ap, NumArgStateVector& nas)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'p':
|
case 'p':
|
||||||
// XXX should use cpp
|
nas[cn].type = TYPE_POINTER;
|
||||||
if (sizeof(void*) == sizeof(int32_t)) {
|
|
||||||
nas[cn].type = TYPE_UINT32;
|
|
||||||
} else if (sizeof(void*) == sizeof(int64_t)) {
|
|
||||||
nas[cn].type = TYPE_UINT64;
|
|
||||||
} else if (sizeof(void*) == sizeof(int)) {
|
|
||||||
nas[cn].type = TYPE_UINTN;
|
|
||||||
} else {
|
|
||||||
nas[cn].type = TYPE_UNKNOWN;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'C':
|
case 'C':
|
||||||
|
@ -512,7 +479,7 @@ BuildArgArray(const char* fmt, va_list ap, NumArgStateVector& nas)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 's':
|
case 's':
|
||||||
nas[cn].type = (nas[cn].type == TYPE_UINT16) ? TYPE_WSTRING : TYPE_STRING;
|
nas[cn].type = TYPE_STRING;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'n':
|
case 'n':
|
||||||
|
@ -544,18 +511,18 @@ BuildArgArray(const char* fmt, va_list ap, NumArgStateVector& nas)
|
||||||
VARARGS_ASSIGN(nas[cn].ap, ap);
|
VARARGS_ASSIGN(nas[cn].ap, ap);
|
||||||
|
|
||||||
switch (nas[cn].type) {
|
switch (nas[cn].type) {
|
||||||
case TYPE_INT16:
|
case TYPE_SHORT:
|
||||||
case TYPE_UINT16:
|
case TYPE_USHORT:
|
||||||
case TYPE_INTN:
|
case TYPE_INTN:
|
||||||
case TYPE_UINTN: (void) va_arg(ap, int); break;
|
case TYPE_UINTN: (void) va_arg(ap, int); break;
|
||||||
case TYPE_INT32: (void) va_arg(ap, int32_t); break;
|
case TYPE_LONG: (void) va_arg(ap, long); break;
|
||||||
case TYPE_UINT32: (void) va_arg(ap, uint32_t); break;
|
case TYPE_ULONG: (void) va_arg(ap, unsigned long); break;
|
||||||
case TYPE_INT64: (void) va_arg(ap, int64_t); break;
|
case TYPE_LONGLONG: (void) va_arg(ap, long long); break;
|
||||||
case TYPE_UINT64: (void) va_arg(ap, uint64_t); break;
|
case TYPE_ULONGLONG: (void) va_arg(ap, unsigned long long); break;
|
||||||
case TYPE_STRING: (void) va_arg(ap, char*); break;
|
case TYPE_STRING: (void) va_arg(ap, char*); break;
|
||||||
case TYPE_WSTRING: (void) va_arg(ap, char16_t*); break;
|
|
||||||
case TYPE_INTSTR: (void) va_arg(ap, int*); break;
|
case TYPE_INTSTR: (void) va_arg(ap, int*); break;
|
||||||
case TYPE_DOUBLE: (void) va_arg(ap, double); break;
|
case TYPE_DOUBLE: (void) va_arg(ap, double); break;
|
||||||
|
case TYPE_POINTER: (void) va_arg(ap, void*); break;
|
||||||
|
|
||||||
default: MOZ_CRASH();
|
default: MOZ_CRASH();
|
||||||
}
|
}
|
||||||
|
@ -576,14 +543,13 @@ dosprintf(SprintfState* ss, const char* fmt, va_list ap)
|
||||||
int flags, width, prec, radix, type;
|
int flags, width, prec, radix, type;
|
||||||
union {
|
union {
|
||||||
char ch;
|
char ch;
|
||||||
char16_t wch;
|
|
||||||
int i;
|
int i;
|
||||||
long l;
|
long l;
|
||||||
int64_t ll;
|
long long ll;
|
||||||
double d;
|
double d;
|
||||||
const char* s;
|
const char* s;
|
||||||
const char16_t* ws;
|
|
||||||
int* ip;
|
int* ip;
|
||||||
|
void* p;
|
||||||
} u;
|
} u;
|
||||||
const char* fmt0;
|
const char* fmt0;
|
||||||
static const char hex[] = "0123456789abcdef";
|
static const char hex[] = "0123456789abcdef";
|
||||||
|
@ -685,23 +651,24 @@ dosprintf(SprintfState* ss, const char* fmt, va_list ap)
|
||||||
// size
|
// size
|
||||||
type = TYPE_INTN;
|
type = TYPE_INTN;
|
||||||
if (c == 'h') {
|
if (c == 'h') {
|
||||||
type = TYPE_INT16;
|
type = TYPE_SHORT;
|
||||||
c = *fmt++;
|
c = *fmt++;
|
||||||
} else if (c == 'L') {
|
} else if (c == 'L') {
|
||||||
// XXX not quite sure here
|
type = TYPE_LONGLONG;
|
||||||
type = TYPE_INT64;
|
|
||||||
c = *fmt++;
|
c = *fmt++;
|
||||||
} else if (c == 'l') {
|
} else if (c == 'l') {
|
||||||
type = TYPE_INT32;
|
type = TYPE_LONG;
|
||||||
c = *fmt++;
|
c = *fmt++;
|
||||||
if (c == 'l') {
|
if (c == 'l') {
|
||||||
type = TYPE_INT64;
|
type = TYPE_LONGLONG;
|
||||||
c = *fmt++;
|
c = *fmt++;
|
||||||
}
|
}
|
||||||
} else if (c == 'z' || c == 'I') {
|
} else if (c == 'z' || c == 'I') {
|
||||||
static_assert(sizeof(size_t) == sizeof(int32_t) || sizeof(size_t) == sizeof(int64_t),
|
static_assert(sizeof(size_t) == sizeof(int) || sizeof(size_t) == sizeof(long) ||
|
||||||
|
sizeof(size_t) == sizeof(long long),
|
||||||
"size_t is not one of the expected sizes");
|
"size_t is not one of the expected sizes");
|
||||||
type = sizeof(size_t) == sizeof(int64_t) ? TYPE_INT64 : TYPE_INT32;
|
type = sizeof(size_t) == sizeof(int) ? TYPE_INTN :
|
||||||
|
sizeof(size_t) == sizeof(long) ? TYPE_LONG : TYPE_LONGLONG;
|
||||||
c = *fmt++;
|
c = *fmt++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -735,15 +702,15 @@ dosprintf(SprintfState* ss, const char* fmt, va_list ap)
|
||||||
|
|
||||||
fetch_and_convert:
|
fetch_and_convert:
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case TYPE_INT16:
|
case TYPE_SHORT:
|
||||||
u.l = va_arg(ap, int);
|
u.l = va_arg(ap, int);
|
||||||
if (u.l < 0) {
|
if (u.l < 0) {
|
||||||
u.l = -u.l;
|
u.l = -u.l;
|
||||||
flags |= FLAG_NEG;
|
flags |= FLAG_NEG;
|
||||||
}
|
}
|
||||||
goto do_long;
|
goto do_long;
|
||||||
case TYPE_UINT16:
|
case TYPE_USHORT:
|
||||||
u.l = va_arg(ap, int) & 0xffff;
|
u.l = (unsigned short) va_arg(ap, unsigned int);
|
||||||
goto do_long;
|
goto do_long;
|
||||||
case TYPE_INTN:
|
case TYPE_INTN:
|
||||||
u.l = va_arg(ap, int);
|
u.l = va_arg(ap, int);
|
||||||
|
@ -756,30 +723,33 @@ dosprintf(SprintfState* ss, const char* fmt, va_list ap)
|
||||||
u.l = (long)va_arg(ap, unsigned int);
|
u.l = (long)va_arg(ap, unsigned int);
|
||||||
goto do_long;
|
goto do_long;
|
||||||
|
|
||||||
case TYPE_INT32:
|
case TYPE_LONG:
|
||||||
u.l = va_arg(ap, int32_t);
|
u.l = va_arg(ap, long);
|
||||||
if (u.l < 0) {
|
if (u.l < 0) {
|
||||||
u.l = -u.l;
|
u.l = -u.l;
|
||||||
flags |= FLAG_NEG;
|
flags |= FLAG_NEG;
|
||||||
}
|
}
|
||||||
goto do_long;
|
goto do_long;
|
||||||
case TYPE_UINT32:
|
case TYPE_ULONG:
|
||||||
u.l = (long)va_arg(ap, uint32_t);
|
u.l = (long)va_arg(ap, unsigned long);
|
||||||
do_long:
|
do_long:
|
||||||
if (!cvt_l(ss, u.l, width, prec, radix, type, flags, hexp))
|
if (!cvt_l(ss, u.l, width, prec, radix, type, flags, hexp))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_INT64:
|
case TYPE_LONGLONG:
|
||||||
u.ll = va_arg(ap, int64_t);
|
u.ll = va_arg(ap, long long);
|
||||||
if (u.ll < 0) {
|
if (u.ll < 0) {
|
||||||
u.ll = -u.ll;
|
u.ll = -u.ll;
|
||||||
flags |= FLAG_NEG;
|
flags |= FLAG_NEG;
|
||||||
}
|
}
|
||||||
goto do_longlong;
|
goto do_longlong;
|
||||||
case TYPE_UINT64:
|
case TYPE_POINTER:
|
||||||
u.ll = va_arg(ap, uint64_t);
|
u.ll = (uintptr_t)va_arg(ap, void*);
|
||||||
|
goto do_longlong;
|
||||||
|
case TYPE_ULONGLONG:
|
||||||
|
u.ll = va_arg(ap, unsigned long long);
|
||||||
do_longlong:
|
do_longlong:
|
||||||
if (!cvt_ll(ss, u.ll, width, prec, radix, type, flags, hexp))
|
if (!cvt_ll(ss, u.ll, width, prec, radix, type, flags, hexp))
|
||||||
return false;
|
return false;
|
||||||
|
@ -816,7 +786,7 @@ dosprintf(SprintfState* ss, const char* fmt, va_list ap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case TYPE_INT16:
|
case TYPE_SHORT:
|
||||||
case TYPE_INTN:
|
case TYPE_INTN:
|
||||||
u.ch = va_arg(ap, int);
|
u.ch = va_arg(ap, int);
|
||||||
if (!(*ss->stuff)(ss, &u.ch, 1))
|
if (!(*ss->stuff)(ss, &u.ch, 1))
|
||||||
|
@ -832,16 +802,7 @@ dosprintf(SprintfState* ss, const char* fmt, va_list ap)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'p':
|
case 'p':
|
||||||
if (sizeof(void*) == sizeof(int32_t)) {
|
type = TYPE_POINTER;
|
||||||
type = TYPE_UINT32;
|
|
||||||
} else if (sizeof(void*) == sizeof(int64_t)) {
|
|
||||||
type = TYPE_UINT64;
|
|
||||||
} else if (sizeof(void*) == sizeof(int)) {
|
|
||||||
type = TYPE_UINTN;
|
|
||||||
} else {
|
|
||||||
MOZ_ASSERT(0);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
radix = 16;
|
radix = 16;
|
||||||
goto fetch_and_convert;
|
goto fetch_and_convert;
|
||||||
|
|
||||||
|
@ -856,15 +817,9 @@ dosprintf(SprintfState* ss, const char* fmt, va_list ap)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
case 's':
|
case 's':
|
||||||
if(type == TYPE_INT16) {
|
u.s = va_arg(ap, const char*);
|
||||||
u.ws = va_arg(ap, const char16_t*);
|
if (!cvt_s(ss, u.s, width, prec, flags))
|
||||||
if (!cvt_s(ss, u.ws, width, prec, flags))
|
return false;
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
u.s = va_arg(ap, const char*);
|
|
||||||
if (!cvt_s(ss, u.s, width, prec, flags))
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'n':
|
case 'n':
|
||||||
|
@ -1004,18 +959,18 @@ JS_vsprintf_append(char* last, const char* fmt, va_list ap)
|
||||||
return ss.base;
|
return ss.base;
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef TYPE_INT16
|
#undef TYPE_SHORT
|
||||||
#undef TYPE_UINT16
|
#undef TYPE_USHORT
|
||||||
#undef TYPE_INTN
|
#undef TYPE_INTN
|
||||||
#undef TYPE_UINTN
|
#undef TYPE_UINTN
|
||||||
#undef TYPE_INT32
|
#undef TYPE_LONG
|
||||||
#undef TYPE_UINT32
|
#undef TYPE_ULONG
|
||||||
#undef TYPE_INT64
|
#undef TYPE_LONGLONG
|
||||||
#undef TYPE_UINT64
|
#undef TYPE_ULONGLONG
|
||||||
#undef TYPE_STRING
|
#undef TYPE_STRING
|
||||||
#undef TYPE_DOUBLE
|
#undef TYPE_DOUBLE
|
||||||
#undef TYPE_INTSTR
|
#undef TYPE_INTSTR
|
||||||
#undef TYPE_WSTRING
|
#undef TYPE_POINTER
|
||||||
#undef TYPE_UNKNOWN
|
#undef TYPE_UNKNOWN
|
||||||
|
|
||||||
#undef FLAG_LEFT
|
#undef FLAG_LEFT
|
||||||
|
|
|
@ -14,11 +14,13 @@
|
||||||
** %x - unsigned hex
|
** %x - unsigned hex
|
||||||
** %X - unsigned uppercase hex
|
** %X - unsigned uppercase hex
|
||||||
** %o - unsigned octal
|
** %o - unsigned octal
|
||||||
** %hd, %hu, %hx, %hX, %ho - 16-bit versions of above
|
** %hd, %hu, %hx, %hX, %ho - "short" versions of above
|
||||||
** %ld, %lu, %lx, %lX, %lo - 32-bit versions of above
|
** %ld, %lu, %lx, %lX, %lo - "long" versions of above
|
||||||
** %lld, %llu, %llx, %llX, %llo - 64 bit versions of above
|
** %lld, %llu, %llx, %llX, %llo - "long long" versions of above
|
||||||
** %s - ascii string
|
** %zd, %zo, %zu, %zx, %zX - size_t versions of above
|
||||||
** %hs - ucs2 string
|
** %Id, %Io, %Iu, %Ix, %IX - size_t versions of above (for Windows compat)
|
||||||
|
** You should use PRI*SIZE macros instead
|
||||||
|
** %s - string
|
||||||
** %c - character
|
** %c - character
|
||||||
** %p - pointer (deals with machine dependent pointer size)
|
** %p - pointer (deals with machine dependent pointer size)
|
||||||
** %f - float
|
** %f - float
|
||||||
|
@ -37,7 +39,8 @@
|
||||||
** buffer on success, nullptr on failure. Call "JS_smprintf_free" to release
|
** buffer on success, nullptr on failure. Call "JS_smprintf_free" to release
|
||||||
** the memory returned.
|
** the memory returned.
|
||||||
*/
|
*/
|
||||||
extern JS_PUBLIC_API(char*) JS_smprintf(const char* fmt, ...);
|
extern JS_PUBLIC_API(char*) JS_smprintf(const char* fmt, ...)
|
||||||
|
MOZ_FORMAT_PRINTF(1, 2);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Free the memory allocated, for the caller, by JS_smprintf
|
** Free the memory allocated, for the caller, by JS_smprintf
|
||||||
|
@ -51,7 +54,8 @@ extern JS_PUBLIC_API(void) JS_smprintf_free(char* mem);
|
||||||
** will allocate the initial string. The return value is the new value of
|
** will allocate the initial string. The return value is the new value of
|
||||||
** last for subsequent calls, or nullptr if there is a malloc failure.
|
** last for subsequent calls, or nullptr if there is a malloc failure.
|
||||||
*/
|
*/
|
||||||
extern JS_PUBLIC_API(char*) JS_sprintf_append(char* last, const char* fmt, ...);
|
extern JS_PUBLIC_API(char*) JS_sprintf_append(char* last, const char* fmt, ...)
|
||||||
|
MOZ_FORMAT_PRINTF(2, 3);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** va_list forms of the above.
|
** va_list forms of the above.
|
||||||
|
|
|
@ -783,7 +783,7 @@ if CONFIG['JS_HAS_CTYPES']:
|
||||||
DEFINES['FFI_BUILDING'] = True
|
DEFINES['FFI_BUILDING'] = True
|
||||||
|
|
||||||
if CONFIG['GNU_CXX']:
|
if CONFIG['GNU_CXX']:
|
||||||
CXXFLAGS += ['-Wno-shadow']
|
CXXFLAGS += ['-Wno-shadow', '-Werror=format']
|
||||||
|
|
||||||
# Suppress warnings in third-party code.
|
# Suppress warnings in third-party code.
|
||||||
if CONFIG['CLANG_CXX']:
|
if CONFIG['CLANG_CXX']:
|
||||||
|
|
|
@ -5232,7 +5232,7 @@ ReflectTrackedOptimizations(JSContext* cx, unsigned argc, Value* vp)
|
||||||
uint8_t* addr = ion->method()->raw() + endOffset;
|
uint8_t* addr = ion->method()->raw() + endOffset;
|
||||||
entry.youngestFrameLocationAtAddr(rt, addr, &script, &pc);
|
entry.youngestFrameLocationAtAddr(rt, addr, &script, &pc);
|
||||||
|
|
||||||
if (!sp.jsprintf("{\"location\":\"%s:%u\",\"offset\":%u,\"index\":%u}%s",
|
if (!sp.jsprintf("{\"location\":\"%s:%" PRIuSIZE "\",\"offset\":%" PRIuSIZE ",\"index\":%u}%s",
|
||||||
script->filename(), script->lineno(), script->pcToOffset(pc), index,
|
script->filename(), script->lineno(), script->pcToOffset(pc), index,
|
||||||
iter.more() ? "," : ""))
|
iter.more() ? "," : ""))
|
||||||
{
|
{
|
||||||
|
|
|
@ -264,7 +264,7 @@ OptionParser::extractValue(size_t argc, char** argv, size_t* i, char** value)
|
||||||
if (eq) {
|
if (eq) {
|
||||||
*value = eq + 1;
|
*value = eq + 1;
|
||||||
if (*value[0] == '\0')
|
if (*value[0] == '\0')
|
||||||
return error("A value is required for option %.*s", eq - argv[*i], argv[*i]);
|
return error("A value is required for option %.*s", (int) (eq - argv[*i]), argv[*i]);
|
||||||
return Okay;
|
return Okay;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -228,7 +228,7 @@ class OptionParser
|
||||||
Option* findArgument(const char* name);
|
Option* findArgument(const char* name);
|
||||||
const Option* findArgument(const char* name) const;
|
const Option* findArgument(const char* name) const;
|
||||||
|
|
||||||
Result error(const char* fmt, ...);
|
Result error(const char* fmt, ...) MOZ_FORMAT_PRINTF(2, 3);
|
||||||
Result extractValue(size_t argc, char** argv, size_t* i, char** value);
|
Result extractValue(size_t argc, char** argv, size_t* i, char** value);
|
||||||
Result handleArg(size_t argc, char** argv, size_t* i, bool* optsAllowed);
|
Result handleArg(size_t argc, char** argv, size_t* i, bool* optsAllowed);
|
||||||
Result handleOption(Option* opt, size_t argc, char** argv, size_t* i, bool* optsAllowed);
|
Result handleOption(Option* opt, size_t argc, char** argv, size_t* i, bool* optsAllowed);
|
||||||
|
|
|
@ -51,7 +51,7 @@ shellmoduleloader.inputs = [
|
||||||
]
|
]
|
||||||
|
|
||||||
if CONFIG['GNU_CXX']:
|
if CONFIG['GNU_CXX']:
|
||||||
CXXFLAGS += ['-Wno-shadow']
|
CXXFLAGS += ['-Wno-shadow', '-Werror=format']
|
||||||
|
|
||||||
# This is intended as a temporary workaround to enable VS2015.
|
# This is intended as a temporary workaround to enable VS2015.
|
||||||
if CONFIG['_MSC_VER']:
|
if CONFIG['_MSC_VER']:
|
||||||
|
|
|
@ -91,16 +91,16 @@ LCovSource::exportInto(GenericPrinter& out) const
|
||||||
|
|
||||||
outFN_.exportInto(out);
|
outFN_.exportInto(out);
|
||||||
outFNDA_.exportInto(out);
|
outFNDA_.exportInto(out);
|
||||||
out.printf("FNF:%d\n", numFunctionsFound_);
|
out.printf("FNF:%" PRIuSIZE "\n", numFunctionsFound_);
|
||||||
out.printf("FNH:%d\n", numFunctionsHit_);
|
out.printf("FNH:%" PRIuSIZE "\n", numFunctionsHit_);
|
||||||
|
|
||||||
outBRDA_.exportInto(out);
|
outBRDA_.exportInto(out);
|
||||||
out.printf("BRF:%d\n", numBranchesFound_);
|
out.printf("BRF:%" PRIuSIZE "\n", numBranchesFound_);
|
||||||
out.printf("BRH:%d\n", numBranchesHit_);
|
out.printf("BRH:%" PRIuSIZE "\n", numBranchesHit_);
|
||||||
|
|
||||||
outDA_.exportInto(out);
|
outDA_.exportInto(out);
|
||||||
out.printf("LF:%d\n", numLinesInstrumented_);
|
out.printf("LF:%" PRIuSIZE "\n", numLinesInstrumented_);
|
||||||
out.printf("LH:%d\n", numLinesHit_);
|
out.printf("LH:%" PRIuSIZE "\n", numLinesHit_);
|
||||||
|
|
||||||
out.put("end_of_record\n");
|
out.put("end_of_record\n");
|
||||||
}
|
}
|
||||||
|
@ -130,7 +130,7 @@ bool
|
||||||
LCovSource::writeScript(JSScript* script)
|
LCovSource::writeScript(JSScript* script)
|
||||||
{
|
{
|
||||||
numFunctionsFound_++;
|
numFunctionsFound_++;
|
||||||
outFN_.printf("FN:%d,", script->lineno());
|
outFN_.printf("FN:%" PRIuSIZE ",", script->lineno());
|
||||||
if (!writeScriptName(outFN_, script))
|
if (!writeScriptName(outFN_, script))
|
||||||
return false;
|
return false;
|
||||||
outFN_.put("\n", 1);
|
outFN_.put("\n", 1);
|
||||||
|
@ -191,7 +191,7 @@ LCovSource::writeScript(JSScript* script)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oldLine != lineno && fallsthrough) {
|
if (oldLine != lineno && fallsthrough) {
|
||||||
outDA_.printf("DA:%d,%" PRIu64 "\n", lineno, hits);
|
outDA_.printf("DA:%" PRIuSIZE ",%" PRIu64 "\n", lineno, hits);
|
||||||
|
|
||||||
// Count the number of lines instrumented & hit.
|
// Count the number of lines instrumented & hit.
|
||||||
numLinesInstrumented_++;
|
numLinesInstrumented_++;
|
||||||
|
@ -220,13 +220,13 @@ LCovSource::writeScript(JSScript* script)
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t taken = hits - fallthroughHits;
|
uint64_t taken = hits - fallthroughHits;
|
||||||
outBRDA_.printf("BRDA:%d,%d,0,", lineno, branchId);
|
outBRDA_.printf("BRDA:%" PRIuSIZE ",%" PRIuSIZE ",0,", lineno, branchId);
|
||||||
if (taken)
|
if (taken)
|
||||||
outBRDA_.printf("%" PRIu64 "\n", taken);
|
outBRDA_.printf("%" PRIu64 "\n", taken);
|
||||||
else
|
else
|
||||||
outBRDA_.put("-\n", 2);
|
outBRDA_.put("-\n", 2);
|
||||||
|
|
||||||
outBRDA_.printf("BRDA:%d,%d,1,", lineno, branchId);
|
outBRDA_.printf("BRDA:%" PRIuSIZE ",%" PRIuSIZE ",1,", lineno, branchId);
|
||||||
if (fallthroughHits)
|
if (fallthroughHits)
|
||||||
outBRDA_.printf("%" PRIu64 "\n", fallthroughHits);
|
outBRDA_.printf("%" PRIu64 "\n", fallthroughHits);
|
||||||
else
|
else
|
||||||
|
@ -308,7 +308,8 @@ LCovSource::writeScript(JSScript* script)
|
||||||
caseHits -= fallsThroughHits;
|
caseHits -= fallsThroughHits;
|
||||||
}
|
}
|
||||||
|
|
||||||
outBRDA_.printf("BRDA:%d,%d,%d,", lineno, branchId, caseId);
|
outBRDA_.printf("BRDA:%" PRIuSIZE ",%" PRIuSIZE ",%" PRIuSIZE ",",
|
||||||
|
lineno, branchId, caseId);
|
||||||
if (caseHits)
|
if (caseHits)
|
||||||
outBRDA_.printf("%" PRIu64 "\n", caseHits);
|
outBRDA_.printf("%" PRIu64 "\n", caseHits);
|
||||||
else
|
else
|
||||||
|
@ -359,7 +360,8 @@ LCovSource::writeScript(JSScript* script)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (defaultHasOwnClause) {
|
if (defaultHasOwnClause) {
|
||||||
outBRDA_.printf("BRDA:%d,%d,%d,", lineno, branchId, caseId);
|
outBRDA_.printf("BRDA:%" PRIuSIZE ",%" PRIuSIZE ",%" PRIuSIZE ",",
|
||||||
|
lineno, branchId, caseId);
|
||||||
if (defaultHits)
|
if (defaultHits)
|
||||||
outBRDA_.printf("%" PRIu64 "\n", defaultHits);
|
outBRDA_.printf("%" PRIu64 "\n", defaultHits);
|
||||||
else
|
else
|
||||||
|
|
|
@ -43,7 +43,7 @@ class GenericPrinter
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prints a formatted string into the buffer.
|
// Prints a formatted string into the buffer.
|
||||||
virtual int printf(const char* fmt, ...);
|
virtual int printf(const char* fmt, ...) MOZ_FORMAT_PRINTF(2, 3);
|
||||||
virtual int vprintf(const char* fmt, va_list ap);
|
virtual int vprintf(const char* fmt, va_list ap);
|
||||||
|
|
||||||
// Report that a string operation failed to get the memory it requested. The
|
// Report that a string operation failed to get the memory it requested. The
|
||||||
|
@ -115,7 +115,7 @@ class Sprinter final : public GenericPrinter
|
||||||
// Format the given format/arguments as if by JS_vsmprintf, then put it.
|
// 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
|
// Return true on success, else return false and report an error (typically
|
||||||
// OOM).
|
// OOM).
|
||||||
MOZ_MUST_USE bool jsprintf(const char* fmt, ...);
|
MOZ_MUST_USE bool jsprintf(const char* fmt, ...) MOZ_FORMAT_PRINTF(2, 3);
|
||||||
|
|
||||||
// Prints a formatted string into the buffer.
|
// Prints a formatted string into the buffer.
|
||||||
virtual int vprintf(const char* fmt, va_list ap) override;
|
virtual int vprintf(const char* fmt, va_list ap) override;
|
||||||
|
@ -157,7 +157,7 @@ class Fprinter final : public GenericPrinter
|
||||||
using GenericPrinter::put; // pick up |inline int put(const char* s);|
|
using GenericPrinter::put; // pick up |inline int put(const char* s);|
|
||||||
|
|
||||||
// Prints a formatted string into the buffer.
|
// Prints a formatted string into the buffer.
|
||||||
virtual int printf(const char* fmt, ...) override;
|
virtual int printf(const char* fmt, ...) override MOZ_FORMAT_PRINTF(2, 3);
|
||||||
virtual int vprintf(const char* fmt, va_list ap) override;
|
virtual int vprintf(const char* fmt, va_list ap) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -203,7 +203,7 @@ class LSprinter final : public GenericPrinter
|
||||||
using GenericPrinter::put; // pick up |inline int put(const char* s);|
|
using GenericPrinter::put; // pick up |inline int put(const char* s);|
|
||||||
|
|
||||||
// Prints a formatted string into the buffer.
|
// Prints a formatted string into the buffer.
|
||||||
virtual int printf(const char* fmt, ...) override;
|
virtual int printf(const char* fmt, ...) override MOZ_FORMAT_PRINTF(2, 3);
|
||||||
virtual int vprintf(const char* fmt, va_list ap) override;
|
virtual int vprintf(const char* fmt, va_list ap) override;
|
||||||
|
|
||||||
// Report that a string operation failed to get the memory it requested. The
|
// Report that a string operation failed to get the memory it requested. The
|
||||||
|
|
|
@ -50,6 +50,7 @@ TraceLoggerGraphState* traceLoggerGraphState = nullptr;
|
||||||
// are allowed, with %u standing for a full 32-bit number and %d standing for
|
// are allowed, with %u standing for a full 32-bit number and %d standing for
|
||||||
// an up to 3-digit number.
|
// an up to 3-digit number.
|
||||||
static js::UniqueChars
|
static js::UniqueChars
|
||||||
|
MOZ_FORMAT_PRINTF(1, 2)
|
||||||
AllocTraceLogFilename(const char* pattern, ...) {
|
AllocTraceLogFilename(const char* pattern, ...) {
|
||||||
js::UniqueChars filename;
|
js::UniqueChars filename;
|
||||||
|
|
||||||
|
|
|
@ -237,6 +237,7 @@ js::InferSpewImpl(const char* fmt, ...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
MOZ_NORETURN MOZ_COLD static void
|
MOZ_NORETURN MOZ_COLD static void
|
||||||
|
MOZ_FORMAT_PRINTF(2, 3)
|
||||||
TypeFailure(JSContext* cx, const char* fmt, ...)
|
TypeFailure(JSContext* cx, const char* fmt, ...)
|
||||||
{
|
{
|
||||||
char msgbuf[1024]; /* Larger error messages will be truncated */
|
char msgbuf[1024]; /* Larger error messages will be truncated */
|
||||||
|
@ -3288,7 +3289,7 @@ js::TypeMonitorResult(JSContext* cx, JSScript* script, jsbytecode* pc, TypeSet::
|
||||||
if (types->hasType(type))
|
if (types->hasType(type))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
InferSpew(ISpewOps, "bytecodeType: %p %05u: %s",
|
InferSpew(ISpewOps, "bytecodeType: %p %05" PRIuSIZE ": %s",
|
||||||
script, script->pcToOffset(pc), TypeSet::TypeString(type));
|
script, script->pcToOffset(pc), TypeSet::TypeString(type));
|
||||||
types->addType(cx, type);
|
types->addType(cx, type);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1296,7 +1296,7 @@ const char * InferSpewColor(TypeConstraint* constraint);
|
||||||
const char * InferSpewColor(TypeSet* types);
|
const char * InferSpewColor(TypeSet* types);
|
||||||
|
|
||||||
#define InferSpew(channel, ...) if (InferSpewActive(channel)) { InferSpewImpl(__VA_ARGS__); } else {}
|
#define InferSpew(channel, ...) if (InferSpewActive(channel)) { InferSpewImpl(__VA_ARGS__); } else {}
|
||||||
void InferSpewImpl(const char* fmt, ...);
|
void InferSpewImpl(const char* fmt, ...) MOZ_FORMAT_PRINTF(1, 2);
|
||||||
|
|
||||||
/* Check that the type property for id in group contains value. */
|
/* Check that the type property for id in group contains value. */
|
||||||
bool ObjectGroupHasProperty(JSContext* cx, ObjectGroup* group, jsid id, const Value& value);
|
bool ObjectGroupHasProperty(JSContext* cx, ObjectGroup* group, jsid id, const Value& value);
|
||||||
|
|
|
@ -154,6 +154,7 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
static nsresult
|
static nsresult
|
||||||
|
MOZ_FORMAT_PRINTF(2, 3)
|
||||||
ReportOnCallerUTF8(JSContext* callerContext,
|
ReportOnCallerUTF8(JSContext* callerContext,
|
||||||
const char* format, ...) {
|
const char* format, ...) {
|
||||||
if (!callerContext) {
|
if (!callerContext) {
|
||||||
|
@ -177,6 +178,7 @@ ReportOnCallerUTF8(JSContext* callerContext,
|
||||||
}
|
}
|
||||||
|
|
||||||
static nsresult
|
static nsresult
|
||||||
|
MOZ_FORMAT_PRINTF(2, 3)
|
||||||
ReportOnCallerUTF8(JSCLContextHelper& helper,
|
ReportOnCallerUTF8(JSCLContextHelper& helper,
|
||||||
const char* format, ...)
|
const char* format, ...)
|
||||||
{
|
{
|
||||||
|
|
|
@ -116,9 +116,9 @@ XPCThrower::ThrowBadResult(nsresult rv, nsresult result, XPCCallContext& ccx)
|
||||||
format = "";
|
format = "";
|
||||||
|
|
||||||
if (nsXPCException::NameAndFormatForNSResult(result, &name, nullptr) && name)
|
if (nsXPCException::NameAndFormatForNSResult(result, &name, nullptr) && name)
|
||||||
sz = JS_smprintf("%s 0x%x (%s)", format, result, name);
|
sz = JS_smprintf("%s 0x%x (%s)", format, (unsigned) result, name);
|
||||||
else
|
else
|
||||||
sz = JS_smprintf("%s 0x%x", format, result);
|
sz = JS_smprintf("%s 0x%x", format, (unsigned) result);
|
||||||
NS_ENSURE_TRUE_VOID(sz);
|
NS_ENSURE_TRUE_VOID(sz);
|
||||||
|
|
||||||
if (sz && sVerbose)
|
if (sz && sVerbose)
|
||||||
|
|
|
@ -971,7 +971,7 @@ nsXPCWrappedJSClass::CallMethod(nsXPCWrappedJS* wrapper, uint16_t methodIndex,
|
||||||
const char* str = "IDL methods marked with [implicit_jscontext] "
|
const char* str = "IDL methods marked with [implicit_jscontext] "
|
||||||
"or [optional_argc] may not be implemented in JS";
|
"or [optional_argc] may not be implemented in JS";
|
||||||
// Throw and warn for good measure.
|
// Throw and warn for good measure.
|
||||||
JS_ReportErrorASCII(cx, str);
|
JS_ReportErrorASCII(cx, "%s", str);
|
||||||
NS_WARNING(str);
|
NS_WARNING(str);
|
||||||
return CheckForException(ccx, aes, name, GetInterfaceName());
|
return CheckForException(ccx, aes, name, GetInterfaceName());
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,4 +72,4 @@ if CONFIG['MOZ_B2G_BT']:
|
||||||
]
|
]
|
||||||
|
|
||||||
if CONFIG['GNU_CXX']:
|
if CONFIG['GNU_CXX']:
|
||||||
CXXFLAGS += ['-Wno-shadow']
|
CXXFLAGS += ['-Wno-shadow', '-Werror=format']
|
||||||
|
|
|
@ -274,7 +274,7 @@ static void
|
||||||
EnterAndThrowASCII(JSContext* cx, JSObject* wrapper, const char* msg)
|
EnterAndThrowASCII(JSContext* cx, JSObject* wrapper, const char* msg)
|
||||||
{
|
{
|
||||||
JSAutoCompartment ac(cx, wrapper);
|
JSAutoCompartment ac(cx, wrapper);
|
||||||
JS_ReportErrorASCII(cx, msg);
|
JS_ReportErrorASCII(cx, "%s", msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
Загрузка…
Ссылка в новой задаче