From 61b1b5c6bb08fa85e2a059735148943dabefa941 Mon Sep 17 00:00:00 2001 From: Jan de Mooij Date: Tue, 3 Mar 2015 09:33:22 +0100 Subject: [PATCH] Bug 1137523 part 2 - Unprefix a few js_* functions I forgot in part 1. r=bhackett --- js/ipc/JavaScriptLogging.h | 2 +- js/src/builtin/TestingFunctions.cpp | 4 ++-- js/src/frontend/BytecodeEmitter.cpp | 4 ++-- js/src/frontend/ParseMaps.cpp | 4 ++-- js/src/frontend/SourceNotes.h | 12 ++++++++--- js/src/jit/BytecodeAnalysis.cpp | 2 +- js/src/jit/IonBuilder.cpp | 28 +++++++++++++------------- js/src/jit/JitFrames.cpp | 10 +++++----- js/src/jit/RematerializedFrame.cpp | 12 +++++------ js/src/jsapi.cpp | 4 ++-- js/src/jsfriendapi.cpp | 8 ++++---- js/src/jsfriendapi.h | 28 ++++++++++++++++---------- js/src/jsobj.cpp | 12 +++++------ js/src/jsopcode.cpp | 31 +++++++++++++++++++++++++++++ js/src/jsopcode.h | 4 ++-- js/src/jsscript.cpp | 8 ++++---- js/src/shell/js.cpp | 24 +++++++++++----------- js/src/vm/Debugger.cpp | 4 ++-- js/src/vm/GlobalObject.cpp | 4 ++-- js/src/vm/NativeObject.cpp | 7 ++++--- 20 files changed, 128 insertions(+), 84 deletions(-) diff --git a/js/ipc/JavaScriptLogging.h b/js/ipc/JavaScriptLogging.h index 50b025c90df8..68c7d704ed44 100644 --- a/js/ipc/JavaScriptLogging.h +++ b/js/ipc/JavaScriptLogging.h @@ -27,7 +27,7 @@ namespace jsipc { #define LOG_STACK() \ PR_BEGIN_MACRO \ if (StackLoggingEnabled()) { \ - js_DumpBacktrace(cx); \ + js::DumpBacktrace(cx); \ } \ PR_END_MACRO diff --git a/js/src/builtin/TestingFunctions.cpp b/js/src/builtin/TestingFunctions.cpp index c098822280f1..2d048d1f29d9 100644 --- a/js/src/builtin/TestingFunctions.cpp +++ b/js/src/builtin/TestingFunctions.cpp @@ -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; } diff --git a/js/src/frontend/BytecodeEmitter.cpp b/js/src/frontend/BytecodeEmitter.cpp index 8d1b957b9386..ef575252f095 100644 --- a/js/src/frontend/BytecodeEmitter.cpp +++ b/js/src/frontend/BytecodeEmitter.cpp @@ -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); diff --git a/js/src/frontend/ParseMaps.cpp b/js/src/frontend/ParseMaps.cpp index 0395bce2f510..bd4da5545f84 100644 --- a/js/src/frontend/ParseMaps.cpp +++ b/js/src/frontend/ParseMaps.cpp @@ -73,7 +73,7 @@ AtomDecls::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()); @@ -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()); } } diff --git a/js/src/frontend/SourceNotes.h b/js/src/frontend/SourceNotes.h index 3d358ef6c389..741cbad7ada2 100644 --- a/js/src/frontend/SourceNotes.h +++ b/js/src/frontend/SourceNotes.h @@ -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 */ diff --git a/js/src/jit/BytecodeAnalysis.cpp b/js/src/jit/BytecodeAnalysis.cpp index b46064628ecb..167cce70600d 100644 --- a/js/src/jit/BytecodeAnalysis.cpp +++ b/js/src/jit/BytecodeAnalysis.cpp @@ -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); diff --git a/js/src/jit/IonBuilder.cpp b/js/src/jit/IonBuilder.cpp index 674761e63d50..8434886a1bb1 100644 --- a/js/src/jit/IonBuilder.cpp +++ b/js/src/jit/IonBuilder.cpp @@ -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); diff --git a/js/src/jit/JitFrames.cpp b/js/src/jit/JitFrames.cpp index 2ab393000207..14fce7f3afaf 100644 --- a/js/src/jit/JitFrames.cpp +++ b/js/src/jit/JitFrames.cpp @@ -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 diff --git a/js/src/jit/RematerializedFrame.cpp b/js/src/jit/RematerializedFrame.cpp index 272093dacac3..b0333be473d6 100644 --- a/js/src/jit/RematerializedFrame.cpp +++ b/js/src/jit/RematerializedFrame.cpp @@ -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 diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp index af278b0fc3ba..5a80d4f645bb 100644 --- a/js/src/jsapi.cpp +++ b/js/src/jsapi.cpp @@ -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) diff --git a/js/src/jsfriendapi.cpp b/js/src/jsfriendapi.cpp index 16bc998ceff4..2ab00dd22047 100644 --- a/js/src/jsfriendapi.cpp +++ b/js/src/jsfriendapi.cpp @@ -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"); diff --git a/js/src/jsfriendapi.h b/js/src/jsfriendapi.h index 78b1f50282d0..4a1d196aec11 100644 --- a/js/src/jsfriendapi.h +++ b/js/src/jsfriendapi.h @@ -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 { diff --git a/js/src/jsobj.cpp b/js/src/jsobj.cpp index 70a9d244d421..f4c7f741ee00 100644 --- a/js/src/jsobj.cpp +++ b/js/src/jsobj.cpp @@ -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(); diff --git a/js/src/jsopcode.cpp b/js/src/jsopcode.cpp index 3b023a1b089a..827933285818 100644 --- a/js/src/jsopcode.cpp +++ b/js/src/jsopcode.cpp @@ -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); diff --git a/js/src/jsopcode.h b/js/src/jsopcode.h index e35c3be23d00..8def46aad5e2 100644 --- a/js/src/jsopcode.h +++ b/js/src/jsopcode.h @@ -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++; diff --git a/js/src/jsscript.cpp b/js/src/jsscript.cpp index 662e0e9d9cff..de8efd139f85 100644 --- a/js/src/jsscript.cpp +++ b/js/src/jsscript.cpp @@ -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++; diff --git a/js/src/shell/js.cpp b/js/src/shell/js.cpp index c11e0d58d39b..d69d04b22052 100644 --- a/js/src/shell/js.cpp +++ b/js/src/shell/js.cpp @@ -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: diff --git a/js/src/vm/Debugger.cpp b/js/src/vm/Debugger.cpp index c03d6b3b4965..89af2a6dbf0e 100644 --- a/js/src/vm/Debugger.cpp +++ b/js/src/vm/Debugger.cpp @@ -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++; diff --git a/js/src/vm/GlobalObject.cpp b/js/src/vm/GlobalObject.cpp index 6ea693c58bbb..58e22b4734b2 100644 --- a/js/src/vm/GlobalObject.cpp +++ b/js/src/vm/GlobalObject.cpp @@ -59,7 +59,7 @@ JS_FOR_EACH_PROTOTYPE(DECLARE_PROTOTYPE_CLASS_INIT) JSObject * js::InitViaClassSpec(JSContext *cx, Handle 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 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; diff --git a/js/src/vm/NativeObject.cpp b/js/src/vm/NativeObject.cpp index 2799603690c7..2c6941bab288 100644 --- a/js/src/vm/NativeObject.cpp +++ b/js/src/vm/NativeObject.cpp @@ -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.