mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 979043 - Simplify forEachCanonicalActualArg (r=jandem)
This commit is contained in:
parent
25bd4e0e40
commit
caad7bd99e
@ -217,7 +217,7 @@ class IonFrameIterator
|
||||
MachineState machineState() const;
|
||||
|
||||
template <class Op>
|
||||
void forEachCanonicalActualArg(Op op, ReadFrameArgsBehavior behavior) const {
|
||||
void unaliasedForEachActual(Op op, ReadFrameArgsBehavior behavior) const {
|
||||
JS_ASSERT(isBaselineJS());
|
||||
|
||||
unsigned nactual = numActualArgs();
|
||||
@ -476,7 +476,7 @@ class InlineFrameIteratorMaybeGC
|
||||
}
|
||||
|
||||
template <class Op>
|
||||
void forEachCanonicalActualArg(JSContext *cx, Op op, ReadFrameArgsBehavior behavior) const {
|
||||
void unaliasedForEachActual(JSContext *cx, Op op, ReadFrameArgsBehavior behavior) const {
|
||||
Nop nop;
|
||||
readFrameArgsAndLocals(cx, op, nop, nullptr, nullptr, behavior);
|
||||
}
|
||||
|
@ -1829,7 +1829,7 @@ InlineFrameIteratorMaybeGC<allowGC>::dump() const
|
||||
else {
|
||||
if (i - 2 == callee()->nargs() && numActualArgs() > callee()->nargs()) {
|
||||
DumpOp d(callee()->nargs());
|
||||
forEachCanonicalActualArg(GetJSContextFromJitCode(), d, ReadFrame_Overflown);
|
||||
unaliasedForEachActual(GetJSContextFromJitCode(), d, ReadFrame_Overflown);
|
||||
}
|
||||
|
||||
fprintf(stderr, " slot %d: ", int(i - 2 - callee()->nargs()));
|
||||
|
@ -966,7 +966,7 @@ PushBaselineFunApplyArguments(JSContext *cx, jit::IonFrameIterator &frame, Invok
|
||||
args.setThis(vp[2]);
|
||||
|
||||
/* Steps 7-8. */
|
||||
frame.forEachCanonicalActualArg(CopyTo(args.array()), jit::ReadFrame_Actuals);
|
||||
frame.unaliasedForEachActual(CopyTo(args.array()), jit::ReadFrame_Actuals);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
@ -1024,8 +1024,8 @@ js_fun_apply(JSContext *cx, unsigned argc, Value *vp)
|
||||
args.setThis(vp[2]);
|
||||
|
||||
/* Steps 7-8. */
|
||||
iter.forEachCanonicalActualArg(cx, CopyTo(args.array()),
|
||||
jit::ReadFrame_Actuals);
|
||||
iter.unaliasedForEachActual(cx, CopyTo(args.array()),
|
||||
jit::ReadFrame_Actuals);
|
||||
} else {
|
||||
JS_ASSERT(frame.isBaselineStub());
|
||||
|
||||
@ -1062,7 +1062,7 @@ js_fun_apply(JSContext *cx, unsigned argc, Value *vp)
|
||||
args.setThis(vp[2]);
|
||||
|
||||
/* Steps 7-8. */
|
||||
fp->forEachUnaliasedActual(CopyTo(args.array()));
|
||||
fp->unaliasedForEachActual(CopyTo(args.array()));
|
||||
}
|
||||
} else {
|
||||
/* Step 3. */
|
||||
|
@ -134,13 +134,8 @@ struct CopyScriptFrameIterArgs
|
||||
{ }
|
||||
|
||||
void copyArgs(JSContext *cx, HeapValue *dstBase, unsigned totalArgs) const {
|
||||
if (!iter_.isJit()) {
|
||||
CopyStackFrameArguments(iter_.abstractFramePtr(), dstBase, totalArgs);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Copy actual arguments. */
|
||||
iter_.ionForEachCanonicalActualArg(cx, CopyToHeap(dstBase));
|
||||
iter_.unaliasedForEachActual(cx, CopyToHeap(dstBase));
|
||||
|
||||
/* Define formals which are not part of the actuals. */
|
||||
unsigned numActuals = iter_.numActualArgs();
|
||||
|
@ -134,10 +134,9 @@ StackFrame::unaliasedActual(unsigned i, MaybeCheckAliasing checkAliasing)
|
||||
|
||||
template <class Op>
|
||||
inline void
|
||||
StackFrame::forEachUnaliasedActual(Op op)
|
||||
StackFrame::unaliasedForEachActual(Op op)
|
||||
{
|
||||
JS_ASSERT(!script()->funHasAnyAliasedFormal());
|
||||
JS_ASSERT(!script()->needsArgsObj());
|
||||
|
||||
const Value *argsEnd = argv() + numActualArgs();
|
||||
for (const Value *p = argv(); p < argsEnd; ++p)
|
||||
@ -325,17 +324,28 @@ InterpreterStack::popInlineFrame(FrameRegs ®s)
|
||||
|
||||
template <class Op>
|
||||
inline void
|
||||
ScriptFrameIter::ionForEachCanonicalActualArg(JSContext *cx, Op op)
|
||||
ScriptFrameIter::unaliasedForEachActual(JSContext *cx, Op op)
|
||||
{
|
||||
JS_ASSERT(isJit());
|
||||
switch (data_.state_) {
|
||||
case DONE:
|
||||
break;
|
||||
case SCRIPTED:
|
||||
interpFrame()->unaliasedForEachActual(op);
|
||||
return;
|
||||
case JIT:
|
||||
#ifdef JS_ION
|
||||
if (data_.ionFrames_.isOptimizedJS()) {
|
||||
ionInlineFrames_.forEachCanonicalActualArg(cx, op, jit::ReadFrame_Actuals);
|
||||
} else {
|
||||
JS_ASSERT(data_.ionFrames_.isBaselineJS());
|
||||
data_.ionFrames_.forEachCanonicalActualArg(op, jit::ReadFrame_Actuals);
|
||||
}
|
||||
if (data_.ionFrames_.isOptimizedJS()) {
|
||||
ionInlineFrames_.unaliasedForEachActual(cx, op, jit::ReadFrame_Actuals);
|
||||
} else {
|
||||
JS_ASSERT(data_.ionFrames_.isBaselineJS());
|
||||
data_.ionFrames_.unaliasedForEachActual(op, jit::ReadFrame_Actuals);
|
||||
}
|
||||
return;
|
||||
#else
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
MOZ_ASSUME_UNREACHABLE("Unexpected state");
|
||||
}
|
||||
|
||||
inline void *
|
||||
|
@ -215,6 +215,7 @@ class AbstractFramePtr
|
||||
inline Value &unaliasedLocal(uint32_t i, MaybeCheckAliasing checkAliasing = CHECK_ALIASING);
|
||||
inline Value &unaliasedFormal(unsigned i, MaybeCheckAliasing checkAliasing = CHECK_ALIASING);
|
||||
inline Value &unaliasedActual(unsigned i, MaybeCheckAliasing checkAliasing = CHECK_ALIASING);
|
||||
template <class Op> inline void unaliasedForEachActual(JSContext *cx, Op op);
|
||||
|
||||
inline bool prevUpToDate() const;
|
||||
inline void setPrevUpToDate() const;
|
||||
@ -530,18 +531,13 @@ class StackFrame
|
||||
bool hasArgs() const { return isNonEvalFunctionFrame(); }
|
||||
inline Value &unaliasedFormal(unsigned i, MaybeCheckAliasing = CHECK_ALIASING);
|
||||
inline Value &unaliasedActual(unsigned i, MaybeCheckAliasing = CHECK_ALIASING);
|
||||
template <class Op> inline void forEachUnaliasedActual(Op op);
|
||||
template <class Op> inline void unaliasedForEachActual(Op op);
|
||||
|
||||
bool copyRawFrameSlots(AutoValueVector *v);
|
||||
|
||||
unsigned numFormalArgs() const { JS_ASSERT(hasArgs()); return fun()->nargs(); }
|
||||
unsigned numActualArgs() const { JS_ASSERT(hasArgs()); return u.nactual; }
|
||||
|
||||
inline Value &canonicalActualArg(unsigned i) const;
|
||||
template <class Op>
|
||||
inline bool forEachCanonicalActualArg(Op op, unsigned start = 0, unsigned count = unsigned(-1));
|
||||
template <class Op> inline bool forEachFormalArg(Op op);
|
||||
|
||||
/*
|
||||
* Arguments object
|
||||
*
|
||||
@ -1566,6 +1562,7 @@ class ScriptFrameIter
|
||||
unsigned numActualArgs() const;
|
||||
unsigned numFormalArgs() const { return script()->functionNonDelazifying()->nargs(); }
|
||||
Value unaliasedActual(unsigned i, MaybeCheckAliasing = CHECK_ALIASING) const;
|
||||
template <class Op> inline void unaliasedForEachActual(JSContext *cx, Op op);
|
||||
|
||||
JSObject *scopeChain() const;
|
||||
CallObject &callObj() const;
|
||||
@ -1587,9 +1584,6 @@ class ScriptFrameIter
|
||||
// These are only valid for the top frame.
|
||||
size_t numFrameSlots() const;
|
||||
Value frameSlotValue(size_t index) const;
|
||||
|
||||
template <class Op>
|
||||
inline void ionForEachCanonicalActualArg(JSContext *cx, Op op);
|
||||
};
|
||||
|
||||
#ifdef DEBUG
|
||||
|
Loading…
Reference in New Issue
Block a user