From 43cb54f7232890741ff251fc8cea8dc79aff3c54 Mon Sep 17 00:00:00 2001 From: "Nicolas B. Pierron" Date: Fri, 19 Dec 2014 15:28:29 +0100 Subject: [PATCH] Bug 1073033 part 2.2 - Update callee uses, extract information form the calleeTemplate. r=shu --- js/src/jit/JitFrameIterator.h | 2 +- js/src/jit/JitFrames.cpp | 15 ++++++++------- js/src/jit/RematerializedFrame.cpp | 2 +- js/src/jsopcode.cpp | 6 +++--- js/src/vm/ArgumentsObject.cpp | 2 +- js/src/vm/Stack.cpp | 4 ++-- 6 files changed, 16 insertions(+), 15 deletions(-) diff --git a/js/src/jit/JitFrameIterator.h b/js/src/jit/JitFrameIterator.h index 1c6a0d0d301a..0d82b5069913 100644 --- a/js/src/jit/JitFrameIterator.h +++ b/js/src/jit/JitFrameIterator.h @@ -669,7 +669,7 @@ class InlineFrameIterator // Read arguments, which only function frames have. if (isFunctionFrame()) { unsigned nactual = numActualArgs(); - unsigned nformal = callee()->nargs(); + unsigned nformal = calleeTemplate()->nargs(); // Get the non overflown arguments, which are taken from the inlined // frame, because it will have the updated value when JSOP_SETARG is diff --git a/js/src/jit/JitFrames.cpp b/js/src/jit/JitFrames.cpp index 4713b6c6672d..7b3481bd8393 100644 --- a/js/src/jit/JitFrames.cpp +++ b/js/src/jit/JitFrames.cpp @@ -395,7 +395,7 @@ CloseLiveIterator(JSContext *cx, const InlineFrameIterator &frame, uint32_t loca SnapshotIterator si = frame.snapshotIterator(); // Skip stack slots until we reach the iterator object. - uint32_t base = CountArgSlots(frame.script(), frame.maybeCallee()) + frame.script()->nfixed(); + uint32_t base = CountArgSlots(frame.script(), frame.maybeCalleeTemplate()) + frame.script()->nfixed(); uint32_t skipSlots = base + localSlot - 1; for (unsigned i = 0; i < skipSlots; i++) @@ -2560,6 +2560,8 @@ JitFrameIterator::dumpBaseline() const void InlineFrameIterator::dump() const { + MaybeReadFallback fallback(UndefinedValue()); + if (more()) fprintf(stderr, " JS frame (inlined)\n"); else @@ -2570,7 +2572,7 @@ InlineFrameIterator::dump() const isFunction = true; fprintf(stderr, " callee fun: "); #ifdef DEBUG - js_DumpObject(callee()); + js_DumpObject(callee(fallback)); #else fprintf(stderr, "?\n"); #endif @@ -2589,7 +2591,6 @@ InlineFrameIterator::dump() const } SnapshotIterator si = snapshotIterator(); - MaybeReadFallback fallback(UndefinedValue()); fprintf(stderr, " slots: %u\n", si.numAllocations() - 1); for (unsigned i = 0; i < si.numAllocations() - 1; i++) { if (isFunction) { @@ -2597,15 +2598,15 @@ InlineFrameIterator::dump() const fprintf(stderr, " scope chain: "); else if (i == 1) fprintf(stderr, " this: "); - else if (i - 2 < callee()->nargs()) + else if (i - 2 < calleeTemplate()->nargs()) fprintf(stderr, " formal (arg %d): ", i - 2); else { - if (i - 2 == callee()->nargs() && numActualArgs() > callee()->nargs()) { - DumpOp d(callee()->nargs()); + if (i - 2 == calleeTemplate()->nargs() && numActualArgs() > calleeTemplate()->nargs()) { + DumpOp d(calleeTemplate()->nargs()); unaliasedForEachActual(GetJSContextFromJitCode(), d, ReadFrame_Overflown, fallback); } - fprintf(stderr, " slot %d: ", int(i - 2 - callee()->nargs())); + fprintf(stderr, " slot %d: ", int(i - 2 - calleeTemplate()->nargs())); } } else fprintf(stderr, " slot %u: ", i); diff --git a/js/src/jit/RematerializedFrame.cpp b/js/src/jit/RematerializedFrame.cpp index cdfa639eeae9..937d310867c9 100644 --- a/js/src/jit/RematerializedFrame.cpp +++ b/js/src/jit/RematerializedFrame.cpp @@ -48,7 +48,7 @@ RematerializedFrame::RematerializedFrame(JSContext *cx, uint8_t *top, unsigned n /* static */ RematerializedFrame * RematerializedFrame::New(JSContext *cx, uint8_t *top, InlineFrameIterator &iter) { - unsigned numFormals = iter.isFunctionFrame() ? iter.callee()->nargs() : 0; + unsigned numFormals = iter.isFunctionFrame() ? iter.calleeTemplate()->nargs() : 0; unsigned argSlots = Max(numFormals, iter.numActualArgs()); size_t numBytes = sizeof(RematerializedFrame) + (argSlots + iter.script()->nfixed()) * sizeof(Value) - diff --git a/js/src/jsopcode.cpp b/js/src/jsopcode.cpp index 4271fc3fd6b4..9ed9c4013841 100644 --- a/js/src/jsopcode.cpp +++ b/js/src/jsopcode.cpp @@ -1809,7 +1809,7 @@ DecompileExpressionFromStack(JSContext *cx, int spindex, int skipStackHits, Hand AutoCompartment ac(cx, &script->global()); jsbytecode *valuepc = frameIter.pc(); RootedFunction fun(cx, frameIter.isFunctionFrame() - ? frameIter.callee() + ? frameIter.calleeTemplate() : nullptr); MOZ_ASSERT(script->containsPC(valuepc)); @@ -1889,8 +1889,8 @@ DecompileArgumentFromStack(JSContext *cx, int formalIndex, char **res) AutoCompartment ac(cx, &script->global()); jsbytecode *current = frameIter.pc(); RootedFunction fun(cx, frameIter.isFunctionFrame() - ? frameIter.callee() - : nullptr); + ? frameIter.calleeTemplate() + : nullptr); MOZ_ASSERT(script->containsPC(current)); diff --git a/js/src/vm/ArgumentsObject.cpp b/js/src/vm/ArgumentsObject.cpp index 0e6bf2313912..1bd7fdebeed3 100644 --- a/js/src/vm/ArgumentsObject.cpp +++ b/js/src/vm/ArgumentsObject.cpp @@ -133,7 +133,7 @@ struct CopyScriptFrameIterArgs /* Define formals which are not part of the actuals. */ unsigned numActuals = iter_.numActualArgs(); - unsigned numFormals = iter_.callee()->nargs(); + unsigned numFormals = iter_.calleeTemplate()->nargs(); MOZ_ASSERT(numActuals <= totalArgs); MOZ_ASSERT(numFormals <= totalArgs); MOZ_ASSERT(Max(numActuals, numFormals) == totalArgs); diff --git a/js/src/vm/Stack.cpp b/js/src/vm/Stack.cpp index 79b7733dbf08..e9e92c2b9f68 100644 --- a/js/src/vm/Stack.cpp +++ b/js/src/vm/Stack.cpp @@ -864,7 +864,7 @@ FrameIter::functionDisplayAtom() const break; case INTERP: case JIT: - return callee()->displayAtom(); + return calleeTemplate()->displayAtom(); case ASMJS: return data_.asmJSFrames_.functionDisplayAtom(); } @@ -1186,7 +1186,7 @@ FrameIter::scopeChain(JSContext *cx) const CallObject & FrameIter::callObj(JSContext *cx) const { - MOZ_ASSERT(callee()->isHeavyweight()); + MOZ_ASSERT(calleeTemplate()->isHeavyweight()); JSObject *pobj = scopeChain(cx); while (!pobj->is())