Bug 1634435 - Rename AutoValueArray to RootedValueArray everywhere for consistency with other rooted things r=jandem,mccr8

Differential Revision: https://phabricator.services.mozilla.com/D73295
This commit is contained in:
Jon Coppeard 2020-05-04 16:50:59 +00:00
parent 7699bb2b02
commit f76ace3dcd
16 changed files with 30 additions and 30 deletions

View File

@ -18428,7 +18428,7 @@ class CGIterableMethodGenerator(CGGeneric):
cx.ThrowErrorMessage<MSG_NOT_CALLABLE>("Argument 1");
return false;
}
JS::AutoValueArray<3> callArgs(cx);
JS::RootedValueArray<3> callArgs(cx);
callArgs[2].setObject(*obj);
JS::Rooted<JS::Value> ignoredReturnVal(cx);
auto GetKeyAtIndex = &${selfType}::GetKeyAtIndex;

View File

@ -8,7 +8,7 @@
#include "nsIDOMEventListener.h"
#include "jsapi.h" // JS::AutoValueArray
#include "jsapi.h" // JS::RootedValueArray
#include "jsfriendapi.h"
#include "js/ArrayBuffer.h" // JS::Is{,Detached}ArrayBufferObject
#include "js/GCPolicyAPI.h"

View File

@ -34,9 +34,9 @@ struct ValueArray {
void trace(JSTracer* trc) { js::TraceValueArray(trc, N, elements); }
};
/** AutoValueArray roots an internal fixed-size array of Values. */
/** RootedValueArray roots an internal fixed-size array of Values. */
template <size_t N>
using AutoValueArray = Rooted<ValueArray<N>>;
using RootedValueArray = Rooted<ValueArray<N>>;
/**
* A generic handle to an array of rooted values.
@ -59,7 +59,7 @@ class HandleValueArray {
: length_(values.length()), elements_(values.begin()) {}
template <size_t N>
MOZ_IMPLICIT HandleValueArray(const AutoValueArray<N>& values)
MOZ_IMPLICIT HandleValueArray(const RootedValueArray<N>& values)
: length_(N), elements_(values.begin()) {}
/** CallArgs must already be rooted somewhere up the stack. */

View File

@ -3649,7 +3649,7 @@ JSObject* js::ArraySliceDense(JSContext* cx, HandleObject obj, int32_t begin,
}
// Slower path if the JIT wasn't able to allocate an object inline.
JS::AutoValueArray<4> argv(cx);
JS::RootedValueArray<4> argv(cx);
argv[0].setUndefined();
argv[1].setObject(*obj);
argv[2].setInt32(begin);

View File

