зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1259877 - Eliminate Invoke(JSContext*, const CallArgs&, MaybeConstruct = NO_CONSTRUCT) by 1) renaming it to a more-internal name, 2) adding an Invoke overload for existing InvokeArgs providers only, and 3) adding an InternalInvoke function to temporarily mark non-InvokeArgs places using the existing signature that will later be changed not to. r=efaust
--HG-- extra : rebase_source : a5807c1c0c1685b6cfb8306fa82e1e430ce8e2b4
This commit is contained in:
Родитель
f5360f52f0
Коммит
525e0715b0
|
@ -7581,7 +7581,7 @@ HandleDynamicLinkFailure(JSContext* cx, const CallArgs& args, AsmJSModule& modul
|
|||
|
||||
// Call the function we just recompiled.
|
||||
args.setCallee(ObjectValue(*fun));
|
||||
return Invoke(cx, args, args.isConstructing() ? CONSTRUCT : NO_CONSTRUCT);
|
||||
return InternalCallOrConstruct(cx, args, args.isConstructing() ? CONSTRUCT : NO_CONSTRUCT);
|
||||
}
|
||||
|
||||
static WasmModuleObject*
|
||||
|
|
|
@ -6113,7 +6113,7 @@ DoCallFallback(JSContext* cx, BaselineFrame* frame, ICCall_Fallback* stub_, uint
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!Invoke(cx, callArgs))
|
||||
if (!InternalInvoke(cx, callArgs))
|
||||
return false;
|
||||
|
||||
res.set(callArgs.rval());
|
||||
|
|
|
@ -1163,7 +1163,7 @@ js::fun_call(JSContext* cx, unsigned argc, Value* vp)
|
|||
args = CallArgsFromVp(args.length() - 1, vp);
|
||||
}
|
||||
|
||||
return Invoke(cx, args);
|
||||
return InternalInvoke(cx, args);
|
||||
}
|
||||
|
||||
// ES5 15.3.4.3
|
||||
|
|
|
@ -843,7 +843,7 @@ class FastInvokeGuard
|
|||
}
|
||||
}
|
||||
|
||||
return Invoke(cx, args_);
|
||||
return InternalCallOrConstruct(cx, args_, NO_CONSTRUCT);
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
@ -441,9 +441,13 @@ struct AutoGCIfRequested
|
|||
* under argc arguments on cx's stack, and call the function. Push missing
|
||||
* required arguments, allocate declared local variables, and pop everything
|
||||
* when done. Then push the return value.
|
||||
*
|
||||
* Note: This function DOES NOT call GetThisValue to munge |args.thisv()| if
|
||||
* necessary. The caller (usually the interpreter) must have performed
|
||||
* this step already!
|
||||
*/
|
||||
bool
|
||||
js::Invoke(JSContext* cx, const CallArgs& args, MaybeConstruct construct)
|
||||
js::InternalCallOrConstruct(JSContext* cx, const CallArgs& args, MaybeConstruct construct)
|
||||
{
|
||||
MOZ_ASSERT(args.length() <= ARGS_LENGTH_MAX);
|
||||
MOZ_ASSERT(!cx->zone()->types.activeAnalysis);
|
||||
|
@ -525,7 +529,7 @@ js::Invoke(JSContext* cx, const Value& thisv, const Value& fval, unsigned argc,
|
|||
}
|
||||
}
|
||||
|
||||
if (!Invoke(cx, args))
|
||||
if (!InternalCallOrConstruct(cx, args, NO_CONSTRUCT))
|
||||
return false;
|
||||
|
||||
rval.set(args.rval());
|
||||
|
@ -552,7 +556,7 @@ InternalConstruct(JSContext* cx, const AnyConstructArgs& args)
|
|||
if (fun->isNative())
|
||||
return CallJSNativeConstructor(cx, fun->native(), args);
|
||||
|
||||
if (!Invoke(cx, args, CONSTRUCT))
|
||||
if (!InternalCallOrConstruct(cx, args, CONSTRUCT))
|
||||
return false;
|
||||
|
||||
MOZ_ASSERT(args.CallArgs::rval().isObject());
|
||||
|
@ -2724,7 +2728,7 @@ CASE(JSOP_STRICTEVAL)
|
|||
if (!DirectEval(cx, args.get(0), args.rval()))
|
||||
goto error;
|
||||
} else {
|
||||
if (!Invoke(cx, args))
|
||||
if (!InternalInvoke(cx, args))
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
@ -2806,7 +2810,7 @@ CASE(JSOP_FUNCALL)
|
|||
ReportValueError(cx, JSMSG_NOT_ITERABLE, -1, args.thisv(), nullptr);
|
||||
goto error;
|
||||
}
|
||||
if (!Invoke(cx, args))
|
||||
if (!InternalInvoke(cx, args))
|
||||
goto error;
|
||||
}
|
||||
Value* newsp = args.spAfterCall();
|
||||
|
|
|
@ -54,16 +54,39 @@ ValueToCallable(JSContext* cx, HandleValue v, int numToSkip = -1,
|
|||
MaybeConstruct construct = NO_CONSTRUCT);
|
||||
|
||||
/*
|
||||
* Invoke assumes that the given args have been pushed on the top of the
|
||||
* VM stack.
|
||||
* Call or construct arguments that are stored in rooted memory.
|
||||
*
|
||||
* NOTE: Any necessary |GetThisValue| computation must have been performed on
|
||||
* |args.thisv()|, likely by the interpreter when pushing |this| onto the
|
||||
* stack. If you're not sure whether |GetThisValue| processing has been
|
||||
* performed, use |Invoke|.
|
||||
*/
|
||||
extern bool
|
||||
Invoke(JSContext* cx, const CallArgs& args, MaybeConstruct construct = NO_CONSTRUCT);
|
||||
InternalCallOrConstruct(JSContext* cx, const CallArgs& args,
|
||||
MaybeConstruct construct);
|
||||
|
||||
/* A call operation that'll be rewritten later in this patch stack. */
|
||||
inline bool
|
||||
Invoke(JSContext* cx, const AnyInvokeArgs& args)
|
||||
{
|
||||
return InternalCallOrConstruct(cx, args, NO_CONSTRUCT);
|
||||
}
|
||||
|
||||
/*
|
||||
* This Invoke overload places the least requirements on the caller: it may be
|
||||
* called at any time and it takes care of copying the given callee, this, and
|
||||
* arguments onto the stack.
|
||||
* Similar to InternalCallOrConstruct, but for use in places that really
|
||||
* shouldn't use such an internal method directly (and won't, later in this
|
||||
* patch stack).
|
||||
*/
|
||||
inline bool
|
||||
InternalInvoke(JSContext* cx, const CallArgs& args)
|
||||
{
|
||||
return InternalCallOrConstruct(cx, args, NO_CONSTRUCT);
|
||||
}
|
||||
|
||||
/*
|
||||
* Attempt to call a value with the provided |this| and arguments. This
|
||||
* function places no requirements on the caller: it may be called at any time,
|
||||
* and it takes care of copying |fval|, |thisv|, and arguments onto the stack.
|
||||
*/
|
||||
extern bool
|
||||
Invoke(JSContext* cx, const Value& thisv, const Value& fval, unsigned argc, const Value* argv,
|
||||
|
|
Загрузка…
Ссылка в новой задаче