From ef7de3688d14efca435778c1b74e04655ad82152 Mon Sep 17 00:00:00 2001 From: David Mandelin Date: Mon, 23 Aug 2010 14:13:53 -0700 Subject: [PATCH] [JAEGER] Merge from Tracemonkey. --HG-- extra : rebase_source : 3a8dcc0855999572e7d32ee1d6468e6729938d65 --- js/src/jsinterp.cpp | 2 +- js/src/jstracer.cpp | 26 +++--- js/src/methodjit/Compiler.cpp | 5 +- js/src/methodjit/InvokeHelpers.cpp | 91 ++++++++++--------- js/src/methodjit/MethodJIT.cpp | 10 +-- js/src/methodjit/MethodJIT.h | 5 +- js/src/methodjit/MonoIC.cpp | 14 +-- js/src/methodjit/PolyIC.cpp | 32 +++---- js/src/methodjit/StubCalls.cpp | 112 ++++++++++++------------ js/src/methodjit/TrampolineCompiler.cpp | 3 +- js/src/shell/js.cpp | 2 +- 11 files changed, 150 insertions(+), 152 deletions(-) diff --git a/js/src/jsinterp.cpp b/js/src/jsinterp.cpp index 60530f8940c..262353075a6 100644 --- a/js/src/jsinterp.cpp +++ b/js/src/jsinterp.cpp @@ -465,7 +465,7 @@ RunScript(JSContext *cx, JSScript *script, JSFunction *fun, JSObject *scopeChain return mjit::JaegerShot(cx); #endif - return Interpret(cx, cx->fp); + return Interpret(cx, cx->fp()); } static JS_REQUIRES_STACK bool diff --git a/js/src/jstracer.cpp b/js/src/jstracer.cpp index 1c1f95b5854..939a9ceecf0 100644 --- a/js/src/jstracer.cpp +++ b/js/src/jstracer.cpp @@ -14669,7 +14669,7 @@ TraceRecorder::record_JSOP_FORGLOBAL() LIns* v_ins; CHECK_STATUS_A(unboxNextValue(v_ins)); - uint32 slot = cx->fp->getScript()->getGlobalSlot(GET_SLOTNO(cx->regs->pc)); + uint32 slot = cx->fp()->getScript()->getGlobalSlot(GET_SLOTNO(cx->regs->pc)); if (!lazilyImportGlobalSlot(slot)) RETURN_STOP_A("lazy import of global slot failed"); @@ -16125,7 +16125,7 @@ TraceRecorder::record_JSOP_SHARPINIT() JS_REQUIRES_STACK AbortableRecordingStatus TraceRecorder::record_JSOP_GETGLOBAL() { - uint32 slot = cx->fp->getScript()->getGlobalSlot(GET_SLOTNO(cx->regs->pc)); + uint32 slot = cx->fp()->getScript()->getGlobalSlot(GET_SLOTNO(cx->regs->pc)); if (!lazilyImportGlobalSlot(slot)) RETURN_STOP_A("lazy import of global slot failed"); @@ -16136,7 +16136,7 @@ TraceRecorder::record_JSOP_GETGLOBAL() JS_REQUIRES_STACK AbortableRecordingStatus TraceRecorder::record_JSOP_SETGLOBAL() { - uint32 slot = cx->fp->getScript()->getGlobalSlot(GET_SLOTNO(cx->regs->pc)); + uint32 slot = cx->fp()->getScript()->getGlobalSlot(GET_SLOTNO(cx->regs->pc)); if (!lazilyImportGlobalSlot(slot)) RETURN_STOP_A("lazy import of global slot failed"); @@ -16147,7 +16147,7 @@ TraceRecorder::record_JSOP_SETGLOBAL() JS_REQUIRES_STACK AbortableRecordingStatus TraceRecorder::record_JSOP_CALLGLOBAL() { - uint32 slot = cx->fp->getScript()->getGlobalSlot(GET_SLOTNO(cx->regs->pc)); + uint32 slot = cx->fp()->getScript()->getGlobalSlot(GET_SLOTNO(cx->regs->pc)); if (!lazilyImportGlobalSlot(slot)) RETURN_STOP_A("lazy import of global slot failed"); @@ -16160,7 +16160,7 @@ TraceRecorder::record_JSOP_CALLGLOBAL() JS_REQUIRES_STACK AbortableRecordingStatus TraceRecorder::record_JSOP_GLOBALDEC() { - uint32 slot = cx->fp->getScript()->getGlobalSlot(GET_SLOTNO(cx->regs->pc)); + uint32 slot = cx->fp()->getScript()->getGlobalSlot(GET_SLOTNO(cx->regs->pc)); if (!lazilyImportGlobalSlot(slot)) RETURN_STOP_A("lazy import of global slot failed"); @@ -16170,7 +16170,7 @@ TraceRecorder::record_JSOP_GLOBALDEC() JS_REQUIRES_STACK AbortableRecordingStatus TraceRecorder::record_JSOP_DECGLOBAL() { - uint32 slot = cx->fp->getScript()->getGlobalSlot(GET_SLOTNO(cx->regs->pc)); + uint32 slot = cx->fp()->getScript()->getGlobalSlot(GET_SLOTNO(cx->regs->pc)); if (!lazilyImportGlobalSlot(slot)) RETURN_STOP_A("lazy import of global slot failed"); @@ -16180,7 +16180,7 @@ TraceRecorder::record_JSOP_DECGLOBAL() JS_REQUIRES_STACK AbortableRecordingStatus TraceRecorder::record_JSOP_INCGLOBAL() { - uint32 slot = cx->fp->getScript()->getGlobalSlot(GET_SLOTNO(cx->regs->pc)); + uint32 slot = cx->fp()->getScript()->getGlobalSlot(GET_SLOTNO(cx->regs->pc)); if (!lazilyImportGlobalSlot(slot)) RETURN_STOP_A("lazy import of global slot failed"); @@ -16190,7 +16190,7 @@ TraceRecorder::record_JSOP_INCGLOBAL() JS_REQUIRES_STACK AbortableRecordingStatus TraceRecorder::record_JSOP_GLOBALINC() { - uint32 slot = cx->fp->getScript()->getGlobalSlot(GET_SLOTNO(cx->regs->pc)); + uint32 slot = cx->fp()->getScript()->getGlobalSlot(GET_SLOTNO(cx->regs->pc)); if (!lazilyImportGlobalSlot(slot)) RETURN_STOP_A("lazy import of global slot failed"); @@ -16406,13 +16406,13 @@ class AutoRetBlacklist JS_REQUIRES_STACK TracePointAction MonitorTracePoint(JSContext* cx, uintN& inlineCallCount, bool& blacklist) { - JSStackFrame* fp = cx->fp; + JSStackFrame* fp = cx->fp(); TraceMonitor* tm = &JS_TRACE_MONITOR(cx); jsbytecode* pc = cx->regs->pc; JS_ASSERT(!TRACE_RECORDER(cx)); - JSObject* globalObj = cx->fp->getScopeChain()->getGlobal(); + JSObject* globalObj = cx->fp()->getScopeChain()->getGlobal(); uint32 globalShape = -1; SlotList* globalSlots = NULL; @@ -16423,13 +16423,13 @@ MonitorTracePoint(JSContext* cx, uintN& inlineCallCount, bool& blacklist) return TPA_Nothing; } - uint32 argc = cx->fp->argc; + uint32 argc = cx->fp()->argc; TreeFragment* tree = LookupOrAddLoop(tm, pc, globalObj, globalShape, argc); debug_only_printf(LC_TMTracer, "Looking for compat peer %d@%d, from %p (ip: %p)\n", - js_FramePCToLineNumber(cx, cx->fp), - FramePCOffset(cx, cx->fp), (void*)tree, tree->ip); + js_FramePCToLineNumber(cx, cx->fp()), + FramePCOffset(cx, cx->fp()), (void*)tree, tree->ip); if (tree->code() || tree->peer) { uintN count; diff --git a/js/src/methodjit/Compiler.cpp b/js/src/methodjit/Compiler.cpp index 64373082939..cbffc619d50 100644 --- a/js/src/methodjit/Compiler.cpp +++ b/js/src/methodjit/Compiler.cpp @@ -1631,8 +1631,7 @@ mjit::Compiler::emitReturn() */ masm.loadPtr(Address(JSFrameReg, offsetof(JSStackFrame, down)), Registers::ReturnReg); masm.loadPtr(FrameAddress(offsetof(VMFrame, cx)), Registers::ArgReg1); - masm.storePtr(Registers::ReturnReg, FrameAddress(offsetof(VMFrame, fp))); - masm.storePtr(Registers::ReturnReg, Address(Registers::ArgReg1, offsetof(JSContext, fp))); + masm.storePtr(Registers::ReturnReg, FrameAddress(offsetof(VMFrame, regs.fp))); JS_STATIC_ASSERT(Registers::ReturnReg != JSReturnReg_Data); JS_STATIC_ASSERT(Registers::ReturnReg != JSReturnReg_Type); @@ -1891,7 +1890,7 @@ mjit::Compiler::addCallSite(uint32 id, bool stub) void mjit::Compiler::restoreFrameRegs(Assembler &masm) { - masm.loadPtr(FrameAddress(offsetof(VMFrame, fp)), JSFrameReg); + masm.loadPtr(FrameAddress(offsetof(VMFrame, regs.fp)), JSFrameReg); } bool diff --git a/js/src/methodjit/InvokeHelpers.cpp b/js/src/methodjit/InvokeHelpers.cpp index 4b7c25b849c..737f7ff1304 100644 --- a/js/src/methodjit/InvokeHelpers.cpp +++ b/js/src/methodjit/InvokeHelpers.cpp @@ -91,7 +91,7 @@ InlineReturn(VMFrame &f, JSBool ok); static jsbytecode * FindExceptionHandler(JSContext *cx) { - JSStackFrame *fp = cx->fp; + JSStackFrame *fp = cx->fp(); JSScript *script = fp->getScript(); top: @@ -169,15 +169,15 @@ top: static inline void FixVMFrame(VMFrame &f, JSStackFrame *fp) { - JS_ASSERT(f.fp == fp->down); - f.fp = fp; + JS_ASSERT(f.fp() == fp->down); + f.fp() = fp; } static inline bool CreateFrame(VMFrame &f, uint32 flags, uint32 argc) { JSContext *cx = f.cx; - JSStackFrame *fp = f.fp; + JSStackFrame *fp = f.fp(); Value *vp = f.regs.sp - (argc + 2); JSObject *funobj = &vp->toObject(); JSFunction *fun = GET_FUNCTION_PRIVATE(cx, funobj); @@ -261,7 +261,7 @@ InlineCall(VMFrame &f, uint32 flags, void **pret, uint32 argc) return false; JSContext *cx = f.cx; - JSStackFrame *fp = cx->fp; + JSStackFrame *fp = cx->fp(); JSScript *script = fp->getScript(); f.regs.pc = script->code; f.regs.sp = fp->base(); @@ -280,7 +280,7 @@ InlineCall(VMFrame &f, uint32 flags, void **pret, uint32 argc) } } - bool ok = !!Interpret(cx, cx->fp); + bool ok = !!Interpret(cx, cx->fp()); InlineReturn(f, JS_TRUE); *pret = NULL; @@ -291,10 +291,10 @@ static bool InlineReturn(VMFrame &f, JSBool ok) { JSContext *cx = f.cx; - JSStackFrame *fp = cx->fp; + JSStackFrame *fp = cx->fp(); - JS_ASSERT(f.fp == cx->fp); - JS_ASSERT(f.fp != f.entryFp); + JS_ASSERT(f.fp() == cx->fp()); + JS_ASSERT(f.fp() != f.entryFp); JS_ASSERT(!fp->hasBlockChain()); JS_ASSERT(!js_IsActiveWithOrBlock(cx, fp->getScopeChain(), 0)); @@ -327,7 +327,7 @@ InlineReturn(VMFrame &f, JSBool ok) Value *newsp = fp->argv - 1; cx->stack().popInlineFrame(cx, fp, fp->down); - f.fp = cx->fp; + f.fp() = cx->fp(); cx->regs->sp = newsp; cx->regs->sp[-1] = fp->getReturnValue(); @@ -358,7 +358,7 @@ stubs::SlowCall(VMFrame &f, uint32 argc) JSContext *cx = f.cx; #ifdef JS_MONOIC - ic::MICInfo &mic = f.fp->getScript()->mics[argc]; + ic::MICInfo &mic = f.fp()->getScript()->mics[argc]; argc = mic.argc; #endif @@ -386,7 +386,7 @@ stubs::SlowCall(VMFrame &f, uint32 argc) if (fun->isFastNative()) { #ifdef JS_MONOIC #ifdef JS_CPU_X86 - ic::CallFastNative(cx, f.fp->getScript(), mic, fun, false); + ic::CallFastNative(cx, f.fp()->getScript(), mic, fun, false); #endif #endif @@ -409,7 +409,7 @@ stubs::SlowNew(VMFrame &f, uint32 argc) JSContext *cx = f.cx; #ifdef JS_MONOIC - ic::MICInfo &mic = f.fp->getScript()->mics[argc]; + ic::MICInfo &mic = f.fp()->getScript()->mics[argc]; argc = mic.argc; #endif @@ -441,7 +441,7 @@ stubs::SlowNew(VMFrame &f, uint32 argc) if (fun->isFastConstructor()) { #ifdef JS_MONOIC #ifdef JS_CPU_X86 - ic::CallFastNative(cx, f.fp->getScript(), mic, fun, true); + ic::CallFastNative(cx, f.fp()->getScript(), mic, fun, true); #endif #endif @@ -466,7 +466,7 @@ static inline bool CreateLightFrame(VMFrame &f, uint32 flags, uint32 argc) { JSContext *cx = f.cx; - JSStackFrame *fp = f.fp; + JSStackFrame *fp = f.fp(); Value *vp = f.regs.sp - (argc + 2); JSObject *funobj = &vp->toObject(); JSFunction *fun = GET_FUNCTION_PRIVATE(cx, funobj); @@ -525,7 +525,6 @@ CreateLightFrame(VMFrame &f, uint32 flags, uint32 argc) #endif newfp->down = fp; fp->savedPC = f.regs.pc; - cx->setCurrentFrame(newfp); FixVMFrame(f, newfp); return true; @@ -540,7 +539,7 @@ stubs::Call(VMFrame &f, uint32 argc) if (!CreateLightFrame(f, 0, argc)) THROWV(NULL); - return f.fp->getScript()->ncode; + return f.fp()->getScript()->ncode; } /* @@ -557,29 +556,29 @@ stubs::New(VMFrame &f, uint32 argc) if (!CreateLightFrame(f, JSFRAME_CONSTRUCTING, argc)) THROWV(NULL); - return f.fp->getScript()->ncode; + return f.fp()->getScript()->ncode; } void JS_FASTCALL stubs::PutCallObject(VMFrame &f) { - JS_ASSERT(f.fp->hasCallObj()); - js_PutCallObject(f.cx, f.fp); - JS_ASSERT(!f.fp->hasArgsObj()); + JS_ASSERT(f.fp()->hasCallObj()); + js_PutCallObject(f.cx, f.fp()); + JS_ASSERT(!f.fp()->hasArgsObj()); } void JS_FASTCALL stubs::PutArgsObject(VMFrame &f) { - js_PutArgsObject(f.cx, f.fp); + js_PutArgsObject(f.cx, f.fp()); } void JS_FASTCALL stubs::CopyThisv(VMFrame &f) { - JS_ASSERT(f.fp->flags & JSFRAME_CONSTRUCTING); - if (f.fp->getReturnValue().isPrimitive()) - f.fp->setReturnValue(f.fp->getThisValue()); + JS_ASSERT(f.fp()->flags & JSFRAME_CONSTRUCTING); + if (f.fp()->getReturnValue().isPrimitive()) + f.fp()->setReturnValue(f.fp()->getThisValue()); } extern "C" void * @@ -594,7 +593,7 @@ js_InternalThrow(VMFrame &f) JSThrowHook handler = f.cx->debugHooks->throwHook; if (handler) { Value rval; - switch (handler(cx, cx->fp->getScript(), cx->regs->pc, Jsvalify(&rval), + switch (handler(cx, cx->fp()->getScript(), cx->regs->pc, Jsvalify(&rval), cx->debugHooks->throwHookData)) { case JSTRAP_ERROR: cx->throwing = JS_FALSE; @@ -602,7 +601,7 @@ js_InternalThrow(VMFrame &f) case JSTRAP_RETURN: cx->throwing = JS_FALSE; - cx->fp->setReturnValue(rval); + cx->fp()->setReturnValue(rval); return JS_FUNC_TO_DATA_PTR(void *, JS_METHODJIT_DATA(cx).trampolines.forceReturn); @@ -625,7 +624,7 @@ js_InternalThrow(VMFrame &f) // called into through js_Interpret). In this case, we still unwind, // but we shouldn't return from a JS function, because we're not in a // JS function. - bool lastFrame = (f.entryFp == f.fp); + bool lastFrame = (f.entryFp == f.fp()); js_UnwindScope(cx, 0, cx->throwing); if (lastFrame) break; @@ -642,14 +641,14 @@ js_InternalThrow(VMFrame &f) return NULL; } - return cx->fp->getScript()->pcToNative(pc); + return cx->fp()->getScript()->pcToNative(pc); } void JS_FASTCALL stubs::GetCallObject(VMFrame &f) { - JS_ASSERT(f.fp->getFunction()->isHeavyweight()); - if (!js_GetCallObject(f.cx, f.fp)) + JS_ASSERT(f.fp()->getFunction()->isHeavyweight()); + if (!js_GetCallObject(f.cx, f.fp())) THROW(); } @@ -674,7 +673,7 @@ SwallowErrors(VMFrame &f, JSStackFrame *stopFp) /* Remove the bottom frame. */ bool ok = false; for (;;) { - JSStackFrame *fp = cx->fp; + JSStackFrame *fp = cx->fp(); /* Look for an imacro with hard-coded exception handlers. */ if (fp->hasIMacroPC() && cx->throwing) { @@ -705,14 +704,14 @@ SwallowErrors(VMFrame &f, JSStackFrame *stopFp) /* Update the VMFrame before leaving. */ JS_ASSERT(&f.regs == cx->regs); - JS_ASSERT_IF(!ok, cx->fp == stopFp); + JS_ASSERT_IF(!ok, cx->fp() == stopFp); return ok; } static inline bool AtSafePoint(JSContext *cx) { - JSStackFrame *fp = cx->fp; + JSStackFrame *fp = cx->fp(); if (fp->hasIMacroPC()) return false; @@ -728,7 +727,7 @@ static inline JSBool PartialInterpret(VMFrame &f) { JSContext *cx = f.cx; - JSStackFrame *fp = cx->fp; + JSStackFrame *fp = cx->fp(); JS_ASSERT(fp->hasIMacroPC() || !fp->getScript()->nmap || !fp->getScript()->nmap[cx->regs->pc - fp->getScript()->code]); @@ -738,7 +737,7 @@ PartialInterpret(VMFrame &f) ok = Interpret(cx, fp); fp->flags &= ~JSFRAME_BAILING; - f.fp = cx->fp; + f.fp() = cx->fp(); return ok; } @@ -760,8 +759,8 @@ static bool RemoveExcessFrames(VMFrame &f, JSStackFrame *entryFrame) { JSContext *cx = f.cx; - while (cx->fp != entryFrame) { - JSStackFrame *fp = cx->fp; + while (cx->fp() != entryFrame) { + JSStackFrame *fp = cx->fp(); fp->flags &= ~JSFRAME_RECORDING; if (AtSafePoint(cx)) { @@ -784,9 +783,9 @@ RemoveExcessFrames(VMFrame &f, JSStackFrame *entryFrame) * Partial interpret could have dropped us anywhere. Deduce the * edge case: at a RETURN, needing to pop a frame. */ - if (!cx->fp->hasIMacroPC() && FrameIsFinished(cx)) { + if (!cx->fp()->hasIMacroPC() && FrameIsFinished(cx)) { JSOp op = JSOp(*cx->regs->pc); - if (op == JSOP_RETURN && !(cx->fp->flags & JSFRAME_BAILED_AT_RETURN)) + if (op == JSOP_RETURN && !(cx->fp()->flags & JSFRAME_BAILED_AT_RETURN)) fp->setReturnValue(f.regs.sp[-1]); InlineReturn(f, JS_TRUE); AdvanceReturnPC(cx); @@ -837,7 +836,7 @@ RunTracer(VMFrame &f) #endif { JSContext *cx = f.cx; - JSStackFrame *entryFrame = f.fp; + JSStackFrame *entryFrame = f.fp(); TracePointAction tpa; /* :TODO: nuke PIC? */ @@ -857,8 +856,8 @@ RunTracer(VMFrame &f) if ((tpa == TPA_RanStuff || tpa == TPA_Recorded) && cx->throwing) tpa = TPA_Error; - /* Sync up the VMFrame's view of cx->fp. */ - f.fp = cx->fp; + /* Sync up the VMFrame's view of cx->fp(). */ + f.fp() = cx->fp(); switch (tpa) { case TPA_Nothing: @@ -867,7 +866,7 @@ RunTracer(VMFrame &f) case TPA_Error: if (!SwallowErrors(f, entryFrame)) THROWV(NULL); - JS_ASSERT(!cx->fp->hasIMacroPC()); + JS_ASSERT(!cx->fp()->hasIMacroPC()); break; case TPA_RanStuff: @@ -928,7 +927,7 @@ RunTracer(VMFrame &f) entryFrame->setReturnValue(f.regs.sp[-1]); /* Don't pop the frame if it's maybe owned by an Invoke. */ - if (f.fp != f.entryFp) { + if (f.fp() != f.entryFp) { if (!InlineReturn(f, JS_TRUE)) THROWV(NULL); } @@ -953,7 +952,7 @@ RunTracer(VMFrame &f) void *JS_FASTCALL stubs::InvokeTracer(VMFrame &f, uint32 index) { - JSScript *script = f.fp->getScript(); + JSScript *script = f.fp()->getScript(); ic::MICInfo &mic = script->mics[index]; JS_ASSERT(mic.kind == ic::MICInfo::TRACER); diff --git a/js/src/methodjit/MethodJIT.cpp b/js/src/methodjit/MethodJIT.cpp index 2010099d696..d5206b28618 100644 --- a/js/src/methodjit/MethodJIT.cpp +++ b/js/src/methodjit/MethodJIT.cpp @@ -568,7 +568,7 @@ SYMBOL_STRING(JaegerStubVeneer) ":" "\n" * *** DANGER *** */ JS_STATIC_ASSERT(offsetof(VMFrame, savedEBX) == 0x2c); -JS_STATIC_ASSERT(offsetof(VMFrame, fp) == 0x1C); +JS_STATIC_ASSERT(offsetof(VMFrame, regs.fp) == 0x1C); extern "C" { @@ -756,7 +756,7 @@ EnterMethodJIT(JSContext *cx, JSStackFrame *fp, void *code, void *safePoint) JSAutoResolveFlags rf(cx, JSRESOLVE_INFER); JSBool ok = JaegerTrampoline(cx, fp, code, stackLimit, safePoint); - JS_ASSERT(checkFp == cx->fp); + JS_ASSERT(checkFp == cx->fp()); #ifdef JS_METHODJIT_SPEW prof.stop(); @@ -769,7 +769,7 @@ EnterMethodJIT(JSContext *cx, JSStackFrame *fp, void *code, void *safePoint) JSBool mjit::JaegerShot(JSContext *cx) { - JSScript *script = cx->fp->getScript(); + JSScript *script = cx->fp()->getScript(); JS_ASSERT(script->ncode && script->ncode != JS_UNJITTABLE_METHOD); @@ -782,7 +782,7 @@ mjit::JaegerShot(JSContext *cx) void *code = script->nmap[-1]; - return EnterMethodJIT(cx, cx->fp, code, NULL); + return EnterMethodJIT(cx, cx->fp(), code, NULL); } JSBool @@ -794,7 +794,7 @@ js::mjit::JaegerShotAtSafePoint(JSContext *cx, void *safePoint) void *code = JS_FUNC_TO_DATA_PTR(void *, SafePointTrampoline); - return EnterMethodJIT(cx, cx->fp, code, safePoint); + return EnterMethodJIT(cx, cx->fp(), code, safePoint); } template diff --git a/js/src/methodjit/MethodJIT.h b/js/src/methodjit/MethodJIT.h index 7d865601f40..0e6fcc17578 100644 --- a/js/src/methodjit/MethodJIT.h +++ b/js/src/methodjit/MethodJIT.h @@ -68,7 +68,6 @@ struct VMFrame VMFrame *previous; JSFrameRegs *oldRegs; JSFrameRegs regs; - JSStackFrame *fp; JSContext *cx; Value *stackLimit; JSStackFrame *entryFp; @@ -132,9 +131,11 @@ struct VMFrame JSRuntime *runtime() { return cx->runtime; } + JSStackFrame *&fp() { return regs.fp; } + bool slowEnsureSpace(uint32 nslots); - inline bool ensureSpace(uint32 nmissing, uint32 nslots) { + bool ensureSpace(uint32 nmissing, uint32 nslots) { /* Fast check - if it's below the limit, it's safe to just get a frame. */ if (JS_LIKELY(regs.sp + VALUES_PER_STACK_FRAME + nmissing + nslots < stackLimit)) return true; diff --git a/js/src/methodjit/MonoIC.cpp b/js/src/methodjit/MonoIC.cpp index 109603a53a9..04f8333fd39 100644 --- a/js/src/methodjit/MonoIC.cpp +++ b/js/src/methodjit/MonoIC.cpp @@ -66,9 +66,9 @@ PatchGetFallback(VMFrame &f, ic::MICInfo &mic) void JS_FASTCALL ic::GetGlobalName(VMFrame &f, uint32 index) { - JSObject *obj = f.fp->getScopeChain()->getGlobal(); - ic::MICInfo &mic = f.fp->getScript()->mics[index]; - JSAtom *atom = f.fp->getScript()->getAtom(GET_INDEX(f.regs.pc)); + JSObject *obj = f.fp()->getScopeChain()->getGlobal(); + ic::MICInfo &mic = f.fp()->getScript()->mics[index]; + JSAtom *atom = f.fp()->getScript()->getAtom(GET_INDEX(f.regs.pc)); jsid id = ATOM_TO_JSID(atom); JS_ASSERT(mic.kind == ic::MICInfo::GET); @@ -119,7 +119,7 @@ ic::GetGlobalName(VMFrame &f, uint32 index) static void JS_FASTCALL SetGlobalNameSlow(VMFrame &f, uint32 index) { - JSAtom *atom = f.fp->getScript()->getAtom(GET_INDEX(f.regs.pc)); + JSAtom *atom = f.fp()->getScript()->getAtom(GET_INDEX(f.regs.pc)); stubs::SetGlobalName(f, atom); } @@ -134,9 +134,9 @@ PatchSetFallback(VMFrame &f, ic::MICInfo &mic) void JS_FASTCALL ic::SetGlobalName(VMFrame &f, uint32 index) { - JSObject *obj = f.fp->getScopeChain()->getGlobal(); - ic::MICInfo &mic = f.fp->getScript()->mics[index]; - JSAtom *atom = f.fp->getScript()->getAtom(GET_INDEX(f.regs.pc)); + JSObject *obj = f.fp()->getScopeChain()->getGlobal(); + ic::MICInfo &mic = f.fp()->getScript()->mics[index]; + JSAtom *atom = f.fp()->getScript()->getAtom(GET_INDEX(f.regs.pc)); jsid id = ATOM_TO_JSID(atom); JS_ASSERT(mic.kind == ic::MICInfo::SET); diff --git a/js/src/methodjit/PolyIC.cpp b/js/src/methodjit/PolyIC.cpp index 5aeb8950045..af82ca490fd 100644 --- a/js/src/methodjit/PolyIC.cpp +++ b/js/src/methodjit/PolyIC.cpp @@ -137,7 +137,7 @@ class PICStubCompiler { JaegerSpew(JSpew_PICs, "%s %s: %s (%s: %d)\n", type, event, op, script->filename, - js_FramePCToLineNumber(f.cx, f.fp)); + js_FramePCToLineNumber(f.cx, f.fp())); } }; @@ -682,7 +682,7 @@ class GetPropCompiler : public PICStubCompiler JS_ASSERT(pic.hasTypeCheck()); JS_ASSERT(pic.kind == ic::PICInfo::CALL); - if (!f.fp->getScript()->compileAndGo) + if (!f.fp()->getScript()->compileAndGo) return disable("String.prototype without compile-and-go"); JSObject *holder; @@ -717,7 +717,7 @@ class GetPropCompiler : public PICStubCompiler * correctly in ic::CallProp. Should we just move the store higher * up in the fast path, or put this offset in PICInfo? */ - uint32 thisvOffset = uint32(f.regs.sp - f.fp->slots()) - 1; + uint32 thisvOffset = uint32(f.regs.sp - f.fp()->slots()) - 1; Address thisv(JSFrameReg, sizeof(JSStackFrame) + thisvOffset * sizeof(Value)); masm.storeTypeTag(ImmType(JSVAL_TYPE_STRING), thisv); masm.storePayload(pic.objReg, thisv); @@ -1317,7 +1317,7 @@ class GetElemCompiler : public PICStubCompiler char *chars = js_DeflateString(f.cx, id->chars(), id->length()); JaegerSpew(JSpew_PICs, "generated %s stub at %p for atom 0x%x (\"%s\") shape 0x%x (%s: %d)\n", type, cs.executableAddress(), id, chars, holder->shape(), script->filename, - js_FramePCToLineNumber(f.cx, f.fp)); + js_FramePCToLineNumber(f.cx, f.fp())); f.cx->free(chars); #endif @@ -1814,7 +1814,7 @@ class BindNameCompiler : public PICStubCompiler void JS_FASTCALL ic::GetProp(VMFrame &f, uint32 index) { - JSScript *script = f.fp->getScript(); + JSScript *script = f.fp()->getScript(); PICInfo &pic = script->pics[index]; JSAtom *atom = pic.atom; @@ -1872,7 +1872,7 @@ ic::GetProp(VMFrame &f, uint32 index) void JS_FASTCALL ic::GetElem(VMFrame &f, uint32 picIndex) { - JSScript *script = f.fp->getScript(); + JSScript *script = f.fp()->getScript(); PICInfo &pic = script->pics[picIndex]; JSObject *obj = ValueToObject(f.cx, &f.regs.sp[-2]); @@ -1902,7 +1902,7 @@ ic::GetElem(VMFrame &f, uint32 picIndex) static void JS_FASTCALL SetPropDumb(VMFrame &f, uint32 index) { - JSScript *script = f.fp->getScript(); + JSScript *script = f.fp()->getScript(); ic::PICInfo &pic = script->pics[index]; JS_ASSERT(pic.kind == ic::PICInfo::SET); JSAtom *atom = pic.atom; @@ -1919,7 +1919,7 @@ SetPropDumb(VMFrame &f, uint32 index) static void JS_FASTCALL SetPropSlow(VMFrame &f, uint32 index) { - JSScript *script = f.fp->getScript(); + JSScript *script = f.fp()->getScript(); ic::PICInfo &pic = script->pics[index]; JS_ASSERT(pic.kind == ic::PICInfo::SET); @@ -1934,7 +1934,7 @@ ic::SetProp(VMFrame &f, uint32 index) if (!obj) THROW(); - JSScript *script = f.fp->getScript(); + JSScript *script = f.fp()->getScript(); ic::PICInfo &pic = script->pics[index]; JSAtom *atom = pic.atom; JS_ASSERT(pic.kind == ic::PICInfo::SET); @@ -1978,7 +1978,7 @@ ic::SetProp(VMFrame &f, uint32 index) static void JS_FASTCALL CallPropSlow(VMFrame &f, uint32 index) { - JSScript *script = f.fp->getScript(); + JSScript *script = f.fp()->getScript(); ic::PICInfo &pic = script->pics[index]; stubs::CallProp(f, pic.atom); } @@ -1989,7 +1989,7 @@ ic::CallProp(VMFrame &f, uint32 index) JSContext *cx = f.cx; JSFrameRegs ®s = f.regs; - JSScript *script = f.fp->getScript(); + JSScript *script = f.fp()->getScript(); ic::PICInfo &pic = script->pics[index]; JSAtom *origAtom = pic.atom; @@ -2126,11 +2126,11 @@ SlowName(VMFrame &f, uint32 index) void JS_FASTCALL ic::Name(VMFrame &f, uint32 index) { - JSScript *script = f.fp->getScript(); + JSScript *script = f.fp()->getScript(); ic::PICInfo &pic = script->pics[index]; JSAtom *atom = pic.atom; - ScopeNameCompiler cc(f, script, f.fp->getScopeChain(), pic, atom, SlowName); + ScopeNameCompiler cc(f, script, f.fp()->getScopeChain(), pic, atom, SlowName); if (!cc.update()) { cc.disable("error"); @@ -2146,7 +2146,7 @@ ic::Name(VMFrame &f, uint32 index) if (!cc.prop) { /* Kludge to allow (typeof foo == "undefined") tests. */ cc.disable("property not found"); - JSOp op2 = js_GetOpcode(f.cx, f.fp->getScript(), f.regs.pc + JSOP_NAME_LENGTH); + JSOp op2 = js_GetOpcode(f.cx, f.fp()->getScript(), f.regs.pc + JSOP_NAME_LENGTH); if (op2 == JSOP_TYPEOF) { f.regs.sp[0].setUndefined(); return; @@ -2175,11 +2175,11 @@ SlowBindName(VMFrame &f, uint32 index) void JS_FASTCALL ic::BindName(VMFrame &f, uint32 index) { - JSScript *script = f.fp->getScript(); + JSScript *script = f.fp()->getScript(); ic::PICInfo &pic = script->pics[index]; JSAtom *atom = pic.atom; - BindNameCompiler cc(f, script, f.fp->getScopeChain(), pic, atom, SlowBindName); + BindNameCompiler cc(f, script, f.fp()->getScopeChain(), pic, atom, SlowBindName); JSObject *obj = cc.update(); if (!obj) { diff --git a/js/src/methodjit/StubCalls.cpp b/js/src/methodjit/StubCalls.cpp index da7ce7f44bb..94e9b9c9b21 100644 --- a/js/src/methodjit/StubCalls.cpp +++ b/js/src/methodjit/StubCalls.cpp @@ -78,16 +78,16 @@ stubs::BindName(VMFrame &f) PropertyCacheEntry *entry; /* Fast-path should have caught this. See comment in interpreter. */ - JS_ASSERT(f.fp->getScopeChain()->getParent()); + JS_ASSERT(f.fp()->getScopeChain()->getParent()); JSAtom *atom; JSObject *obj2; JSContext *cx = f.cx; - JSObject *obj = f.fp->getScopeChain(); + JSObject *obj = f.fp()->getScopeChain(); JS_PROPERTY_CACHE(cx).test(cx, f.regs.pc, obj, obj2, entry, atom); if (atom) { jsid id = ATOM_TO_JSID(atom); - obj = js_FindIdentifierBase(cx, f.fp->getScopeChain(), id); + obj = js_FindIdentifierBase(cx, f.fp()->getScopeChain(), id); if (!obj) THROW(); } @@ -98,7 +98,7 @@ stubs::BindName(VMFrame &f) JSObject * JS_FASTCALL stubs::BindGlobalName(VMFrame &f) { - return f.fp->getScopeChain()->getGlobal(); + return f.fp()->getScopeChain()->getGlobal(); } void JS_FASTCALL @@ -369,7 +369,7 @@ NameOp(VMFrame &f, JSObject *obj, bool callname = false) return NULL; if (!prop) { /* Kludge to allow (typeof foo == "undefined") tests. */ - JSOp op2 = js_GetOpcode(cx, f.fp->getScript(), f.regs.pc + JSOP_NAME_LENGTH); + JSOp op2 = js_GetOpcode(cx, f.fp()->getScript(), f.regs.pc + JSOP_NAME_LENGTH); if (op2 == JSOP_TYPEOF) { f.regs.sp++; f.regs.sp[-1].setUndefined(); @@ -417,14 +417,14 @@ NameOp(VMFrame &f, JSObject *obj, bool callname = false) void JS_FASTCALL stubs::Name(VMFrame &f) { - if (!NameOp(f, f.fp->getScopeChain())) + if (!NameOp(f, f.fp()->getScopeChain())) THROW(); } void JS_FASTCALL stubs::GetGlobalName(VMFrame &f) { - JSObject *globalObj = f.fp->getScopeChain()->getGlobal(); + JSObject *globalObj = f.fp()->getScopeChain()->getGlobal(); if (!NameOp(f, globalObj)) THROW(); } @@ -458,7 +458,7 @@ stubs::ForName(VMFrame &f, JSAtom *atom) JSContext *cx = f.cx; JSFrameRegs ®s = f.regs; - JS_ASSERT(regs.sp - 1 >= f.fp->base()); + JS_ASSERT(regs.sp - 1 >= f.fp()->base()); jsid id = ATOM_TO_JSID(atom); JSObject *obj, *obj2; JSProperty *prop; @@ -646,7 +646,7 @@ stubs::SetElem(VMFrame &f) void JS_FASTCALL stubs::CallName(VMFrame &f) { - JSObject *obj = NameOp(f, f.fp->getScopeChain(), true); + JSObject *obj = NameOp(f, f.fp()->getScopeChain(), true); if (!obj) THROW(); } @@ -804,7 +804,7 @@ stubs::LocalInc(VMFrame &f, uint32 slot) THROW(); f.regs.sp[-2].setNumber(d); f.regs.sp[-1].setNumber(d + 1); - f.fp->slots()[slot] = f.regs.sp[-1]; + f.fp()->slots()[slot] = f.regs.sp[-1]; } void JS_FASTCALL @@ -815,7 +815,7 @@ stubs::LocalDec(VMFrame &f, uint32 slot) THROW(); f.regs.sp[-2].setNumber(d); f.regs.sp[-1].setNumber(d - 1); - f.fp->slots()[slot] = f.regs.sp[-1]; + f.fp()->slots()[slot] = f.regs.sp[-1]; } void JS_FASTCALL @@ -825,7 +825,7 @@ stubs::IncLocal(VMFrame &f, uint32 slot) if (!ValueToNumber(f.cx, f.regs.sp[-1], &d)) THROW(); f.regs.sp[-1].setNumber(d + 1); - f.fp->slots()[slot] = f.regs.sp[-1]; + f.fp()->slots()[slot] = f.regs.sp[-1]; } void JS_FASTCALL @@ -835,7 +835,7 @@ stubs::DecLocal(VMFrame &f, uint32 slot) if (!ValueToNumber(f.cx, f.regs.sp[-1], &d)) THROW(); f.regs.sp[-1].setNumber(d - 1); - f.fp->slots()[slot] = f.regs.sp[-1]; + f.fp()->slots()[slot] = f.regs.sp[-1]; } void JS_FASTCALL @@ -847,7 +847,7 @@ stubs::DefFun(VMFrame &f, uint32 index) uint32 old; JSContext *cx = f.cx; - JSStackFrame *fp = f.fp; + JSStackFrame *fp = f.fp(); JSScript *script = fp->getScript(); /* @@ -1354,7 +1354,7 @@ stubs::Debugger(VMFrame &f, jsbytecode *pc) JSDebuggerHandler handler = f.cx->debugHooks->debuggerHandler; if (handler) { Value rval; - switch (handler(f.cx, f.cx->fp->getScript(), pc, Jsvalify(&rval), + switch (handler(f.cx, f.cx->fp()->getScript(), pc, Jsvalify(&rval), f.cx->debugHooks->debuggerHandlerData)) { case JSTRAP_THROW: f.cx->throwing = JS_TRUE; @@ -1363,7 +1363,7 @@ stubs::Debugger(VMFrame &f, jsbytecode *pc) case JSTRAP_RETURN: f.cx->throwing = JS_FALSE; - f.cx->fp->setReturnValue(rval); + f.cx->fp()->setReturnValue(rval); #if (defined(JS_NO_FASTCALL) && defined(JS_CPU_X86)) || defined(_WIN64) *f.returnAddressLocation() = JS_FUNC_TO_DATA_PTR(void *, JS_METHODJIT_DATA(f.cx).trampolines.forceReturnFast); @@ -1395,7 +1395,7 @@ stubs::Trap(VMFrame &f, jsbytecode *pc) { Value rval; - switch (JS_HandleTrap(f.cx, f.cx->fp->getScript(), pc, Jsvalify(&rval))) { + switch (JS_HandleTrap(f.cx, f.cx->fp()->getScript(), pc, Jsvalify(&rval))) { case JSTRAP_THROW: f.cx->throwing = JS_TRUE; f.cx->exception = rval; @@ -1403,7 +1403,7 @@ stubs::Trap(VMFrame &f, jsbytecode *pc) case JSTRAP_RETURN: f.cx->throwing = JS_FALSE; - f.cx->fp->setReturnValue(rval); + f.cx->fp()->setReturnValue(rval); #if (defined(JS_NO_FASTCALL) && defined(JS_CPU_X86)) || defined(_WIN64) *f.returnAddressLocation() = JS_FUNC_TO_DATA_PTR(void *, JS_METHODJIT_DATA(f.cx).trampolines.forceReturnFast); @@ -1425,15 +1425,15 @@ stubs::Trap(VMFrame &f, jsbytecode *pc) void JS_FASTCALL stubs::This(VMFrame &f) { - if (!f.fp->getThisObject(f.cx)) + if (!f.fp()->getThisObject(f.cx)) THROW(); - f.regs.sp[-1] = f.fp->getThisValue(); + f.regs.sp[-1] = f.fp()->getThisValue(); } void JS_FASTCALL stubs::ComputeThis(VMFrame &f) { - if (!f.fp->getThisObject(f.cx)) + if (!f.fp()->getThisObject(f.cx)) THROW(); } @@ -1492,7 +1492,7 @@ stubs::InitElem(VMFrame &f, uint32 last) JSFrameRegs ®s = f.regs; /* Pop the element's value into rval. */ - JS_ASSERT(regs.sp - f.fp->base() >= 3); + JS_ASSERT(regs.sp - f.fp()->base() >= 3); const Value &rref = regs.sp[-1]; /* Find the object being initialized at top of stack. */ @@ -1534,7 +1534,7 @@ void JS_FASTCALL stubs::GetUpvar(VMFrame &f, uint32 ck) { /* :FIXME: We can do better, this stub isn't needed. */ - uint32 staticLevel = f.fp->getScript()->staticLevel; + uint32 staticLevel = f.fp()->getScript()->staticLevel; UpvarCookie cookie; cookie.fromInteger(ck); f.regs.sp[0] = GetUpvar(f.cx, staticLevel, cookie); @@ -1555,11 +1555,11 @@ stubs::DefLocalFun(VMFrame &f, JSFunction *fun) JSObject *obj = FUN_OBJECT(fun); if (FUN_NULL_CLOSURE(fun)) { - obj = CloneFunctionObject(f.cx, fun, f.fp->getScopeChain()); + obj = CloneFunctionObject(f.cx, fun, f.fp()->getScopeChain()); if (!obj) THROWV(NULL); } else { - JSObject *parent = js_GetScopeChain(f.cx, f.fp); + JSObject *parent = js_GetScopeChain(f.cx, f.fp()); if (!parent) THROWV(NULL); @@ -1594,7 +1594,7 @@ stubs::RegExp(VMFrame &f, JSObject *regex) * js_GetClassPrototype uses the latter only to locate the global. */ JSObject *proto; - if (!js_GetClassPrototype(f.cx, f.fp->getScopeChain(), JSProto_RegExp, &proto)) + if (!js_GetClassPrototype(f.cx, f.fp()->getScopeChain(), JSProto_RegExp, &proto)) THROWV(NULL); JS_ASSERT(proto); JSObject *obj = js_CloneRegExpObject(f.cx, regex, proto); @@ -1607,8 +1607,8 @@ JSObject * JS_FASTCALL stubs::LambdaForInit(VMFrame &f, JSFunction *fun) { JSObject *obj = FUN_OBJECT(fun); - if (FUN_NULL_CLOSURE(fun) && obj->getParent() == f.fp->getScopeChain()) { - fun->setMethodAtom(f.fp->getScript()->getAtom(GET_SLOTNO(f.regs.pc + JSOP_LAMBDA_LENGTH))); + if (FUN_NULL_CLOSURE(fun) && obj->getParent() == f.fp()->getScopeChain()) { + fun->setMethodAtom(f.fp()->getScript()->getAtom(GET_SLOTNO(f.regs.pc + JSOP_LAMBDA_LENGTH))); return obj; } return Lambda(f, fun); @@ -1618,10 +1618,10 @@ JSObject * JS_FASTCALL stubs::LambdaForSet(VMFrame &f, JSFunction *fun) { JSObject *obj = FUN_OBJECT(fun); - if (FUN_NULL_CLOSURE(fun) && obj->getParent() == f.fp->getScopeChain()) { + if (FUN_NULL_CLOSURE(fun) && obj->getParent() == f.fp()->getScopeChain()) { const Value &lref = f.regs.sp[-1]; if (lref.isObject() && lref.toObject().canHaveMethodBarrier()) { - fun->setMethodAtom(f.fp->getScript()->getAtom(GET_SLOTNO(f.regs.pc + JSOP_LAMBDA_LENGTH))); + fun->setMethodAtom(f.fp()->getScript()->getAtom(GET_SLOTNO(f.regs.pc + JSOP_LAMBDA_LENGTH))); return obj; } } @@ -1632,7 +1632,7 @@ JSObject * JS_FASTCALL stubs::LambdaJoinableForCall(VMFrame &f, JSFunction *fun) { JSObject *obj = FUN_OBJECT(fun); - if (FUN_NULL_CLOSURE(fun) && obj->getParent() == f.fp->getScopeChain()) { + if (FUN_NULL_CLOSURE(fun) && obj->getParent() == f.fp()->getScopeChain()) { /* * Array.prototype.sort and String.prototype.replace are * optimized as if they are special form. We know that they @@ -1669,7 +1669,7 @@ JSObject * JS_FASTCALL stubs::LambdaJoinableForNull(VMFrame &f, JSFunction *fun) { JSObject *obj = FUN_OBJECT(fun); - if (FUN_NULL_CLOSURE(fun) && obj->getParent() == f.fp->getScopeChain()) { + if (FUN_NULL_CLOSURE(fun) && obj->getParent() == f.fp()->getScopeChain()) { jsbytecode *pc2 = f.regs.pc + JSOP_LAMBDA_LENGTH + JSOP_NULL_LENGTH; JSOp op2 = JSOp(*pc2); @@ -1686,9 +1686,9 @@ stubs::Lambda(VMFrame &f, JSFunction *fun) JSObject *parent; if (FUN_NULL_CLOSURE(fun)) { - parent = f.fp->getScopeChain(); + parent = f.fp()->getScopeChain(); } else { - parent = js_GetScopeChain(f.cx, f.fp); + parent = js_GetScopeChain(f.cx, f.fp()); if (!parent) THROWV(NULL); } @@ -1712,7 +1712,7 @@ static inline bool ObjIncOp(VMFrame &f, JSObject *obj, jsid id) { JSContext *cx = f.cx; - JSStackFrame *fp = f.fp; + JSStackFrame *fp = f.fp(); f.regs.sp[0].setNull(); f.regs.sp++; @@ -1903,7 +1903,7 @@ stubs::DecElem(VMFrame &f) void JS_FASTCALL stubs::NameInc(VMFrame &f, JSAtom *atom) { - JSObject *obj = f.fp->getScopeChain(); + JSObject *obj = f.fp()->getScopeChain(); if (!NameIncDec<1, true>(f, obj, atom)) THROW(); } @@ -1911,7 +1911,7 @@ stubs::NameInc(VMFrame &f, JSAtom *atom) void JS_FASTCALL stubs::NameDec(VMFrame &f, JSAtom *atom) { - JSObject *obj = f.fp->getScopeChain(); + JSObject *obj = f.fp()->getScopeChain(); if (!NameIncDec<-1, true>(f, obj, atom)) THROW(); } @@ -1919,7 +1919,7 @@ stubs::NameDec(VMFrame &f, JSAtom *atom) void JS_FASTCALL stubs::IncName(VMFrame &f, JSAtom *atom) { - JSObject *obj = f.fp->getScopeChain(); + JSObject *obj = f.fp()->getScopeChain(); if (!NameIncDec<1, false>(f, obj, atom)) THROW(); } @@ -1927,7 +1927,7 @@ stubs::IncName(VMFrame &f, JSAtom *atom) void JS_FASTCALL stubs::DecName(VMFrame &f, JSAtom *atom) { - JSObject *obj = f.fp->getScopeChain(); + JSObject *obj = f.fp()->getScopeChain(); if (!NameIncDec<-1, false>(f, obj, atom)) THROW(); } @@ -1935,7 +1935,7 @@ stubs::DecName(VMFrame &f, JSAtom *atom) void JS_FASTCALL stubs::GlobalNameInc(VMFrame &f, JSAtom *atom) { - JSObject *obj = f.fp->getScopeChain()->getGlobal(); + JSObject *obj = f.fp()->getScopeChain()->getGlobal(); if (!NameIncDec<1, true>(f, obj, atom)) THROW(); } @@ -1943,7 +1943,7 @@ stubs::GlobalNameInc(VMFrame &f, JSAtom *atom) void JS_FASTCALL stubs::GlobalNameDec(VMFrame &f, JSAtom *atom) { - JSObject *obj = f.fp->getScopeChain()->getGlobal(); + JSObject *obj = f.fp()->getScopeChain()->getGlobal(); if (!NameIncDec<-1, true>(f, obj, atom)) THROW(); } @@ -1951,7 +1951,7 @@ stubs::GlobalNameDec(VMFrame &f, JSAtom *atom) void JS_FASTCALL stubs::IncGlobalName(VMFrame &f, JSAtom *atom) { - JSObject *obj = f.fp->getScopeChain()->getGlobal(); + JSObject *obj = f.fp()->getScopeChain()->getGlobal(); if (!NameIncDec<1, false>(f, obj, atom)) THROW(); } @@ -1959,7 +1959,7 @@ stubs::IncGlobalName(VMFrame &f, JSAtom *atom) void JS_FASTCALL stubs::DecGlobalName(VMFrame &f, JSAtom *atom) { - JSObject *obj = f.fp->getScopeChain()->getGlobal(); + JSObject *obj = f.fp()->getScopeChain()->getGlobal(); if (!NameIncDec<-1, false>(f, obj, atom)) THROW(); } @@ -1999,7 +1999,7 @@ InlineGetProp(VMFrame &f) JS_ASSERT(entry->vword.isSprop()); JSScopeProperty *sprop = entry->vword.toSprop(); NATIVE_GET(cx, obj, obj2, sprop, - f.fp->hasIMacroPC() ? JSGET_NO_METHOD_BARRIER : JSGET_METHOD_BARRIER, + f.fp()->hasIMacroPC() ? JSGET_NO_METHOD_BARRIER : JSGET_METHOD_BARRIER, &rval, return false); } break; @@ -2008,7 +2008,7 @@ InlineGetProp(VMFrame &f) jsid id = ATOM_TO_JSID(atom); if (JS_LIKELY(!aobj->getOps()->getProperty) ? !js_GetPropertyHelper(cx, obj, id, - f.fp->hasIMacroPC() + f.fp()->hasIMacroPC() ? JSGET_CACHE_RESULT | JSGET_NO_METHOD_BARRIER : JSGET_CACHE_RESULT | JSGET_METHOD_BARRIER, &rval) @@ -2196,7 +2196,7 @@ InitPropOrMethod(VMFrame &f, JSAtom *atom, JSOp op) JSFrameRegs ®s = f.regs; /* Load the property's initial value into rval. */ - JS_ASSERT(regs.sp - f.fp->base() >= 2); + JS_ASSERT(regs.sp - f.fp()->base() >= 2); Value rval; rval = regs.sp[-1]; @@ -2295,7 +2295,7 @@ stubs::InitMethod(VMFrame &f, JSAtom *atom) void JS_FASTCALL stubs::IterNext(VMFrame &f) { - JS_ASSERT(f.regs.sp - 1 >= f.fp->base()); + JS_ASSERT(f.regs.sp - 1 >= f.fp()->base()); JS_ASSERT(f.regs.sp[-1].isObject()); JSObject *iterobj = &f.regs.sp[-1].toObject(); @@ -2308,7 +2308,7 @@ stubs::IterNext(VMFrame &f) JSBool JS_FASTCALL stubs::IterMore(VMFrame &f) { - JS_ASSERT(f.regs.sp - 1 >= f.fp->base()); + JS_ASSERT(f.regs.sp - 1 >= f.fp()->base()); JS_ASSERT(f.regs.sp[-1].isObject()); Value v; @@ -2322,7 +2322,7 @@ stubs::IterMore(VMFrame &f) void JS_FASTCALL stubs::EndIter(VMFrame &f) { - JS_ASSERT(f.regs.sp - 1 >= f.fp->base()); + JS_ASSERT(f.regs.sp - 1 >= f.fp()->base()); if (!js_CloseIterator(f.cx, &f.regs.sp[-1].toObject())) THROW(); } @@ -2376,7 +2376,7 @@ void JS_FASTCALL stubs::Arguments(VMFrame &f) { f.regs.sp++; - if (!js_GetArgsValue(f.cx, f.fp, &f.regs.sp[-1])) + if (!js_GetArgsValue(f.cx, f.fp(), &f.regs.sp[-1])) THROW(); } @@ -2423,7 +2423,7 @@ stubs::ArgCnt(VMFrame &f) { JSContext *cx = f.cx; JSRuntime *rt = cx->runtime; - JSStackFrame *fp = f.fp; + JSStackFrame *fp = f.fp(); jsid id = ATOM_TO_JSID(rt->atomState.lengthAtom); f.regs.sp++; @@ -2435,7 +2435,7 @@ void JS_FASTCALL stubs::EnterBlock(VMFrame &f, JSObject *obj) { JSFrameRegs ®s = f.regs; - JSStackFrame *fp = f.fp; + JSStackFrame *fp = f.fp(); JS_ASSERT(!OBJ_IS_CLONED_BLOCK(obj)); JS_ASSERT(fp->base() + OBJ_BLOCK_DEPTH(cx, obj) == regs.sp); @@ -2477,7 +2477,7 @@ void JS_FASTCALL stubs::LeaveBlock(VMFrame &f) { JSContext *cx = f.cx; - JSStackFrame *fp = f.fp; + JSStackFrame *fp = f.fp(); #ifdef DEBUG JS_ASSERT(fp->getBlockChain()->getClass() == &js_BlockClass); @@ -2505,7 +2505,7 @@ void * JS_FASTCALL stubs::LookupSwitch(VMFrame &f, jsbytecode *pc) { jsbytecode *jpc = pc; - JSScript *script = f.fp->getScript(); + JSScript *script = f.fp()->getScript(); /* This is correct because the compiler adjusts the stack beforehand. */ Value lval = f.regs.sp[-1]; @@ -2574,7 +2574,7 @@ stubs::TableSwitch(VMFrame &f, jsbytecode *origPc) { jsbytecode * const originalPC = origPc; jsbytecode *pc = originalPC; - JSScript *script = f.fp->getScript(); + JSScript *script = f.fp()->getScript(); uint32 jumpOffset = GET_JUMP_OFFSET(pc); pc += JUMP_OFFSET_LEN; @@ -2637,7 +2637,7 @@ stubs::ArgSub(VMFrame &f, uint32 n) { jsid id = INT_TO_JSID(n); Value rval; - if (!js_GetArgsProperty(f.cx, f.fp, id, &rval)) + if (!js_GetArgsProperty(f.cx, f.fp(), id, &rval)) THROW(); f.regs.sp[0] = rval; } diff --git a/js/src/methodjit/TrampolineCompiler.cpp b/js/src/methodjit/TrampolineCompiler.cpp index 023d9265ad7..781b2efba9a 100644 --- a/js/src/methodjit/TrampolineCompiler.cpp +++ b/js/src/methodjit/TrampolineCompiler.cpp @@ -132,8 +132,7 @@ TrampolineCompiler::generateForceReturn(Assembler &masm) */ masm.loadPtr(Address(JSFrameReg, offsetof(JSStackFrame, down)), Registers::ReturnReg); masm.loadPtr(FrameAddress(offsetof(VMFrame, cx)), Registers::ArgReg1); - masm.storePtr(Registers::ReturnReg, FrameAddress(offsetof(VMFrame, fp))); - masm.storePtr(Registers::ReturnReg, Address(Registers::ArgReg1, offsetof(JSContext, fp))); + masm.storePtr(Registers::ReturnReg, FrameAddress(offsetof(VMFrame, regs.fp))); Address rval(JSFrameReg, JSStackFrame::offsetReturnValue()); masm.loadPayload(rval, JSReturnReg_Data); diff --git a/js/src/shell/js.cpp b/js/src/shell/js.cpp index 0f6ca86b3ed..0750b5cba06 100644 --- a/js/src/shell/js.cpp +++ b/js/src/shell/js.cpp @@ -1165,7 +1165,7 @@ AssertJit(JSContext *cx, uintN argc, jsval *vp) { #ifdef JS_METHODJIT if (JS_GetOptions(cx) & JSOPTION_METHODJIT) { - if (cx->fp->getScript()->nmap == NULL) { + if (cx->fp()->getScript()->nmap == NULL) { JS_ReportErrorNumber(cx, my_GetErrorMessage, NULL, JSSMSG_ASSERT_JIT_FAILED); return JS_FALSE; }