@ -36,8 +36,8 @@ using namespace js;
using namespace js::frontend;
using JS::AutoStableStringChars;
using JS::AutoValueArray;
using JS::CompileOptions;
using JS::RootedValueArray;
using mozilla::DebugOnly;
enum ASTType {
@ -269,7 +269,7 @@ enum class GeneratorStyle { None, ES6 };
* Bug 569487: generalize builder interface
*/
class NodeBuilder {
using CallbackArray = AutoValueArray<AST_LIMIT>;
using CallbackArray = RootedValueArray<AST_LIMIT>;
JSContext* cx;
frontend::Parser<frontend::FullParseHandler, char16_t>* parser;

View File

@ -158,7 +158,7 @@ void JSRuntime::finishPersistentRoots() {
JS_PUBLIC_API void js::TraceValueArray(JSTracer* trc, size_t length,
Value* elements) {
TraceRootRange(trc, length, elements, "JS::AutoValueArray");
TraceRootRange(trc, length, elements, "JS::RootedValueArray");
}
void AutoGCRooter::trace(JSTracer* trc) {

View File

@ -425,7 +425,7 @@ bool ArrayPopDense(JSContext* cx, HandleObject obj, MutableHandleValue rval) {
AutoDetectInvalidation adi(cx, rval);
JS::AutoValueArray<2> argv(cx);
JS::RootedValueArray<2> argv(cx);
argv[0].setUndefined();
argv[1].setObject(*obj);
if (!js::array_pop(cx, 0, argv.begin())) {
@ -462,7 +462,7 @@ bool ArrayPushDense(JSContext* cx, HandleArrayObject arr, HandleValue v,
++frame;
IonScript* ionScript = frame.ionScript();
JS::AutoValueArray<3> argv(cx);
JS::RootedValueArray<3> argv(cx);
AutoDetectInvalidation adi(cx, argv[0], ionScript);
argv[0].setUndefined();
argv[1].setObject(*arr);
@ -491,7 +491,7 @@ bool ArrayShiftDense(JSContext* cx, HandleObject obj, MutableHandleValue rval) {
AutoDetectInvalidation adi(cx, rval);
JS::AutoValueArray<2> argv(cx);
JS::RootedValueArray<2> argv(cx);
argv[0].setUndefined();
argv[1].setObject(*obj);
if (!js::array_shift(cx, 0, argv.begin())) {
@ -510,7 +510,7 @@ bool ArrayShiftDense(JSContext* cx, HandleObject obj, MutableHandleValue rval) {
}
JSString* ArrayJoin(JSContext* cx, HandleObject array, HandleString sep) {
JS::AutoValueArray<3> argv(cx);
JS::RootedValueArray<3> argv(cx);
argv[0].setUndefined();
argv[1].setObject(*array);
argv[2].setString(sep);
@ -1467,7 +1467,7 @@ bool CallNativeGetter(JSContext* cx, HandleFunction callee, HandleObject obj,
MOZ_ASSERT(callee->isNative());
JSNative natfun = callee->native();
JS::AutoValueArray<2> vp(cx);
JS::RootedValueArray<2> vp(cx);
vp[0].setObject(*callee.get());
vp[1].setObject(*obj.get());
@ -1486,7 +1486,7 @@ bool CallNativeGetterByValue(JSContext* cx, HandleFunction callee,
MOZ_ASSERT(callee->isNative());
JSNative natfun = callee->native();
JS::AutoValueArray<2> vp(cx);
JS::RootedValueArray<2> vp(cx);
vp[0].setObject(*callee.get());
vp[1].set(receiver);
@ -1505,7 +1505,7 @@ bool CallNativeSetter(JSContext* cx, HandleFunction callee, HandleObject obj,
MOZ_ASSERT(callee->isNative());
JSNative natfun = callee->native();
JS::AutoValueArray<3> vp(cx);
JS::RootedValueArray<3> vp(cx);
vp[0].setObject(*callee.get());
vp[1].setObject(*obj.get());
vp[2].set(rhs);

View File

@ -62,7 +62,7 @@ bool ExhaustiveTest(const char funcode[]) {
Rooted<ArgumentsObject*> argsobj(cx,
&v.toObjectOrNull()->as<ArgumentsObject>());
JS::AutoValueArray<MAX_ELEMS> elems(cx);
JS::RootedValueArray<MAX_ELEMS> elems(cx);
for (size_t i = 0; i <= ArgCount; i++) {
for (size_t j = 0; j <= ArgCount - i; j++) {
@ -82,7 +82,7 @@ bool ExhaustiveTest(const char funcode[]) {
}
template <size_t N>
static void ClearElements(JS::AutoValueArray<N>& elems) {
static void ClearElements(JS::RootedValueArray<N>& elems) {
for (size_t i = 0; i < elems.length() - 1; i++) {
elems[i].setNull();
}

View File

@ -265,7 +265,7 @@ BEGIN_TEST(testArrayBuffer_serializeExternal) {
JS::NewArrayObject(cx, JS::HandleValueArray(v)));
CHECK(transferMap);
JS::AutoValueArray<2> args(cx);
JS::RootedValueArray<2> args(cx);
args[0].setObject(*externalBuffer);
args[1].setObject(*transferMap);

View File

@ -18,7 +18,7 @@ BEGIN_TEST(testDifferentNewTargetInvokeConstructor) {
"Error('whoops'); })",
&func);
JS::AutoValueArray<1> args(cx);
JS::RootedValueArray<1> args(cx);
args[0].set(otherFunc);
JS::RootedObject obj(cx);

View File

@ -14,7 +14,7 @@ BEGIN_TEST(testNewTargetInvokeConstructor) {
"Error('whoops'); })",
&func);
JS::AutoValueArray<1> args(cx);
JS::RootedValueArray<1> args(cx);
args[0].set(func);
JS::RootedObject obj(cx);

View File

@ -1059,7 +1059,7 @@ static MOZ_MUST_USE bool RunModule(JSContext* cx, const char* filename,
return false;
}
JS::AutoValueArray<1> args(cx);
JS::RootedValueArray<1> args(cx);
args[0].setString(path);
RootedValue value(cx);
@ -5139,7 +5139,7 @@ static JSObject* ShellModuleResolveHook(JSContext* cx,
}
MOZ_ASSERT(hookValue.toObject().is<JSFunction>());
JS::AutoValueArray<2> args(cx);
JS::RootedValueArray<2> args(cx);
args[0].set(referencingPrivate);
args[1].setString(specifier);
@ -5186,7 +5186,7 @@ static bool CallModuleMetadataHook(JSContext* cx, HandleValue modulePrivate,
}
MOZ_ASSERT(hookValue.toObject().is<JSFunction>());
JS::AutoValueArray<2> args(cx);
JS::RootedValueArray<2> args(cx);
args[0].set(modulePrivate);
args[1].setObject(*metaObject);
@ -5306,7 +5306,7 @@ static bool ShellModuleDynamicImportHook(JSContext* cx,
}
MOZ_ASSERT(hookValue.toObject().is<JSFunction>());
JS::AutoValueArray<3> args(cx);
JS::RootedValueArray<3> args(cx);
args[0].set(referencingPrivate);
args[1].setString(specifier);
args[2].setObject(*promise);

View File

@ -892,7 +892,7 @@ class FixedArgsBase
static_assert(N <= ARGS_LENGTH_MAX, "o/~ too many args o/~");
protected:
JS::AutoValueArray<2 + N + uint32_t(Construct)> v_;
JS::RootedValueArray<2 + N + uint32_t(Construct)> v_;
explicit FixedArgsBase(JSContext* cx) : v_(cx) {
*static_cast<JS::CallArgs*>(this) = CallArgsFromVp(N, v_.begin());

View File

@ -58,7 +58,7 @@ void FontFaceSetIterator::Next(JSContext* aCx,
}
if (mIsKeyAndValue) {
JS::AutoValueArray<2> values(aCx);
JS::RootedValueArray<2> values(aCx);
values[0].set(value);
values[1].set(value);

View File

@ -837,7 +837,7 @@ nsresult ProxyAutoConfig::GetProxyForURI(const nsCString& aTestURI,
JS::RootedString hostString(cx, JS_NewStringCopyZ(cx, aTestHost.get()));
if (uriString && hostString) {
JS::AutoValueArray<2> args(cx);
JS::RootedValueArray<2> args(cx);
args[0].setString(uriString);
args[1].setString(hostString);

View File

@ -103,7 +103,7 @@ void TelemetryIOInterposeObserver::Observe(Observation& aOb) {
bool TelemetryIOInterposeObserver::ReflectFileStats(FileIOEntryType* entry,
JSContext* cx,
JS::Handle<JSObject*> obj) {
JS::AutoValueArray<NUM_STAGES> stages(cx);
JS::RootedValueArray<NUM_STAGES> stages(cx);
FileStatsByStage& statsByStage = *entry->GetModifiableData();
for (int s = STAGE_STARTUP; s < NUM_STAGES; ++s) {
@ -118,7 +118,7 @@ bool TelemetryIOInterposeObserver::ReflectFileStats(FileIOEntryType* entry,
}
// Array we want to report
JS::AutoValueArray<6> stats(cx);
JS::RootedValueArray<6> stats(cx);
stats[0].setNumber(fileStats.totalTime);
stats[1].setNumber(fileStats.creates);
stats[2].setNumber(fileStats.reads);