From 417145971337b57a43cce07c2b1f6e545ba29eb0 Mon Sep 17 00:00:00 2001 From: Jason Orendorff Date: Thu, 8 Dec 2011 16:17:55 -0600 Subject: [PATCH] Remove all mentions of imacros from js/src. Bug 708836, r=sfink. --- js/src/jscntxt.cpp | 2 +- js/src/jsexn.cpp | 4 ++-- js/src/jsinterp.cpp | 5 ----- js/src/jsopcode.cpp | 6 ++---- js/src/jsopcode.h | 2 +- js/src/jsscript.cpp | 10 ++-------- js/src/jsscript.h | 25 ------------------------- js/src/jsxml.cpp | 2 +- js/src/methodjit/StubCalls.cpp | 5 ----- 9 files changed, 9 insertions(+), 52 deletions(-) diff --git a/js/src/jscntxt.cpp b/js/src/jscntxt.cpp index 6fe8d5d7fbc5..303526b2dd20 100644 --- a/js/src/jscntxt.cpp +++ b/js/src/jscntxt.cpp @@ -755,7 +755,7 @@ PopulateReportBlame(JSContext *cx, JSErrorReport *report) for (FrameRegsIter iter(cx); !iter.done(); ++iter) { if (iter.fp()->isScriptFrame()) { report->filename = iter.fp()->script()->filename; - report->lineno = js_FramePCToLineNumber(cx, iter.fp(), iter.pc()); + report->lineno = js_PCToLineNumber(cx, iter.fp()->script(), iter.pc()); break; } } diff --git a/js/src/jsexn.cpp b/js/src/jsexn.cpp index ba4edfe7f099..3569dde53e6c 100644 --- a/js/src/jsexn.cpp +++ b/js/src/jsexn.cpp @@ -340,7 +340,7 @@ InitExnPrivate(JSContext *cx, JSObject *exnObject, JSString *message, } if (fp->isScriptFrame()) { frame.filename = fp->script()->filename; - frame.ulineno = js_FramePCToLineNumber(cx, fp, i.pc()); + frame.ulineno = js_PCToLineNumber(cx, fp->script(), i.pc()); } else { frame.ulineno = 0; frame.filename = NULL; @@ -765,7 +765,7 @@ Exception(JSContext *cx, uintN argc, Value *vp) if (!ToUint32(cx, args[2], &lineno)) return false; } else { - lineno = iter.done() ? 0 : js_FramePCToLineNumber(cx, iter.fp(), iter.pc()); + lineno = iter.done() ? 0 : js_PCToLineNumber(cx, iter.fp()->script(), iter.pc()); } intN exnType = args.callee().toFunction()->getExtendedSlot(0).toInt32(); diff --git a/js/src/jsinterp.cpp b/js/src/jsinterp.cpp index 13c1c7bc670f..6b5f8ca2d983 100644 --- a/js/src/jsinterp.cpp +++ b/js/src/jsinterp.cpp @@ -3083,11 +3083,6 @@ BEGIN_CASE(JSOP_LENGTH) } } - /* - * We do not impose the method read barrier if in an imacro, - * assuming any property gets it does (e.g., for 'toString' - * from JSOP_NEW) will not be leaked to the calling script. - */ JSObject *obj; VALUE_TO_OBJECT(cx, vp, obj); JSObject *aobj = js_GetProtoIfDenseArray(obj); diff --git a/js/src/jsopcode.cpp b/js/src/jsopcode.cpp index 5521faad4ff9..e2a74e4b09ce 100644 --- a/js/src/jsopcode.cpp +++ b/js/src/jsopcode.cpp @@ -580,8 +580,7 @@ js_Disassemble1(JSContext *cx, JSScript *script, jsbytecode *pc, if (op == JSOP_DOUBLE) { v = script->getConst(index); } else { - JSAtom *atom; - JS_GET_SCRIPT_ATOM(script, pc, index, atom); + JSAtom *atom = script->getAtom(index); v = STRING_TO_JSVAL(atom); } } else { @@ -674,8 +673,7 @@ js_Disassemble1(JSContext *cx, JSScript *script, jsbytecode *pc, uintN index = js_GetIndexFromBytecode(cx, script, pc, SLOTNO_LEN); jsval v; if (type == JOF_SLOTATOM) { - JSAtom *atom; - JS_GET_SCRIPT_ATOM(script, pc, index, atom); + JSAtom *atom = script->getAtom(index); v = STRING_TO_JSVAL(atom); } else { v = OBJECT_TO_JSVAL(script->getObject(index)); diff --git a/js/src/jsopcode.h b/js/src/jsopcode.h index 4cf8db6fddc8..239f63b81739 100644 --- a/js/src/jsopcode.h +++ b/js/src/jsopcode.h @@ -342,7 +342,7 @@ js_GetIndexFromBytecode(JSContext *cx, JSScript *script, jsbytecode *pc, JS_BEGIN_MACRO \ JS_ASSERT(*(pc) != JSOP_DOUBLE); \ uintN index_ = js_GetIndexFromBytecode(cx, (script), (pc), (pcoff)); \ - JS_GET_SCRIPT_ATOM(script, pc, index_, atom); \ + (atom) = (script)->getAtom(index_); \ JS_END_MACRO #define GET_DOUBLE_FROM_BYTECODE(script, pc, pcoff, dbl) \ diff --git a/js/src/jsscript.cpp b/js/src/jsscript.cpp index 02f6f2b5f822..33d98a259946 100644 --- a/js/src/jsscript.cpp +++ b/js/src/jsscript.cpp @@ -1442,12 +1442,6 @@ js_GetSrcNoteCached(JSContext *cx, JSScript *script, jsbytecode *pc) return result; } -uintN -js_FramePCToLineNumber(JSContext *cx, StackFrame *fp, jsbytecode *pc) -{ - return js_PCToLineNumber(cx, fp->script(), pc); -} - uintN js_PCToLineNumber(JSContext *cx, JSScript *script, jsbytecode *pc) { @@ -1564,7 +1558,7 @@ namespace js { uintN CurrentLine(JSContext *cx) { - return js_FramePCToLineNumber(cx, cx->fp(), cx->regs().pc); + return js_PCToLineNumber(cx, cx->fp()->script(), cx->regs().pc); } const char * @@ -1579,7 +1573,7 @@ CurrentScriptFileAndLineSlow(JSContext *cx, uintN *linenop) return NULL; } - *linenop = js_FramePCToLineNumber(cx, iter.fp(), iter.pc()); + *linenop = js_PCToLineNumber(cx, iter.fp()->script(), iter.pc()); return iter.fp()->script()->filename; } diff --git a/js/src/jsscript.h b/js/src/jsscript.h index e80d206616e6..3cfb56ba2a6e 100644 --- a/js/src/jsscript.h +++ b/js/src/jsscript.h @@ -821,23 +821,6 @@ StackDepth(JSScript *script) return script->nslots - script->nfixed; } -/* - * If pc_ does not point within script_'s bytecode, then it must point into an - * imacro body, so we use cx->runtime common atoms instead of script_'s atoms. - * This macro uses cx from its callers' environments in the pc-in-imacro case. - */ -#define JS_GET_SCRIPT_ATOM(script_, pc_, index, atom) \ - JS_BEGIN_MACRO \ - if ((pc_) < (script_)->code || \ - (script_)->code + (script_)->length <= (pc_)) { \ - JS_ASSERT((size_t)(index) < js_common_atom_count); \ - (atom) = cx->runtime->atomState.commonAtomsStart()[index]; \ - } else { \ - (atom) = script_->getAtom(index); \ - } \ - JS_END_MACRO - - extern void js_MarkScriptFilename(const char *filename); @@ -884,14 +867,6 @@ CheckScript(JSScript *script, JSScript *prev) extern jssrcnote * js_GetSrcNoteCached(JSContext *cx, JSScript *script, jsbytecode *pc); -/* - * NOTE: use js_FramePCToLineNumber(cx, fp) when you have an active fp, in - * preference to js_PCToLineNumber (cx, fp->script fp->regs->pc), because - * fp->imacpc may be non-null, indicating an active imacro. - */ -extern uintN -js_FramePCToLineNumber(JSContext *cx, js::StackFrame *fp, jsbytecode *pc); - extern uintN js_PCToLineNumber(JSContext *cx, JSScript *script, jsbytecode *pc); diff --git a/js/src/jsxml.cpp b/js/src/jsxml.cpp index 2807c1cf1de9..21d1c64cbdd5 100644 --- a/js/src/jsxml.cpp +++ b/js/src/jsxml.cpp @@ -1797,7 +1797,7 @@ ParseXMLSource(JSContext *cx, JSString *src) op = (JSOp) *i.pc(); if (op == JSOP_TOXML || op == JSOP_TOXMLLIST) { filename = i.fp()->script()->filename; - lineno = js_FramePCToLineNumber(cx, i.fp(), i.pc()); + lineno = js_PCToLineNumber(cx, i.fp()->script(), i.pc()); for (endp = srcp + srclen; srcp < endp; srcp++) { if (*srcp == '\n') --lineno; diff --git a/js/src/methodjit/StubCalls.cpp b/js/src/methodjit/StubCalls.cpp index 5678745b177b..a4cb7ec0a32f 100644 --- a/js/src/methodjit/StubCalls.cpp +++ b/js/src/methodjit/StubCalls.cpp @@ -1478,11 +1478,6 @@ InlineGetProp(VMFrame &f) Value rval; do { - /* - * We do not impose the method read barrier if in an imacro, - * assuming any property gets it does (e.g., for 'toString' - * from JSOP_NEW) will not be leaked to the calling script. - */ JSObject *aobj = js_GetProtoIfDenseArray(obj); PropertyCacheEntry *entry;