forked from mirrors/gecko-dev
Bug 981053: Always pass CallArgs by reference. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D204745
This commit is contained in:
parent
38c0d95f10
commit
04ffa03589
9 changed files with 23 additions and 19 deletions
|
|
@ -112,7 +112,7 @@ class MOZ_STACK_CLASS NoUsedRval {
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class WantUsedRval>
|
template <class WantUsedRval>
|
||||||
class MOZ_STACK_CLASS CallArgsBase {
|
class MOZ_STACK_CLASS MOZ_NON_PARAM CallArgsBase {
|
||||||
static_assert(std::is_same_v<WantUsedRval, IncludeUsedRval> ||
|
static_assert(std::is_same_v<WantUsedRval, IncludeUsedRval> ||
|
||||||
std::is_same_v<WantUsedRval, NoUsedRval>,
|
std::is_same_v<WantUsedRval, NoUsedRval>,
|
||||||
"WantUsedRval can only be IncludeUsedRval or NoUsedRval");
|
"WantUsedRval can only be IncludeUsedRval or NoUsedRval");
|
||||||
|
|
@ -294,7 +294,7 @@ class MOZ_STACK_CLASS CallArgsBase {
|
||||||
|
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
|
||||||
class MOZ_STACK_CLASS CallArgs
|
class MOZ_STACK_CLASS MOZ_NON_PARAM CallArgs
|
||||||
: public detail::CallArgsBase<detail::IncludeUsedRval> {
|
: public detail::CallArgsBase<detail::IncludeUsedRval> {
|
||||||
private:
|
private:
|
||||||
friend CallArgs CallArgsFromVp(unsigned argc, Value* vp);
|
friend CallArgs CallArgsFromVp(unsigned argc, Value* vp);
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ extern JS_PUBLIC_API bool CallMethodIfWrapped(JSContext* cx,
|
||||||
// its interface is the same as that of JSNative.
|
// its interface is the same as that of JSNative.
|
||||||
//
|
//
|
||||||
// static bool
|
// static bool
|
||||||
// answer_getAnswer_impl(JSContext* cx, JS::CallArgs args)
|
// answer_getAnswer_impl(JSContext* cx, const JS::CallArgs& args)
|
||||||
// {
|
// {
|
||||||
// args.rval().setInt32(42);
|
// args.rval().setInt32(42);
|
||||||
// return true;
|
// return true;
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@
|
||||||
#define js_experimental_JitInfo_h
|
#define js_experimental_JitInfo_h
|
||||||
|
|
||||||
#include "mozilla/Assertions.h" // MOZ_ASSERT
|
#include "mozilla/Assertions.h" // MOZ_ASSERT
|
||||||
|
#include "mozilla/Attributes.h" // MOZ_NON_PARAM
|
||||||
|
|
||||||
#include <stddef.h> // size_t
|
#include <stddef.h> // size_t
|
||||||
#include <stdint.h> // uint16_t, uint32_t
|
#include <stdint.h> // uint16_t, uint32_t
|
||||||
|
|
@ -72,7 +73,7 @@ struct JSJitMethodCallArgsTraits;
|
||||||
* A class, expected to be passed by reference, which represents the CallArgs
|
* A class, expected to be passed by reference, which represents the CallArgs
|
||||||
* for a JSJitMethodOp.
|
* for a JSJitMethodOp.
|
||||||
*/
|
*/
|
||||||
class JSJitMethodCallArgs
|
class MOZ_NON_PARAM JSJitMethodCallArgs
|
||||||
: protected JS::detail::CallArgsBase<JS::detail::NoUsedRval> {
|
: protected JS::detail::CallArgsBase<JS::detail::NoUsedRval> {
|
||||||
private:
|
private:
|
||||||
using Base = JS::detail::CallArgsBase<JS::detail::NoUsedRval>;
|
using Base = JS::detail::CallArgsBase<JS::detail::NoUsedRval>;
|
||||||
|
|
|
||||||
|
|
@ -1602,7 +1602,8 @@ JS_PUBLIC_API bool JS::ToPrimitive(JSContext* cx, HandleObject obj, JSType hint,
|
||||||
return ToPrimitiveSlow(cx, hint, vp);
|
return ToPrimitiveSlow(cx, hint, vp);
|
||||||
}
|
}
|
||||||
|
|
||||||
JS_PUBLIC_API bool JS::GetFirstArgumentAsTypeHint(JSContext* cx, CallArgs args,
|
JS_PUBLIC_API bool JS::GetFirstArgumentAsTypeHint(JSContext* cx,
|
||||||
|
const CallArgs& args,
|
||||||
JSType* result) {
|
JSType* result) {
|
||||||
if (!args.get(0).isString()) {
|
if (!args.get(0).isString()) {
|
||||||
JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr,
|
JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr,
|
||||||
|
|
|
||||||
|
|
@ -303,7 +303,7 @@ extern JS_PUBLIC_API bool ToPrimitive(JSContext* cx, JS::HandleObject obj,
|
||||||
* This can be useful in implementing a @@toPrimitive method.
|
* This can be useful in implementing a @@toPrimitive method.
|
||||||
*/
|
*/
|
||||||
extern JS_PUBLIC_API bool GetFirstArgumentAsTypeHint(JSContext* cx,
|
extern JS_PUBLIC_API bool GetFirstArgumentAsTypeHint(JSContext* cx,
|
||||||
CallArgs args,
|
const CallArgs& args,
|
||||||
JSType* result);
|
JSType* result);
|
||||||
|
|
||||||
} /* namespace JS */
|
} /* namespace JS */
|
||||||
|
|
|
||||||
|
|
@ -6914,8 +6914,8 @@ static bool GetImports(JSContext* cx, const AsmJSMetadata& metadata,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool TryInstantiate(JSContext* cx, CallArgs args, const Module& module,
|
static bool TryInstantiate(JSContext* cx, const CallArgs& args,
|
||||||
const AsmJSMetadata& metadata,
|
const Module& module, const AsmJSMetadata& metadata,
|
||||||
MutableHandle<WasmInstanceObject*> instanceObj,
|
MutableHandle<WasmInstanceObject*> instanceObj,
|
||||||
MutableHandleObject exportObj) {
|
MutableHandleObject exportObj) {
|
||||||
HandleValue globalVal = args.get(0);
|
HandleValue globalVal = args.get(0);
|
||||||
|
|
@ -6956,7 +6956,7 @@ static bool TryInstantiate(JSContext* cx, CallArgs args, const Module& module,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool HandleInstantiationFailure(JSContext* cx, CallArgs args,
|
static bool HandleInstantiationFailure(JSContext* cx, const CallArgs& args,
|
||||||
const AsmJSMetadata& metadata) {
|
const AsmJSMetadata& metadata) {
|
||||||
using js::frontend::FunctionSyntaxKind;
|
using js::frontend::FunctionSyntaxKind;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2938,7 +2938,8 @@ static bool EnsureEntryStubs(const Instance& instance, uint32_t funcIndex,
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool GetInterpEntryAndEnsureStubs(JSContext* cx, Instance& instance,
|
static bool GetInterpEntryAndEnsureStubs(JSContext* cx, Instance& instance,
|
||||||
uint32_t funcIndex, CallArgs args,
|
uint32_t funcIndex,
|
||||||
|
const CallArgs& args,
|
||||||
void** interpEntry,
|
void** interpEntry,
|
||||||
const FuncType** funcType) {
|
const FuncType** funcType) {
|
||||||
const FuncExport* funcExport;
|
const FuncExport* funcExport;
|
||||||
|
|
@ -3100,8 +3101,8 @@ class MOZ_RAII ReturnToJSResultCollector {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
bool Instance::callExport(JSContext* cx, uint32_t funcIndex, CallArgs args,
|
bool Instance::callExport(JSContext* cx, uint32_t funcIndex,
|
||||||
CoercionLevel level) {
|
const CallArgs& args, CoercionLevel level) {
|
||||||
if (memory0Base_) {
|
if (memory0Base_) {
|
||||||
// If there has been a moving grow, this Instance should have been notified.
|
// If there has been a moving grow, this Instance should have been notified.
|
||||||
MOZ_RELEASE_ASSERT(memoryBase(0).unwrap() == memory0Base_);
|
MOZ_RELEASE_ASSERT(memoryBase(0).unwrap() == memory0Base_);
|
||||||
|
|
|
||||||
|
|
@ -364,7 +364,7 @@ class alignas(16) Instance {
|
||||||
// value in args.rval.
|
// value in args.rval.
|
||||||
|
|
||||||
[[nodiscard]] bool callExport(JSContext* cx, uint32_t funcIndex,
|
[[nodiscard]] bool callExport(JSContext* cx, uint32_t funcIndex,
|
||||||
CallArgs args,
|
const CallArgs& args,
|
||||||
CoercionLevel level = CoercionLevel::Spec);
|
CoercionLevel level = CoercionLevel::Spec);
|
||||||
|
|
||||||
// Exception handling support
|
// Exception handling support
|
||||||
|
|
|
||||||
|
|
@ -1005,8 +1005,9 @@ static bool IsModuleObject(JSObject* obj, const Module** module) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool GetModuleArg(JSContext* cx, CallArgs args, uint32_t numRequired,
|
static bool GetModuleArg(JSContext* cx, const CallArgs& args,
|
||||||
const char* name, const Module** module) {
|
uint32_t numRequired, const char* name,
|
||||||
|
const Module** module) {
|
||||||
if (!args.requireAtLeast(cx, name, numRequired)) {
|
if (!args.requireAtLeast(cx, name, numRequired)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -4499,8 +4500,8 @@ static bool EnsurePromiseSupport(JSContext* cx) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool GetBufferSource(JSContext* cx, CallArgs callArgs, const char* name,
|
static bool GetBufferSource(JSContext* cx, const CallArgs& callArgs,
|
||||||
MutableBytes* bytecode) {
|
const char* name, MutableBytes* bytecode) {
|
||||||
if (!callArgs.requireAtLeast(cx, name, 1)) {
|
if (!callArgs.requireAtLeast(cx, name, 1)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -4561,7 +4562,7 @@ static bool WebAssembly_compile(JSContext* cx, unsigned argc, Value* vp) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool GetInstantiateArgs(JSContext* cx, CallArgs callArgs,
|
static bool GetInstantiateArgs(JSContext* cx, const CallArgs& callArgs,
|
||||||
MutableHandleObject firstArg,
|
MutableHandleObject firstArg,
|
||||||
MutableHandleObject importObj,
|
MutableHandleObject importObj,
|
||||||
MutableHandleValue featureOptions) {
|
MutableHandleValue featureOptions) {
|
||||||
|
|
@ -5074,7 +5075,7 @@ const JSClass ResolveResponseClosure::class_ = {
|
||||||
&ResolveResponseClosure::classOps_,
|
&ResolveResponseClosure::classOps_,
|
||||||
};
|
};
|
||||||
|
|
||||||
static ResolveResponseClosure* ToResolveResponseClosure(CallArgs args) {
|
static ResolveResponseClosure* ToResolveResponseClosure(const CallArgs& args) {
|
||||||
return &args.callee()
|
return &args.callee()
|
||||||
.as<JSFunction>()
|
.as<JSFunction>()
|
||||||
.getExtendedSlot(0)
|
.getExtendedSlot(0)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue