mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 00:05:36 +00:00
Bug 746036: stop querying for the current script in GetNameFromBytecode, r=bhackett
This commit is contained in:
parent
3511c2190f
commit
c5c17d3f4a
@ -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);
|
||||
|
@ -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());
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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))
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user