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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user