mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 08:12:05 +00:00
Bug 1137523 part 2 - Unprefix a few js_* functions I forgot in part 1. r=bhackett
This commit is contained in:
parent
a235485fdb
commit
61b1b5c6bb
@ -27,7 +27,7 @@ namespace jsipc {
|
||||
#define LOG_STACK() \
|
||||
PR_BEGIN_MACRO \
|
||||
if (StackLoggingEnabled()) { \
|
||||
js_DumpBacktrace(cx); \
|
||||
js::DumpBacktrace(cx); \
|
||||
} \
|
||||
PR_END_MACRO
|
||||
|
||||
|
@ -1879,7 +1879,7 @@ DumpObject(JSContext *cx, unsigned argc, jsval *vp)
|
||||
if (!obj)
|
||||
return false;
|
||||
|
||||
js_DumpObject(obj);
|
||||
DumpObject(obj);
|
||||
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
@ -1924,7 +1924,7 @@ static bool
|
||||
DumpBacktrace(JSContext *cx, unsigned argc, jsval *vp)
|
||||
{
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
js_DumpBacktrace(cx);
|
||||
DumpBacktrace(cx);
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
}
|
||||
|
@ -7896,7 +7896,7 @@ SrcNoteArity(jssrcnote *sn)
|
||||
}
|
||||
|
||||
JS_FRIEND_API(unsigned)
|
||||
js_SrcNoteLength(jssrcnote *sn)
|
||||
js::SrcNoteLength(jssrcnote *sn)
|
||||
{
|
||||
unsigned arity;
|
||||
jssrcnote *base;
|
||||
@ -7910,7 +7910,7 @@ js_SrcNoteLength(jssrcnote *sn)
|
||||
}
|
||||
|
||||
JS_FRIEND_API(ptrdiff_t)
|
||||
js_GetSrcNoteOffset(jssrcnote *sn, unsigned which)
|
||||
js::GetSrcNoteOffset(jssrcnote *sn, unsigned which)
|
||||
{
|
||||
/* Find the offset numbered which (i.e., skip exactly which offsets). */
|
||||
MOZ_ASSERT(SN_TYPE(sn) != SRC_XDELTA);
|
||||
|
@ -73,7 +73,7 @@ AtomDecls<ParseHandler>::dump()
|
||||
{
|
||||
for (AtomDefnListRange r = map->all(); !r.empty(); r.popFront()) {
|
||||
fprintf(stderr, "atom: ");
|
||||
js_DumpAtom(r.front().key());
|
||||
DumpAtom(r.front().key());
|
||||
const DefinitionList &dlist = r.front().value();
|
||||
for (DefinitionList::Range dr = dlist.all(); !dr.empty(); dr.popFront()) {
|
||||
fprintf(stderr, " defn: %p\n", (void *) dr.front<ParseHandler>());
|
||||
@ -91,7 +91,7 @@ DumpAtomDefnMap(const AtomDefnMapPtr &map)
|
||||
|
||||
for (AtomDefnRange r = map->all(); !r.empty(); r.popFront()) {
|
||||
fprintf(stderr, "atom: ");
|
||||
js_DumpAtom(r.front().key());
|
||||
DumpAtom(r.front().key());
|
||||
fprintf(stderr, "defn: %p\n", (void *) r.front().value().get<FullParseHandler>());
|
||||
}
|
||||
}
|
||||
|
@ -184,7 +184,7 @@ SN_COLSPAN_TO_OFFSET(ptrdiff_t colspan) {
|
||||
}
|
||||
|
||||
#define SN_LENGTH(sn) ((js_SrcNoteSpec[SN_TYPE(sn)].arity == 0) ? 1 \
|
||||
: js_SrcNoteLength(sn))
|
||||
: js::SrcNoteLength(sn))
|
||||
#define SN_NEXT(sn) ((sn) + SN_LENGTH(sn))
|
||||
|
||||
struct JSSrcNoteSpec {
|
||||
@ -193,12 +193,18 @@ struct JSSrcNoteSpec {
|
||||
};
|
||||
|
||||
extern JS_FRIEND_DATA(const JSSrcNoteSpec) js_SrcNoteSpec[];
|
||||
extern JS_FRIEND_API(unsigned) js_SrcNoteLength(jssrcnote *sn);
|
||||
|
||||
namespace js {
|
||||
|
||||
extern JS_FRIEND_API(unsigned)
|
||||
SrcNoteLength(jssrcnote *sn);
|
||||
|
||||
/*
|
||||
* Get and set the offset operand identified by which (0 for the first, etc.).
|
||||
*/
|
||||
extern JS_FRIEND_API(ptrdiff_t)
|
||||
js_GetSrcNoteOffset(jssrcnote *sn, unsigned which);
|
||||
GetSrcNoteOffset(jssrcnote *sn, unsigned which);
|
||||
|
||||
}
|
||||
|
||||
#endif /* frontend_SourceNotes_h */
|
||||
|
@ -125,7 +125,7 @@ BytecodeAnalysis::init(TempAllocator &alloc, GSNCache &gsn)
|
||||
jssrcnote *sn = GetSrcNote(gsn, script_, pc);
|
||||
MOZ_ASSERT(SN_TYPE(sn) == SRC_TRY);
|
||||
|
||||
jsbytecode *endOfTry = pc + js_GetSrcNoteOffset(sn, 0);
|
||||
jsbytecode *endOfTry = pc + GetSrcNoteOffset(sn, 0);
|
||||
MOZ_ASSERT(JSOp(*endOfTry) == JSOP_GOTO);
|
||||
|
||||
jsbytecode *afterTry = endOfTry + GET_JUMP_OFFSET(endOfTry);
|
||||
|
@ -2919,7 +2919,7 @@ IonBuilder::assertValidLoopHeadOp(jsbytecode *pc)
|
||||
// do-while loops have a source note.
|
||||
jssrcnote *sn = info().getNote(gsn, pc);
|
||||
if (sn) {
|
||||
jsbytecode *ifne = pc + js_GetSrcNoteOffset(sn, 0);
|
||||
jsbytecode *ifne = pc + GetSrcNoteOffset(sn, 0);
|
||||
|
||||
jsbytecode *expected_ifne;
|
||||
switch (state.state) {
|
||||
@ -2952,11 +2952,11 @@ IonBuilder::doWhileLoop(JSOp op, jssrcnote *sn)
|
||||
// COND ; start of condition
|
||||
// ...
|
||||
// IFNE -> ; goes to LOOPHEAD
|
||||
int condition_offset = js_GetSrcNoteOffset(sn, 0);
|
||||
int condition_offset = GetSrcNoteOffset(sn, 0);
|
||||
jsbytecode *conditionpc = pc + condition_offset;
|
||||
|
||||
jssrcnote *sn2 = info().getNote(gsn, pc+1);
|
||||
int offset = js_GetSrcNoteOffset(sn2, 0);
|
||||
int offset = GetSrcNoteOffset(sn2, 0);
|
||||
jsbytecode *ifne = pc + offset + 1;
|
||||
MOZ_ASSERT(ifne > pc);
|
||||
|
||||
@ -3022,7 +3022,7 @@ IonBuilder::whileOrForInLoop(jssrcnote *sn)
|
||||
// IFNE ; goes to LOOPHEAD
|
||||
// for (x in y) { } loops are similar; the cond will be a MOREITER.
|
||||
MOZ_ASSERT(SN_TYPE(sn) == SRC_FOR_OF || SN_TYPE(sn) == SRC_FOR_IN || SN_TYPE(sn) == SRC_WHILE);
|
||||
int ifneOffset = js_GetSrcNoteOffset(sn, 0);
|
||||
int ifneOffset = GetSrcNoteOffset(sn, 0);
|
||||
jsbytecode *ifne = pc + ifneOffset;
|
||||
MOZ_ASSERT(ifne > pc);
|
||||
|
||||
@ -3086,9 +3086,9 @@ IonBuilder::forLoop(JSOp op, jssrcnote *sn)
|
||||
MOZ_ASSERT(op == JSOP_POP || op == JSOP_NOP);
|
||||
pc = GetNextPc(pc);
|
||||
|
||||
jsbytecode *condpc = pc + js_GetSrcNoteOffset(sn, 0);
|
||||
jsbytecode *updatepc = pc + js_GetSrcNoteOffset(sn, 1);
|
||||
jsbytecode *ifne = pc + js_GetSrcNoteOffset(sn, 2);
|
||||
jsbytecode *condpc = pc + GetSrcNoteOffset(sn, 0);
|
||||
jsbytecode *updatepc = pc + GetSrcNoteOffset(sn, 1);
|
||||
jsbytecode *ifne = pc + GetSrcNoteOffset(sn, 2);
|
||||
jsbytecode *exitpc = GetNextPc(ifne);
|
||||
|
||||
// for loops have the following structures:
|
||||
@ -3213,7 +3213,7 @@ IonBuilder::tableSwitch(JSOp op, jssrcnote *sn)
|
||||
MDefinition *ins = current->pop();
|
||||
|
||||
// Get the default and exit pc
|
||||
jsbytecode *exitpc = pc + js_GetSrcNoteOffset(sn, 0);
|
||||
jsbytecode *exitpc = pc + GetSrcNoteOffset(sn, 0);
|
||||
jsbytecode *defaultpc = pc + GET_JUMP_OFFSET(pc);
|
||||
|
||||
MOZ_ASSERT(defaultpc > pc && defaultpc <= exitpc);
|
||||
@ -3775,8 +3775,8 @@ IonBuilder::jsop_condswitch()
|
||||
MOZ_ASSERT(SN_TYPE(sn) == SRC_CONDSWITCH);
|
||||
|
||||
// Get the exit pc
|
||||
jsbytecode *exitpc = pc + js_GetSrcNoteOffset(sn, 0);
|
||||
jsbytecode *firstCase = pc + js_GetSrcNoteOffset(sn, 1);
|
||||
jsbytecode *exitpc = pc + GetSrcNoteOffset(sn, 0);
|
||||
jsbytecode *firstCase = pc + GetSrcNoteOffset(sn, 1);
|
||||
|
||||
// Iterate all cases in the conditional switch.
|
||||
// - Stop at the default case. (always emitted after the last case)
|
||||
@ -3791,7 +3791,7 @@ IonBuilder::jsop_condswitch()
|
||||
// Fetch the next case.
|
||||
jssrcnote *caseSn = info().getNote(gsn, curCase);
|
||||
MOZ_ASSERT(caseSn && SN_TYPE(caseSn) == SRC_NEXTCASE);
|
||||
ptrdiff_t off = js_GetSrcNoteOffset(caseSn, 0);
|
||||
ptrdiff_t off = GetSrcNoteOffset(caseSn, 0);
|
||||
curCase = off ? curCase + off : GetNextPc(curCase);
|
||||
MOZ_ASSERT(pc < curCase && curCase <= exitpc);
|
||||
|
||||
@ -3871,7 +3871,7 @@ IonBuilder::processCondSwitchCase(CFGState &state)
|
||||
|
||||
// Fetch the following case in which we will continue.
|
||||
jssrcnote *sn = info().getNote(gsn, pc);
|
||||
ptrdiff_t off = js_GetSrcNoteOffset(sn, 0);
|
||||
ptrdiff_t off = GetSrcNoteOffset(sn, 0);
|
||||
jsbytecode *casePc = off ? pc + off : GetNextPc(pc);
|
||||
bool caseIsDefault = JSOp(*casePc) == JSOP_DEFAULT;
|
||||
MOZ_ASSERT(JSOp(*casePc) == JSOP_CASE || caseIsDefault);
|
||||
@ -4152,7 +4152,7 @@ IonBuilder::jsop_ifeq(JSOp op)
|
||||
{
|
||||
// Infer the join point from the JSOP_GOTO[X] sitting here, then
|
||||
// assert as we much we can that this is the right GOTO.
|
||||
jsbytecode *trueEnd = pc + js_GetSrcNoteOffset(sn, 0);
|
||||
jsbytecode *trueEnd = pc + GetSrcNoteOffset(sn, 0);
|
||||
MOZ_ASSERT(trueEnd > pc);
|
||||
MOZ_ASSERT(trueEnd < falseStart);
|
||||
MOZ_ASSERT(JSOp(*trueEnd) == JSOP_GOTO);
|
||||
@ -4207,7 +4207,7 @@ IonBuilder::jsop_try()
|
||||
|
||||
// Get the pc of the last instruction in the try block. It's a JSOP_GOTO to
|
||||
// jump over the catch block.
|
||||
jsbytecode *endpc = pc + js_GetSrcNoteOffset(sn, 0);
|
||||
jsbytecode *endpc = pc + GetSrcNoteOffset(sn, 0);
|
||||
MOZ_ASSERT(JSOp(*endpc) == JSOP_GOTO);
|
||||
MOZ_ASSERT(GetJumpOffset(endpc) > 0);
|
||||
|
||||
|
@ -2572,7 +2572,7 @@ struct DumpOp {
|
||||
void operator()(const Value& v) {
|
||||
fprintf(stderr, " actual (arg %d): ", i_);
|
||||
#ifdef DEBUG
|
||||
js_DumpValue(v);
|
||||
DumpValue(v);
|
||||
#else
|
||||
fprintf(stderr, "?\n");
|
||||
#endif
|
||||
@ -2589,7 +2589,7 @@ JitFrameIterator::dumpBaseline() const
|
||||
if (isFunctionFrame()) {
|
||||
fprintf(stderr, " callee fun: ");
|
||||
#ifdef DEBUG
|
||||
js_DumpObject(callee());
|
||||
DumpObject(callee());
|
||||
#else
|
||||
fprintf(stderr, "?\n");
|
||||
#endif
|
||||
@ -2616,7 +2616,7 @@ JitFrameIterator::dumpBaseline() const
|
||||
fprintf(stderr, " slot %u: ", i);
|
||||
#ifdef DEBUG
|
||||
Value *v = frame->valueSlot(i);
|
||||
js_DumpValue(*v);
|
||||
DumpValue(*v);
|
||||
#else
|
||||
fprintf(stderr, "?\n");
|
||||
#endif
|
||||
@ -2638,7 +2638,7 @@ InlineFrameIterator::dump() const
|
||||
isFunction = true;
|
||||
fprintf(stderr, " callee fun: ");
|
||||
#ifdef DEBUG
|
||||
js_DumpObject(callee(fallback));
|
||||
DumpObject(callee(fallback));
|
||||
#else
|
||||
fprintf(stderr, "?\n");
|
||||
#endif
|
||||
@ -2677,7 +2677,7 @@ InlineFrameIterator::dump() const
|
||||
} else
|
||||
fprintf(stderr, " slot %u: ", i);
|
||||
#ifdef DEBUG
|
||||
js_DumpValue(si.maybeRead(fallback));
|
||||
DumpValue(si.maybeRead(fallback));
|
||||
#else
|
||||
fprintf(stderr, "?\n");
|
||||
#endif
|
||||
|
@ -162,7 +162,7 @@ RematerializedFrame::dump()
|
||||
if (isFunctionFrame()) {
|
||||
fprintf(stderr, " callee fun: ");
|
||||
#ifdef DEBUG
|
||||
js_DumpValue(ObjectValue(*callee()));
|
||||
DumpValue(ObjectValue(*callee()));
|
||||
#else
|
||||
fprintf(stderr, "?\n");
|
||||
#endif
|
||||
@ -179,7 +179,7 @@ RematerializedFrame::dump()
|
||||
if (isFunctionFrame()) {
|
||||
fprintf(stderr, " scope chain: ");
|
||||
#ifdef DEBUG
|
||||
js_DumpValue(ObjectValue(*scopeChain()));
|
||||
DumpValue(ObjectValue(*scopeChain()));
|
||||
#else
|
||||
fprintf(stderr, "?\n");
|
||||
#endif
|
||||
@ -187,7 +187,7 @@ RematerializedFrame::dump()
|
||||
if (hasArgsObj()) {
|
||||
fprintf(stderr, " args obj: ");
|
||||
#ifdef DEBUG
|
||||
js_DumpValue(ObjectValue(argsObj()));
|
||||
DumpValue(ObjectValue(argsObj()));
|
||||
#else
|
||||
fprintf(stderr, "?\n");
|
||||
#endif
|
||||
@ -195,7 +195,7 @@ RematerializedFrame::dump()
|
||||
|
||||
fprintf(stderr, " this: ");
|
||||
#ifdef DEBUG
|
||||
js_DumpValue(thisValue());
|
||||
DumpValue(thisValue());
|
||||
#else
|
||||
fprintf(stderr, "?\n");
|
||||
#endif
|
||||
@ -206,7 +206,7 @@ RematerializedFrame::dump()
|
||||
else
|
||||
fprintf(stderr, " overflown (arg %d): ", i);
|
||||
#ifdef DEBUG
|
||||
js_DumpValue(argv()[i]);
|
||||
DumpValue(argv()[i]);
|
||||
#else
|
||||
fprintf(stderr, "?\n");
|
||||
#endif
|
||||
@ -215,7 +215,7 @@ RematerializedFrame::dump()
|
||||
for (unsigned i = 0; i < script()->nfixed(); i++) {
|
||||
fprintf(stderr, " local %d: ", i);
|
||||
#ifdef DEBUG
|
||||
js_DumpValue(locals()[i]);
|
||||
DumpValue(locals()[i]);
|
||||
#else
|
||||
fprintf(stderr, "?\n");
|
||||
#endif
|
||||
|
@ -3242,7 +3242,7 @@ JS_BindCallable(JSContext *cx, HandleObject target, HandleObject newThis)
|
||||
}
|
||||
|
||||
static bool
|
||||
js_generic_native_method_dispatcher(JSContext *cx, unsigned argc, Value *vp)
|
||||
GenericNativeMethodDispatcher(JSContext *cx, unsigned argc, Value *vp)
|
||||
{
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
@ -3311,7 +3311,7 @@ JS_DefineFunctions(JSContext *cx, HandleObject obj, const JSFunctionSpec *fs,
|
||||
|
||||
flags &= ~JSFUN_GENERIC_NATIVE;
|
||||
JSFunction *fun = DefineFunction(cx, ctor, id,
|
||||
js_generic_native_method_dispatcher,
|
||||
GenericNativeMethodDispatcher,
|
||||
fs->nargs + 1, flags,
|
||||
JSFunction::ExtendedFinalizeKind);
|
||||
if (!fun)
|
||||
|
@ -630,19 +630,19 @@ JS_CloneObject(JSContext *cx, HandleObject obj, HandleObject protoArg)
|
||||
|
||||
#ifdef DEBUG
|
||||
JS_FRIEND_API(void)
|
||||
js_DumpString(JSString *str)
|
||||
js::DumpString(JSString *str)
|
||||
{
|
||||
str->dump();
|
||||
}
|
||||
|
||||
JS_FRIEND_API(void)
|
||||
js_DumpAtom(JSAtom *atom)
|
||||
js::DumpAtom(JSAtom *atom)
|
||||
{
|
||||
atom->dump();
|
||||
}
|
||||
|
||||
JS_FRIEND_API(void)
|
||||
js_DumpChars(const char16_t *s, size_t n)
|
||||
js::DumpChars(const char16_t *s, size_t n)
|
||||
{
|
||||
fprintf(stderr, "char16_t * (%p) = ", (void *) s);
|
||||
JSString::dumpChars(s, n);
|
||||
@ -650,7 +650,7 @@ js_DumpChars(const char16_t *s, size_t n)
|
||||
}
|
||||
|
||||
JS_FRIEND_API(void)
|
||||
js_DumpObject(JSObject *obj)
|
||||
js::DumpObject(JSObject *obj)
|
||||
{
|
||||
if (!obj) {
|
||||
fprintf(stderr, "NULL\n");
|
||||
|
@ -188,41 +188,47 @@ AddRawValueRoot(JSContext *cx, JS::Value *vp, const char *name);
|
||||
JS_FRIEND_API(void)
|
||||
RemoveRawValueRoot(JSContext *cx, JS::Value *vp);
|
||||
|
||||
} /* namespace js */
|
||||
|
||||
#ifdef JS_DEBUG
|
||||
|
||||
/*
|
||||
* Routines to print out values during debugging. These are FRIEND_API to help
|
||||
* the debugger find them and to support temporarily hacking js_Dump* calls
|
||||
* the debugger find them and to support temporarily hacking js::Dump* calls
|
||||
* into other code.
|
||||
*/
|
||||
|
||||
extern JS_FRIEND_API(void)
|
||||
js_DumpString(JSString *str);
|
||||
DumpString(JSString *str);
|
||||
|
||||
extern JS_FRIEND_API(void)
|
||||
js_DumpAtom(JSAtom *atom);
|
||||
DumpAtom(JSAtom *atom);
|
||||
|
||||
extern JS_FRIEND_API(void)
|
||||
js_DumpObject(JSObject *obj);
|
||||
DumpObject(JSObject *obj);
|
||||
|
||||
extern JS_FRIEND_API(void)
|
||||
js_DumpChars(const char16_t *s, size_t n);
|
||||
DumpChars(const char16_t *s, size_t n);
|
||||
|
||||
extern JS_FRIEND_API(void)
|
||||
js_DumpValue(const JS::Value &val);
|
||||
DumpValue(const JS::Value &val);
|
||||
|
||||
extern JS_FRIEND_API(void)
|
||||
js_DumpId(jsid id);
|
||||
DumpId(jsid id);
|
||||
|
||||
extern JS_FRIEND_API(void)
|
||||
js_DumpInterpreterFrame(JSContext *cx, js::InterpreterFrame *start = nullptr);
|
||||
DumpInterpreterFrame(JSContext *cx, InterpreterFrame *start = nullptr);
|
||||
|
||||
extern JS_FRIEND_API(bool)
|
||||
DumpPC(JSContext *cx);
|
||||
|
||||
extern JS_FRIEND_API(bool)
|
||||
DumpScript(JSContext *cx, JSScript *scriptArg);
|
||||
|
||||
#endif
|
||||
|
||||
extern JS_FRIEND_API(void)
|
||||
js_DumpBacktrace(JSContext *cx);
|
||||
DumpBacktrace(JSContext *cx);
|
||||
|
||||
} // namespace js
|
||||
|
||||
namespace JS {
|
||||
|
||||
|
@ -3045,7 +3045,7 @@ js::LookupPropertyPure(ExclusiveContext *cx, JSObject *obj, jsid id, JSObject **
|
||||
do {
|
||||
const Class *clasp = obj->getClass();
|
||||
if (!clasp->resolve)
|
||||
break;
|
||||
break;
|
||||
if (clasp->resolve == fun_resolve && !FunctionHasResolveHook(cx->names(), id))
|
||||
break;
|
||||
if (clasp->resolve == str_resolve && !JSID_IS_INT(id))
|
||||
@ -3736,7 +3736,7 @@ js::ReportGetterOnlyAssignment(JSContext *cx, bool strict)
|
||||
|
||||
/*
|
||||
* Routines to print out values during debugging. These are FRIEND_API to help
|
||||
* the debugger find them and to support temporarily hacking js_Dump* calls
|
||||
* the debugger find them and to support temporarily hacking js::Dump* calls
|
||||
* into other code.
|
||||
*/
|
||||
|
||||
@ -3799,14 +3799,14 @@ dumpValue(const Value &v)
|
||||
}
|
||||
|
||||
JS_FRIEND_API(void)
|
||||
js_DumpValue(const Value &val)
|
||||
js::DumpValue(const Value &val)
|
||||
{
|
||||
dumpValue(val);
|
||||
fputc('\n', stderr);
|
||||
}
|
||||
|
||||
JS_FRIEND_API(void)
|
||||
js_DumpId(jsid id)
|
||||
js::DumpId(jsid id)
|
||||
{
|
||||
fprintf(stderr, "jsid %p = ", (void *) JSID_BITS(id));
|
||||
dumpValue(IdToValue(id));
|
||||
@ -3966,7 +3966,7 @@ MaybeDumpValue(const char *name, const Value &v)
|
||||
}
|
||||
|
||||
JS_FRIEND_API(void)
|
||||
js_DumpInterpreterFrame(JSContext *cx, InterpreterFrame *start)
|
||||
js::DumpInterpreterFrame(JSContext *cx, InterpreterFrame *start)
|
||||
{
|
||||
/* This should only called during live debugging. */
|
||||
ScriptFrameIter i(cx, ScriptFrameIter::GO_THROUGH_SAVED);
|
||||
@ -4036,7 +4036,7 @@ js_DumpInterpreterFrame(JSContext *cx, InterpreterFrame *start)
|
||||
#endif /* DEBUG */
|
||||
|
||||
JS_FRIEND_API(void)
|
||||
js_DumpBacktrace(JSContext *cx)
|
||||
js::DumpBacktrace(JSContext *cx)
|
||||
{
|
||||
Sprinter sprinter(cx);
|
||||
sprinter.init();
|
||||
|
@ -797,6 +797,37 @@ js::Disassemble(JSContext *cx, HandleScript script, bool lines, Sprinter *sp)
|
||||
return DisassembleAtPC(cx, script, lines, nullptr, false, sp);
|
||||
}
|
||||
|
||||
JS_FRIEND_API(bool)
|
||||
js::DumpPC(JSContext *cx)
|
||||
{
|
||||
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 = 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)
|
||||
{
|
||||
gc::AutoSuppressGC suppressGC(cx);
|
||||
Sprinter sprinter(cx);
|
||||
if (!sprinter.init())
|
||||
return false;
|
||||
RootedScript script(cx, scriptArg);
|
||||
bool ok = Disassemble(cx, script, true, &sprinter);
|
||||
fprintf(stdout, "%s", sprinter.string());
|
||||
return ok;
|
||||
}
|
||||
|
||||
static char *
|
||||
QuoteString(Sprinter *sp, JSString *str, char16_t quote);
|
||||
|
||||
|
@ -452,7 +452,7 @@ class SrcNoteLineScanner
|
||||
*/
|
||||
bool lineHeader;
|
||||
|
||||
public:
|
||||
public:
|
||||
SrcNoteLineScanner(jssrcnote *sn, uint32_t lineno)
|
||||
: offset(0), sn(sn), lineno(lineno)
|
||||
{
|
||||
@ -491,7 +491,7 @@ public:
|
||||
SrcNoteType type = (SrcNoteType) SN_TYPE(sn);
|
||||
if (type == SRC_SETLINE || type == SRC_NEWLINE) {
|
||||
if (type == SRC_SETLINE)
|
||||
lineno = js_GetSrcNoteOffset(sn, 0);
|
||||
lineno = GetSrcNoteOffset(sn, 0);
|
||||
else
|
||||
lineno++;
|
||||
|
||||
|
@ -2803,7 +2803,7 @@ js::PCToLineNumber(unsigned startLine, jssrcnote *notes, jsbytecode *code, jsbyt
|
||||
SrcNoteType type = (SrcNoteType) SN_TYPE(sn);
|
||||
if (type == SRC_SETLINE) {
|
||||
if (offset <= target)
|
||||
lineno = (unsigned) js_GetSrcNoteOffset(sn, 0);
|
||||
lineno = unsigned(GetSrcNoteOffset(sn, 0));
|
||||
column = 0;
|
||||
} else if (type == SRC_NEWLINE) {
|
||||
if (offset <= target)
|
||||
@ -2815,7 +2815,7 @@ js::PCToLineNumber(unsigned startLine, jssrcnote *notes, jsbytecode *code, jsbyt
|
||||
break;
|
||||
|
||||
if (type == SRC_COLSPAN) {
|
||||
ptrdiff_t colspan = SN_OFFSET_TO_COLSPAN(js_GetSrcNoteOffset(sn, 0));
|
||||
ptrdiff_t colspan = SN_OFFSET_TO_COLSPAN(GetSrcNoteOffset(sn, 0));
|
||||
MOZ_ASSERT(ptrdiff_t(column) + colspan >= 0);
|
||||
column += colspan;
|
||||
}
|
||||
@ -2861,7 +2861,7 @@ js::LineNumberToPC(JSScript *script, unsigned target)
|
||||
offset += SN_DELTA(sn);
|
||||
SrcNoteType type = (SrcNoteType) SN_TYPE(sn);
|
||||
if (type == SRC_SETLINE) {
|
||||
lineno = (unsigned) js_GetSrcNoteOffset(sn, 0);
|
||||
lineno = unsigned(GetSrcNoteOffset(sn, 0));
|
||||
} else if (type == SRC_NEWLINE) {
|
||||
lineno++;
|
||||
}
|
||||
@ -2880,7 +2880,7 @@ js::GetScriptLineExtent(JSScript *script)
|
||||
for (jssrcnote *sn = script->notes(); !SN_IS_TERMINATOR(sn); sn = SN_NEXT(sn)) {
|
||||
SrcNoteType type = (SrcNoteType) SN_TYPE(sn);
|
||||
if (type == SRC_SETLINE)
|
||||
lineno = (unsigned) js_GetSrcNoteOffset(sn, 0);
|
||||
lineno = unsigned(GetSrcNoteOffset(sn, 0));
|
||||
else if (type == SRC_NEWLINE)
|
||||
lineno++;
|
||||
|
||||
|
@ -2098,12 +2098,12 @@ SrcNotes(JSContext *cx, HandleScript script, Sprinter *sp)
|
||||
break;
|
||||
|
||||
case SRC_COLSPAN:
|
||||
colspan = SN_OFFSET_TO_COLSPAN(js_GetSrcNoteOffset(sn, 0));
|
||||
colspan = SN_OFFSET_TO_COLSPAN(GetSrcNoteOffset(sn, 0));
|
||||
Sprint(sp, "%d", colspan);
|
||||
break;
|
||||
|
||||
case SRC_SETLINE:
|
||||
lineno = js_GetSrcNoteOffset(sn, 0);
|
||||
lineno = GetSrcNoteOffset(sn, 0);
|
||||
Sprint(sp, " lineno %u", lineno);
|
||||
break;
|
||||
|
||||
@ -2113,30 +2113,30 @@ SrcNotes(JSContext *cx, HandleScript script, Sprinter *sp)
|
||||
|
||||
case SRC_FOR:
|
||||
Sprint(sp, " cond %u update %u tail %u",
|
||||
unsigned(js_GetSrcNoteOffset(sn, 0)),
|
||||
unsigned(js_GetSrcNoteOffset(sn, 1)),
|
||||
unsigned(js_GetSrcNoteOffset(sn, 2)));
|
||||
unsigned(GetSrcNoteOffset(sn, 0)),
|
||||
unsigned(GetSrcNoteOffset(sn, 1)),
|
||||
unsigned(GetSrcNoteOffset(sn, 2)));
|
||||
break;
|
||||
|
||||
case SRC_IF_ELSE:
|
||||
Sprint(sp, " else %u", unsigned(js_GetSrcNoteOffset(sn, 0)));
|
||||
Sprint(sp, " else %u", unsigned(GetSrcNoteOffset(sn, 0)));
|
||||
break;
|
||||
|
||||
case SRC_FOR_IN:
|
||||
case SRC_FOR_OF:
|
||||
Sprint(sp, " closingjump %u", unsigned(js_GetSrcNoteOffset(sn, 0)));
|
||||
Sprint(sp, " closingjump %u", unsigned(GetSrcNoteOffset(sn, 0)));
|
||||
break;
|
||||
|
||||
case SRC_COND:
|
||||
case SRC_WHILE:
|
||||
case SRC_NEXTCASE:
|
||||
Sprint(sp, " offset %u", unsigned(js_GetSrcNoteOffset(sn, 0)));
|
||||
Sprint(sp, " offset %u", unsigned(GetSrcNoteOffset(sn, 0)));
|
||||
break;
|
||||
|
||||
case SRC_TABLESWITCH: {
|
||||
JSOp op = JSOp(script->code()[offset]);
|
||||
MOZ_ASSERT(op == JSOP_TABLESWITCH);
|
||||
Sprint(sp, " length %u", unsigned(js_GetSrcNoteOffset(sn, 0)));
|
||||
Sprint(sp, " length %u", unsigned(GetSrcNoteOffset(sn, 0)));
|
||||
UpdateSwitchTableBounds(cx, script, offset,
|
||||
&switchTableStart, &switchTableEnd);
|
||||
break;
|
||||
@ -2144,8 +2144,8 @@ SrcNotes(JSContext *cx, HandleScript script, Sprinter *sp)
|
||||
case SRC_CONDSWITCH: {
|
||||
JSOp op = JSOp(script->code()[offset]);
|
||||
MOZ_ASSERT(op == JSOP_CONDSWITCH);
|
||||
Sprint(sp, " length %u", unsigned(js_GetSrcNoteOffset(sn, 0)));
|
||||
unsigned caseOff = (unsigned) js_GetSrcNoteOffset(sn, 1);
|
||||
Sprint(sp, " length %u", unsigned(GetSrcNoteOffset(sn, 0)));
|
||||
unsigned caseOff = (unsigned) GetSrcNoteOffset(sn, 1);
|
||||
if (caseOff)
|
||||
Sprint(sp, " first case offset %u", caseOff);
|
||||
UpdateSwitchTableBounds(cx, script, offset,
|
||||
@ -2155,7 +2155,7 @@ SrcNotes(JSContext *cx, HandleScript script, Sprinter *sp)
|
||||
|
||||
case SRC_TRY:
|
||||
MOZ_ASSERT(JSOp(script->code()[offset]) == JSOP_TRY);
|
||||
Sprint(sp, " offset to jump %u", unsigned(js_GetSrcNoteOffset(sn, 0)));
|
||||
Sprint(sp, " offset to jump %u", unsigned(GetSrcNoteOffset(sn, 0)));
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -4449,11 +4449,11 @@ class BytecodeRangeWithPosition : private BytecodeRange
|
||||
while (!SN_IS_TERMINATOR(sn) && snpc <= frontPC()) {
|
||||
SrcNoteType type = (SrcNoteType) SN_TYPE(sn);
|
||||
if (type == SRC_COLSPAN) {
|
||||
ptrdiff_t colspan = SN_OFFSET_TO_COLSPAN(js_GetSrcNoteOffset(sn, 0));
|
||||
ptrdiff_t colspan = SN_OFFSET_TO_COLSPAN(GetSrcNoteOffset(sn, 0));
|
||||
MOZ_ASSERT(ptrdiff_t(column) + colspan >= 0);
|
||||
column += colspan;
|
||||
} if (type == SRC_SETLINE) {
|
||||
lineno = size_t(js_GetSrcNoteOffset(sn, 0));
|
||||
lineno = size_t(GetSrcNoteOffset(sn, 0));
|
||||
column = 0;
|
||||
} else if (type == SRC_NEWLINE) {
|
||||
lineno++;
|
||||
|
@ -59,7 +59,7 @@ JS_FOR_EACH_PROTOTYPE(DECLARE_PROTOTYPE_CLASS_INIT)
|
||||
JSObject *
|
||||
js::InitViaClassSpec(JSContext *cx, Handle<JSObject*> obj)
|
||||
{
|
||||
MOZ_CRASH("js_InitViaClassSpec() should not be called.");
|
||||
MOZ_CRASH("InitViaClassSpec() should not be called.");
|
||||
}
|
||||
|
||||
static const ProtoTableEntry protoTable[JSProto_LIMIT] = {
|
||||
@ -105,7 +105,7 @@ GlobalObject::resolveConstructor(JSContext *cx, Handle<GlobalObject*> global, JS
|
||||
MOZ_ASSERT(!global->isStandardClassResolved(key));
|
||||
|
||||
// There are two different kinds of initialization hooks. One of them is
|
||||
// the class js_InitFoo hook, defined in a JSProtoKey-keyed table at the
|
||||
// the class js::InitFoo hook, defined in a JSProtoKey-keyed table at the
|
||||
// top of this file. The other lives in the ClassSpec for classes that
|
||||
// define it. Classes may use one or the other, but not both.
|
||||
ClassInitializerOp init = protoTable[key].init;
|
||||
|
@ -1396,11 +1396,12 @@ js::NativeDefineProperty(ExclusiveContext *cx, HandleNativeObject obj, HandleId
|
||||
// If we did a normal lookup here, it would cause resolve hook recursion in
|
||||
// the following case. Suppose the first script we run in a lazy global is
|
||||
// |parseInt()|.
|
||||
// - js_InitNumber is called to resolve parseInt.
|
||||
// - js_InitNumber tries to define the Number constructor on the global.
|
||||
// - js::InitNumberClass is called to resolve parseInt.
|
||||
// - js::InitNumberClass tries to define the Number constructor on the
|
||||
// global.
|
||||
// - We end up here.
|
||||
// - This lookup for 'Number' triggers the global resolve hook.
|
||||
// - js_InitNumber is called again, this time to resolve Number.
|
||||
// - js::InitNumberClass is called again, this time to resolve Number.
|
||||
// - It creates a second Number constructor, which trips an assertion.
|
||||
//
|
||||
// Therefore we do a special lookup that does not call the resolve hook.
|
||||
|
Loading…
Reference in New Issue
Block a user