mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 697322 - Add easier to use reset method to CallReceiver; r=luke
All users of InvokeArgsGuard that use calleeHasBeenReset use it before setting a new callee/this in a loop. We should make it easier to use by combining the reset with the setup with the setting of the new callee.
This commit is contained in:
parent
f5d3051a32
commit
cf9f5a30ad
@ -2151,8 +2151,7 @@ sort_compare(void *arg, const void *a, const void *b, int *result)
|
||||
if (!ag.pushed() && !cx->stack.pushInvokeArgs(cx, 2, &ag))
|
||||
return JS_FALSE;
|
||||
|
||||
ag.calleeHasBeenReset();
|
||||
ag.calleev() = ca->fval;
|
||||
ag.setCallee(ca->fval);
|
||||
ag.thisv() = UndefinedValue();
|
||||
ag[0] = *av;
|
||||
ag[1] = *bv;
|
||||
@ -3360,8 +3359,7 @@ array_readonlyCommon(JSContext *cx, CallArgs &args)
|
||||
if (!kNotPresent) {
|
||||
if (!ag.pushed() && !cx->stack.pushInvokeArgs(cx, 3, &ag))
|
||||
return false;
|
||||
ag.calleeHasBeenReset();
|
||||
ag.calleev() = ObjectValue(*callable);
|
||||
ag.setCallee(ObjectValue(*callable));
|
||||
ag.thisv() = thisv;
|
||||
ag[0] = kValue;
|
||||
ag[1] = NumberValue(k);
|
||||
@ -3462,8 +3460,7 @@ array_map(JSContext *cx, uintN argc, Value *vp)
|
||||
if (!kNotPresent) {
|
||||
if (!ag.pushed() && !cx->stack.pushInvokeArgs(cx, 3, &ag))
|
||||
return false;
|
||||
ag.calleeHasBeenReset();
|
||||
ag.calleev() = ObjectValue(*callable);
|
||||
ag.setCallee(ObjectValue(*callable));
|
||||
ag.thisv() = thisv;
|
||||
ag[0] = kValue;
|
||||
ag[1] = NumberValue(k);
|
||||
@ -3542,8 +3539,7 @@ array_filter(JSContext *cx, uintN argc, Value *vp)
|
||||
if (!kNotPresent) {
|
||||
if (!ag.pushed() && !cx->stack.pushInvokeArgs(cx, 3, &ag))
|
||||
return false;
|
||||
ag.calleeHasBeenReset();
|
||||
ag.calleev() = ObjectValue(*callable);
|
||||
ag.setCallee(ObjectValue(*callable));
|
||||
ag.thisv() = thisv;
|
||||
ag[0] = kValue;
|
||||
ag[1] = NumberValue(k);
|
||||
@ -3661,8 +3657,7 @@ array_reduceCommon(JSContext *cx, CallArgs &args)
|
||||
if (!kNotPresent) {
|
||||
if (!ag.pushed() && !cx->stack.pushInvokeArgs(cx, 4, &ag))
|
||||
return false;
|
||||
ag.calleeHasBeenReset();
|
||||
ag.calleev() = ObjectValue(*callable);
|
||||
ag.setCallee(ObjectValue(*callable));
|
||||
ag.thisv() = UndefinedValue();
|
||||
ag[0] = accumulator;
|
||||
ag[1] = kValue;
|
||||
|
@ -1791,8 +1791,7 @@ FindReplaceLength(JSContext *cx, RegExpStatics *res, ReplaceData &rdata, size_t
|
||||
if (!args.pushed() && !cx->stack.pushInvokeArgs(cx, argc, &args))
|
||||
return false;
|
||||
|
||||
args.calleeHasBeenReset();
|
||||
args.calleev() = ObjectValue(*lambda);
|
||||
args.setCallee(ObjectValue(*lambda));
|
||||
args.thisv() = UndefinedValue();
|
||||
|
||||
/* Push $&, $1, $2, ... */
|
||||
|
@ -208,8 +208,9 @@ class CallReceiver
|
||||
return argv_ - 1;
|
||||
}
|
||||
|
||||
void calleeHasBeenReset() const {
|
||||
void setCallee(Value calleev) {
|
||||
clearUsedRval();
|
||||
this->calleev() = calleev;
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user