From dff0f088cf5a58d6f953ef7f22e08da4f31f51aa Mon Sep 17 00:00:00 2001 From: David Mandelin Date: Wed, 10 Nov 2010 16:55:46 -0800 Subject: [PATCH] Bug 609244: use entry script's compartment for VM frame stack management, r=dvander --- js/src/methodjit/InvokeHelpers.cpp | 12 ++++++------ js/src/methodjit/MethodJIT.cpp | 14 +++++++------- js/src/methodjit/MethodJIT.h | 2 +- js/src/methodjit/MonoIC.cpp | 4 ++-- js/src/methodjit/Retcon.cpp | 2 +- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/js/src/methodjit/InvokeHelpers.cpp b/js/src/methodjit/InvokeHelpers.cpp index 2f2ebe83e390..f2c0a039ef48 100644 --- a/js/src/methodjit/InvokeHelpers.cpp +++ b/js/src/methodjit/InvokeHelpers.cpp @@ -1,4 +1,4 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +/* -*- mOde: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- * vim: set ts=4 sw=4 et tw=99: * * ***** BEGIN LICENSE BLOCK ***** @@ -181,7 +181,7 @@ InlineReturn(VMFrame &f) JSContext *cx = f.cx; JSStackFrame *fp = f.regs.fp; - JS_ASSERT(f.fp() != f.entryFp); + JS_ASSERT(f.fp() != f.entryfp); JS_ASSERT(!js_IsActiveWithOrBlock(cx, &fp->scopeChain(), 0)); @@ -231,7 +231,7 @@ stubs::HitStackQuota(VMFrame &f) /* Include space to push another frame. */ uintN nvals = f.fp()->script()->nslots + VALUES_PER_STACK_FRAME; JS_ASSERT(f.regs.sp == f.fp()->base()); - if (f.cx->stack().bumpCommitAndLimit(f.entryFp, f.regs.sp, nvals, &f.stackLimit)) + if (f.cx->stack().bumpCommitAndLimit(f.entryfp, f.regs.sp, nvals, &f.stackLimit)) return; /* Remove the current partially-constructed frame before throwing. */ @@ -269,7 +269,7 @@ stubs::FixupArity(VMFrame &f, uint32 nactual) /* Reserve enough space for a callee frame. */ JSStackFrame *newfp = cx->stack().getInlineFrameWithinLimit(cx, (Value*) oldfp, nactual, fun, fun->script(), &flags, - f.entryFp, &f.stackLimit); + f.entryfp, &f.stackLimit); if (!newfp) THROWV(NULL); @@ -364,7 +364,7 @@ UncachedInlineCall(VMFrame &f, uint32 flags, void **pret, uint32 argc) StackSpace &stack = cx->stack(); JSStackFrame *newfp = stack.getInlineFrameWithinLimit(cx, f.regs.sp, argc, newfun, newscript, &flags, - f.entryFp, &f.stackLimit); + f.entryfp, &f.stackLimit); if (JS_UNLIKELY(!newfp)) return false; JS_ASSERT_IF(!vp[1].isPrimitive() && !(flags & JSFRAME_CONSTRUCTING), @@ -557,7 +557,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); // For consistency with Interpret(), always run the script epilogue. diff --git a/js/src/methodjit/MethodJIT.cpp b/js/src/methodjit/MethodJIT.cpp index 6c422e815260..4be359a29567 100644 --- a/js/src/methodjit/MethodJIT.cpp +++ b/js/src/methodjit/MethodJIT.cpp @@ -122,14 +122,14 @@ extern "C" void JaegerTrampolineReturn(); extern "C" void JS_FASTCALL PushActiveVMFrame(VMFrame &f) { - f.cx->jaegerCompartment()->pushActiveFrame(&f); + f.entryfp->script()->compartment->jaegerCompartment->pushActiveFrame(&f); f.regs.fp->setNativeReturnAddress(JS_FUNC_TO_DATA_PTR(void*, JaegerTrampolineReturn)); } extern "C" void JS_FASTCALL PopActiveVMFrame(VMFrame &f) { - f.cx->jaegerCompartment()->popActiveFrame(); + f.entryfp->script()->compartment->jaegerCompartment->popActiveFrame(); } extern "C" void JS_FASTCALL @@ -212,7 +212,7 @@ SYMBOL_STRING(JaegerTrampoline) ":" "\n" * rcx = inlineCallCount * fp must go into rbx */ - "pushq %rsi" "\n" /* entryFp */ + "pushq %rsi" "\n" /* entryfp */ "pushq %rcx" "\n" /* inlineCallCount */ "pushq %rdi" "\n" /* cx */ "pushq %rsi" "\n" /* fp */ @@ -323,7 +323,7 @@ SYMBOL_STRING(JaegerTrampoline) ":" "\n" /* Build the JIT frame. Push fields in order, * then align the stack to form esp == VMFrame. */ "movl 12(%ebp), %ebx" "\n" /* load fp */ - "pushl %ebx" "\n" /* entryFp */ + "pushl %ebx" "\n" /* entryfp */ "pushl 20(%ebp)" "\n" /* stackLimit */ "pushl 8(%ebp)" "\n" /* cx */ "pushl %ebx" "\n" /* fp */ @@ -402,7 +402,7 @@ SYMBOL_STRING(InjectJaegerReturn) ":" "\n" JS_STATIC_ASSERT(sizeof(VMFrame) == 80); JS_STATIC_ASSERT(offsetof(VMFrame, savedLR) == (4*19)); -JS_STATIC_ASSERT(offsetof(VMFrame, entryFp) == (4*10)); +JS_STATIC_ASSERT(offsetof(VMFrame, entryfp) == (4*10)); JS_STATIC_ASSERT(offsetof(VMFrame, stackLimit) == (4*9)); JS_STATIC_ASSERT(offsetof(VMFrame, cx) == (4*8)); JS_STATIC_ASSERT(offsetof(VMFrame, regs.fp) == (4*7)); @@ -457,7 +457,7 @@ SYMBOL_STRING(JaegerTrampoline) ":" "\n" * [ r6 ] | considering that we might not use them anyway. * [ r5 ] | * [ r4 ] / - * [ entryFp ] + * [ entryfp ] * [ stkLimit ] * [ cx ] * [ regs.fp ] @@ -473,7 +473,7 @@ SYMBOL_STRING(JaegerTrampoline) ":" "\n" /* Push callee-saved registers. */ " push {r4-r11,lr}" "\n" /* Push interesting VMFrame content. */ -" push {r1}" "\n" /* entryFp */ +" push {r1}" "\n" /* entryfp */ " push {r3}" "\n" /* stackLimit */ " push {r0}" "\n" /* cx */ " push {r1}" "\n" /* regs.fp */ diff --git a/js/src/methodjit/MethodJIT.h b/js/src/methodjit/MethodJIT.h index f303aa91b3db..4cea28608c03 100644 --- a/js/src/methodjit/MethodJIT.h +++ b/js/src/methodjit/MethodJIT.h @@ -74,7 +74,7 @@ struct VMFrame JSFrameRegs regs; JSContext *cx; Value *stackLimit; - JSStackFrame *entryFp; + JSStackFrame *entryfp; #if defined(JS_CPU_X86) void *savedEBX; diff --git a/js/src/methodjit/MonoIC.cpp b/js/src/methodjit/MonoIC.cpp index 98e3add357d4..85cd30cfe591 100644 --- a/js/src/methodjit/MonoIC.cpp +++ b/js/src/methodjit/MonoIC.cpp @@ -880,7 +880,7 @@ BumpStack(VMFrame &f, uintN inc) if (f.regs.sp + inc < f.stackLimit) return true; StackSpace &stack = f.cx->stack(); - if (!stack.bumpCommitAndLimit(f.entryFp, f.regs.sp, inc, &f.stackLimit)) { + if (!stack.bumpCommitAndLimit(f.entryfp, f.regs.sp, inc, &f.stackLimit)) { js_ReportOverRecursed(f.cx); return false; } @@ -906,7 +906,7 @@ BumpStack(VMFrame &f, uintN inc) return true; StackSpace &stack = f.cx->stack(); - if (stack.bumpCommitAndLimit(f.entryFp, f.regs.sp, incWithSpace, &f.stackLimit)) + if (stack.bumpCommitAndLimit(f.entryfp, f.regs.sp, incWithSpace, &f.stackLimit)) return true; if (!stack.ensureSpace(f.cx, f.regs.sp, incWithSpace)) diff --git a/js/src/methodjit/Retcon.cpp b/js/src/methodjit/Retcon.cpp index 656146ab0463..3b98575dce26 100644 --- a/js/src/methodjit/Retcon.cpp +++ b/js/src/methodjit/Retcon.cpp @@ -132,7 +132,7 @@ Recompiler::recompile() f = f->previous) { // Scan all frames owned by this VMFrame. - JSStackFrame *end = f->entryFp->prev(); + JSStackFrame *end = f->entryfp->prev(); for (JSStackFrame *fp = f->fp(); fp != end; fp = fp->prev()) { // Remember the latest frame for each type of JIT'd code, so the // compiler will have a frame to re-JIT from.