diff --git a/js/src/jsinterp.cpp b/js/src/jsinterp.cpp index e8c632feced3..83f0ec82c432 100644 --- a/js/src/jsinterp.cpp +++ b/js/src/jsinterp.cpp @@ -913,17 +913,16 @@ inline InterpreterFrames::~InterpreterFrames() #if defined(DEBUG) && !defined(JS_THREADSAFE) && !defined(JSGC_ROOT_ANALYSIS) void -js::AssertValidPropertyCacheHit(JSContext *cx, - JSObject *start_, JSObject *found, - PropertyCacheEntry *entry) +js::AssertValidPropertyCacheHit(JSContext *cx, JSObject *start_, + JSObject *found, PropertyCacheEntry *entry) { jsbytecode *pc; - cx->stack.currentScript(&pc); + JSScript *script = cx->stack.currentScript(&pc); uint64_t sample = cx->runtime->gcNumber; PropertyCacheEntry savedEntry = *entry; - RootedPropertyName name(cx, GetNameFromBytecode(cx, pc, JSOp(*pc))); + RootedPropertyName name(cx, GetNameFromBytecode(cx, script, pc, JSOp(*pc))); RootedObject start(cx, start_); JSObject *obj, *pobj; @@ -2330,7 +2329,7 @@ BEGIN_CASE(JSOP_LENGTH) BEGIN_CASE(JSOP_CALLPROP) { RootedValue rval(cx); - if (!GetPropertyOperation(cx, regs.pc, regs.sp[-1], rval.address())) + if (!GetPropertyOperation(cx, script, regs.pc, regs.sp[-1], rval.address())) goto error; TypeScript::Monitor(cx, script, regs.pc, rval.reference()); @@ -2542,7 +2541,7 @@ BEGIN_CASE(JSOP_CALLNAME) { RootedValue &rval = rootValue0; - if (!NameOperation(cx, regs.pc, rval.address())) + if (!NameOperation(cx, script, regs.pc, rval.address())) goto error; PUSH_COPY(rval); diff --git a/js/src/jsinterpinlines.h b/js/src/jsinterpinlines.h index 7fb6d3273f60..bdedbefe9ee9 100644 --- a/js/src/jsinterpinlines.h +++ b/js/src/jsinterpinlines.h @@ -166,7 +166,8 @@ GetPropertyGenericMaybeCallXML(JSContext *cx, JSOp op, HandleObject obj, HandleI } inline bool -GetPropertyOperation(JSContext *cx, jsbytecode *pc, const Value &lval, Value *vp) +GetPropertyOperation(JSContext *cx, JSScript *script, jsbytecode *pc, + const Value &lval, Value *vp) { JS_ASSERT(vp != &lval); @@ -320,7 +321,7 @@ SetPropertyOperation(JSContext *cx, jsbytecode *pc, const Value &lval, const Val } inline bool -NameOperation(JSContext *cx, jsbytecode *pc, Value *vp) +NameOperation(JSContext *cx, JSScript *script, jsbytecode *pc, Value *vp) { RootedObject obj(cx, cx->stack.currentScriptedScopeChain()); diff --git a/js/src/jsopcodeinlines.h b/js/src/jsopcodeinlines.h index ac538851b659..94f8c6b69d44 100644 --- a/js/src/jsopcodeinlines.h +++ b/js/src/jsopcodeinlines.h @@ -11,7 +11,7 @@ namespace js { static inline PropertyName * -GetNameFromBytecode(JSContext *cx, jsbytecode *pc, JSOp op) +GetNameFromBytecode(JSContext *cx, JSScript *script, jsbytecode *pc, JSOp op) { if (op == JSOP_LENGTH) return cx->runtime->atomState.lengthAtom; @@ -21,7 +21,6 @@ GetNameFromBytecode(JSContext *cx, jsbytecode *pc, JSOp op) if (op == JSOP_INSTANCEOF) return cx->runtime->atomState.classPrototypeAtom; - JSScript *script = cx->stack.currentScriptWithDiagnostics(); PropertyName *name; GET_NAME_FROM_BYTECODE(script, pc, 0, name); return name; diff --git a/js/src/jspropertycache.cpp b/js/src/jspropertycache.cpp index efda52643a14..c24619b0d53b 100644 --- a/js/src/jspropertycache.cpp +++ b/js/src/jspropertycache.cpp @@ -122,9 +122,7 @@ PropertyCache::fullTest(JSContext *cx, jsbytecode *pc, JSObject **objp, JSObject PropertyCacheEntry *entry) { JSObject *obj, *pobj, *tmp; -#ifdef DEBUG JSScript *script = cx->stack.currentScript(); -#endif JS_ASSERT(this == &JS_PROPERTY_CACHE(cx)); JS_ASSERT(uint32_t(pc - script->code) < script->length); @@ -137,7 +135,7 @@ PropertyCache::fullTest(JSContext *cx, jsbytecode *pc, JSObject **objp, JSObject if (entry->kpc != pc) { PCMETER(kpcmisses++); - PropertyName *name = GetNameFromBytecode(cx, pc, op); + PropertyName *name = GetNameFromBytecode(cx, script, pc, op); #ifdef DEBUG_notme JSAutoByteString printable; fprintf(stderr, @@ -160,7 +158,7 @@ PropertyCache::fullTest(JSContext *cx, jsbytecode *pc, JSObject **objp, JSObject if (entry->kshape != obj->lastProperty()) { PCMETER(kshapemisses++); - return GetNameFromBytecode(cx, pc, op); + return GetNameFromBytecode(cx, script, pc, op); } /* @@ -193,7 +191,7 @@ PropertyCache::fullTest(JSContext *cx, jsbytecode *pc, JSObject **objp, JSObject if (pobj->lastProperty() == entry->pshape) { #ifdef DEBUG - PropertyName *name = GetNameFromBytecode(cx, pc, op); + PropertyName *name = GetNameFromBytecode(cx, script, pc, op); JS_ASSERT(pobj->nativeContains(cx, NameToId(name))); #endif *pobjp = pobj; @@ -201,7 +199,7 @@ PropertyCache::fullTest(JSContext *cx, jsbytecode *pc, JSObject **objp, JSObject } PCMETER(vcapmisses++); - return GetNameFromBytecode(cx, pc, op); + return GetNameFromBytecode(cx, script, pc, op); } #ifdef DEBUG diff --git a/js/src/methodjit/PolyIC.cpp b/js/src/methodjit/PolyIC.cpp index dee77fbf3d38..d45c39d9dd13 100644 --- a/js/src/methodjit/PolyIC.cpp +++ b/js/src/methodjit/PolyIC.cpp @@ -1924,7 +1924,7 @@ ic::GetProp(VMFrame &f, ic::PICInfo *pic) Value v; if (cached) { - if (!GetPropertyOperation(f.cx, f.pc(), f.regs.sp[-1], &v)) + if (!GetPropertyOperation(f.cx, f.script(), f.pc(), f.regs.sp[-1], &v)) THROW(); } else { if (!obj->getProperty(f.cx, name, &v)) diff --git a/js/src/methodjit/StubCalls.cpp b/js/src/methodjit/StubCalls.cpp index c5445340fa44..cedd81694df7 100644 --- a/js/src/methodjit/StubCalls.cpp +++ b/js/src/methodjit/StubCalls.cpp @@ -98,7 +98,7 @@ void JS_FASTCALL stubs::Name(VMFrame &f) { Value rval; - if (!NameOperation(f.cx, f.pc(), &rval)) + if (!NameOperation(f.cx, f.script(), f.pc(), &rval)) THROW(); f.regs.sp[0] = rval; } @@ -980,7 +980,7 @@ stubs::GetProp(VMFrame &f, PropertyName *name) FrameRegs ®s = f.regs; Value rval; - if (!GetPropertyOperation(cx, f.pc(), f.regs.sp[-1], &rval)) + if (!GetPropertyOperation(cx, f.script(), f.pc(), f.regs.sp[-1], &rval)) THROW(); regs.sp[-1] = rval; diff --git a/js/src/vm/Stack-inl.h b/js/src/vm/Stack-inl.h index 9f21a3a3c1cc..4ad61c13c289 100644 --- a/js/src/vm/Stack-inl.h +++ b/js/src/vm/Stack-inl.h @@ -557,45 +557,6 @@ ContextStack::currentScript(jsbytecode **ppc) const return script; } -inline JSScript * -ContextStack::currentScriptWithDiagnostics(jsbytecode **ppc) const -{ - if (ppc) - *ppc = NULL; - - FrameRegs *regs = maybeRegs(); - StackFrame *fp = regs ? regs->fp() : NULL; - while (fp && fp->isDummyFrame()) - fp = fp->prev(); - if (!fp) - *(int *) 0x10 = 0; - -#ifdef JS_METHODJIT - mjit::CallSite *inlined = regs->inlined(); - if (inlined) { - mjit::JITChunk *chunk = fp->jit()->chunk(regs->pc); - JS_ASSERT(inlined->inlineIndex < chunk->nInlineFrames); - mjit::InlineFrame *frame = &chunk->inlineFrames()[inlined->inlineIndex]; - JSScript *script = frame->fun->script(); - if (script->compartment() != cx_->compartment) - *(int *) 0x20 = 0; - if (ppc) - *ppc = script->code + inlined->pcOffset; - return script; - } -#endif - - JSScript *script = fp->script(); - if (script->compartment() != cx_->compartment) - *(int *) 0x30 = 0; - - if (ppc) - *ppc = fp->pcQuadratic(*this); - if (!script) - *(int *) 0x40 = 0; - return script; -} - inline HandleObject ContextStack::currentScriptedScopeChain() const { diff --git a/js/src/vm/Stack.h b/js/src/vm/Stack.h index f054ea917f28..5668aad3eeb0 100644 --- a/js/src/vm/Stack.h +++ b/js/src/vm/Stack.h @@ -1660,7 +1660,6 @@ class ContextStack /* Get the topmost script and optional pc on the stack. */ inline JSScript *currentScript(jsbytecode **pc = NULL) const; - inline JSScript *currentScriptWithDiagnostics(jsbytecode **pc = NULL) const; /* Get the scope chain for the topmost scripted call on the stack. */ inline HandleObject currentScriptedScopeChain() const;