import changes from rmottola/Arctic-Fox:

- change some pointer style, or patches do not apply (0de8fac13)
- Bug 1137523 - Unprefix most js_* functions. (16507a434)
This commit is contained in:
2019-01-29 10:29:22 +08:00
parent 8ea0072acd
commit 9f3e30f71b
154 changed files with 1181 additions and 1265 deletions
+23 -70
View File
@@ -73,7 +73,7 @@ static const char * const CodeToken[] = {
};
/*
* Array of JS bytecode names used by PC count JSON, DEBUG-only js_Disassemble
* Array of JS bytecode names used by PC count JSON, DEBUG-only Disassemble
* and JIT debug spew.
*/
const char * const js_CodeName[] = {
@@ -87,7 +87,7 @@ const char * const js_CodeName[] = {
#define COUNTS_LEN 16
size_t
js_GetVariableBytecodeLength(jsbytecode* pc)
js::GetVariableBytecodeLength(jsbytecode* pc)
{
JSOp op = JSOp(*pc);
MOZ_ASSERT(js_CodeSpec[op].length == -1);
@@ -235,7 +235,7 @@ js::DumpIonScriptCounts(Sprinter* sp, jit::IonScriptCounts* ionCounts)
}
void
js_DumpPCCounts(JSContext* cx, HandleScript script, js::Sprinter* sp)
js::DumpPCCounts(JSContext* cx, HandleScript script, Sprinter* sp)
{
MOZ_ASSERT(script->hasScriptCounts());
@@ -245,7 +245,7 @@ js_DumpPCCounts(JSContext* cx, HandleScript script, js::Sprinter* sp)
JSOp op = JSOp(*pc);
jsbytecode* next = GetNextPc(pc);
if (!js_Disassemble1(cx, script, pc, script->pcToOffset(pc), true, sp))
if (!Disassemble1(cx, script, pc, script->pcToOffset(pc), true, sp))
return;
size_t total = PCCounts::numCounts(op);
@@ -290,7 +290,7 @@ js::DumpCompartmentPCCounts(JSContext* cx)
return;
fprintf(stdout, "--- SCRIPT %s:%d ---\n", script->filename(), (int) script->lineno());
js_DumpPCCounts(cx, script, &sprinter);
DumpPCCounts(cx, script, &sprinter);
fputs(sprinter.string(), stdout);
fprintf(stdout, "--- END SCRIPT %s:%d ---\n", script->filename(), (int) script->lineno());
}
@@ -425,7 +425,7 @@ class BytecodeParser
void reportOOM() {
allocScope_.releaseEarly();
js_ReportOutOfMemory(cx_);
ReportOutOfMemory(cx_);
}
uint32_t numSlots() {
@@ -717,9 +717,9 @@ js::ReconstructStackDepth(JSContext* cx, JSScript* script, jsbytecode* pc, uint3
* current line. If showAll is true, include the source note type and the
* entry stack depth.
*/
JS_FRIEND_API(bool)
js_DisassembleAtPC(JSContext* cx, JSScript* scriptArg, bool lines,
jsbytecode* pc, bool showAll, Sprinter* sp)
static bool
DisassembleAtPC(JSContext* cx, JSScript* scriptArg, bool lines,
jsbytecode* pc, bool showAll, Sprinter* sp)
{
RootedScript script(cx, scriptArg);
BytecodeParser parser(cx, script);
@@ -763,7 +763,7 @@ js_DisassembleAtPC(JSContext* cx, JSScript* scriptArg, bool lines,
sp->put(" ");
}
if (showAll) {
jssrcnote* sn = js_GetSrcNote(cx, script, next);
jssrcnote* sn = GetSrcNote(cx, script, next);
if (sn) {
MOZ_ASSERT(!SN_IS_TERMINATOR(sn));
jssrcnote* next = SN_NEXT(sn);
@@ -781,7 +781,7 @@ js_DisassembleAtPC(JSContext* cx, JSScript* scriptArg, bool lines,
else
Sprint(sp, " ");
}
len = js_Disassemble1(cx, script, next, script->pcToOffset(next), lines, sp);
len = Disassemble1(cx, script, next, script->pcToOffset(next), lines, sp);
if (!len)
return false;
next += len;
@@ -790,56 +790,9 @@ js_DisassembleAtPC(JSContext* cx, JSScript* scriptArg, bool lines,
}
bool
js_Disassemble(JSContext* cx, HandleScript script, bool lines, Sprinter* sp)
js::Disassemble(JSContext* cx, HandleScript script, bool lines, Sprinter* sp)
{
return js_DisassembleAtPC(cx, script, lines, nullptr, false, sp);
}
JS_FRIEND_API(bool)
js_DumpPC(JSContext* cx)
{
js::gc::AutoSuppressGC suppressGC(cx);
Sprinter sprinter(cx);
if (!sprinter.init())
return false;
ScriptFrameIter iter(cx);
if (iter.done()) {
fprintf(stdout, "Empty stack.\n");
return true;
}
RootedScript script(cx, iter.script());
bool ok = js_DisassembleAtPC(cx, script, true, iter.pc(), false, &sprinter);
fprintf(stdout, "%s", sprinter.string());
return ok;
}
JS_FRIEND_API(bool)
js_DumpScript(JSContext* cx, JSScript* scriptArg)
{
js::gc::AutoSuppressGC suppressGC(cx);
Sprinter sprinter(cx);
if (!sprinter.init())
return false;
RootedScript script(cx, scriptArg);
bool ok = js_Disassemble(cx, script, true, &sprinter);
fprintf(stdout, "%s", sprinter.string());
return ok;
}
/*
* Useful to debug ReconstructPCStack.
*/
JS_FRIEND_API(bool)
js_DumpScriptDepth(JSContext* cx, JSScript* scriptArg, jsbytecode* pc)
{
js::gc::AutoSuppressGC suppressGC(cx);
Sprinter sprinter(cx);
if (!sprinter.init())
return false;
RootedScript script(cx, scriptArg);
bool ok = js_DisassembleAtPC(cx, script, true, pc, true, &sprinter);
fprintf(stdout, "%s", sprinter.string());
return ok;
return DisassembleAtPC(cx, script, lines, nullptr, false, sp);
}
static char*
@@ -923,19 +876,19 @@ ToDisassemblySource(JSContext* cx, HandleValue v, JSAutoByteString* bytes)
}
}
return !!js_ValueToPrintable(cx, v, bytes, true);
return !!ValueToPrintable(cx, v, bytes, true);
}
unsigned
js_Disassemble1(JSContext* cx, HandleScript script, jsbytecode* pc,
unsigned loc, bool lines, Sprinter* sp)
js::Disassemble1(JSContext* cx, HandleScript script, jsbytecode* pc,
unsigned loc, bool lines, Sprinter* sp)
{
JSOp op = (JSOp)*pc;
if (op >= JSOP_LIMIT) {
char numBuf1[12], numBuf2[12];
JS_snprintf(numBuf1, sizeof numBuf1, "%d", op);
JS_snprintf(numBuf2, sizeof numBuf2, "%d", JSOP_LIMIT);
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
JSMSG_BYTECODE_TOO_BIG, numBuf1, numBuf2);
return 0;
}
@@ -1089,7 +1042,7 @@ js_Disassemble1(JSContext* cx, HandleScript script, jsbytecode* pc,
default: {
char numBuf[12];
JS_snprintf(numBuf, sizeof numBuf, "%lx", (unsigned long) cs->format);
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
JSMSG_UNKNOWN_FORMAT, numBuf);
return 0;
}
@@ -1295,7 +1248,7 @@ Sprinter::reportOutOfMemory()
if (reportedOOM)
return;
if (context)
js_ReportOutOfMemory(context);
ReportOutOfMemory(context);
reportedOOM = true;
}
@@ -1417,7 +1370,7 @@ QuoteString(Sprinter* sp, JSString* str, char16_t quote)
}
JSString*
js_QuoteString(ExclusiveContext* cx, JSString* str, char16_t quote)
js::QuoteString(ExclusiveContext* cx, JSString* str, char16_t quote)
{
Sprinter sprinter(cx);
if (!sprinter.init())
@@ -1509,7 +1462,7 @@ ExpressionDecompiler::decompilePC(jsbytecode* pc)
// Handle simple cases of binary and unary operators.
switch (js_CodeSpec[op].nuses) {
case 2: {
jssrcnote* sn = js_GetSrcNote(cx, script, pc);
jssrcnote* sn = GetSrcNote(cx, script, pc);
if (!sn || SN_TYPE(sn) != SRC_ASSIGNOP)
return write("(") &&
decompilePCForStackOperand(pc, -2) &&
@@ -2145,7 +2098,7 @@ js::GetPCCountScriptSummary(JSContext* cx, size_t index)
JSRuntime* rt = cx->runtime();
if (!rt->scriptAndCountsVector || index >= rt->scriptAndCountsVector->length()) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BUFFER_TOO_SMALL);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_BUFFER_TOO_SMALL);
return nullptr;
}
@@ -2398,7 +2351,7 @@ js::GetPCCountScriptContents(JSContext* cx, size_t index)
JSRuntime* rt = cx->runtime();
if (!rt->scriptAndCountsVector || index >= rt->scriptAndCountsVector->length()) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BUFFER_TOO_SMALL);
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_BUFFER_TOO_SMALL);
return nullptr;
}