Bug 1848325 - Part 1: Rename CommonPropertyNames empty to empty_. r=jandem

Differential Revision: https://phabricator.services.mozilla.com/D186288
This commit is contained in:
Tooru Fujisawa 2023-08-16 13:04:09 +00:00
Родитель f8a47abf20
Коммит 6298245c02
26 изменённых файлов: 46 добавлений и 46 удалений

Просмотреть файл

@ -1265,7 +1265,7 @@ bool js::array_join(JSContext* cx, unsigned argc, Value* vp) {
}
if (detector.foundCycle()) {
args.rval().setString(cx->names().empty);
args.rval().setString(cx->names().empty_);
return true;
}
@ -1392,7 +1392,7 @@ static bool array_toLocaleString(JSContext* cx, unsigned argc, Value* vp) {
// Avoid calling into self-hosted code if the array is empty.
if (obj->is<ArrayObject>() && obj->as<ArrayObject>().length() == 0) {
args.rval().setString(cx->names().empty);
args.rval().setString(cx->names().empty_);
return true;
}
@ -1402,7 +1402,7 @@ static bool array_toLocaleString(JSContext* cx, unsigned argc, Value* vp) {
}
if (detector.foundCycle()) {
args.rval().setString(cx->names().empty);
args.rval().setString(cx->names().empty_);
return true;
}

Просмотреть файл

@ -662,7 +662,7 @@ FinalizationQueueObject* FinalizationQueueObject::create(
return nullptr;
}
Handle<PropertyName*> funName = cx->names().empty;
Handle<PropertyName*> funName = cx->names().empty_;
RootedFunction doCleanupFunction(
cx, NewNativeFunction(cx, doCleanup, 0, funName,
gc::AllocKind::FUNCTION_EXTENDED));

Просмотреть файл

@ -41,7 +41,7 @@ static_assert(HandlerFunctionSlot_Extra < FunctionExtended::NUM_EXTENDED_SLOTS,
JS::Handle<JSObject*> target) {
cx->check(target);
JS::Handle<PropertyName*> funName = cx->names().empty;
JS::Handle<PropertyName*> funName = cx->names().empty_;
JS::Rooted<JSFunction*> handlerFun(
cx, NewNativeFunction(cx, handler, 0, funName,
gc::AllocKind::FUNCTION_EXTENDED, GenericObject));

Просмотреть файл

@ -1611,7 +1611,7 @@ bool js::Stringify(JSContext* cx, MutableHandleValue vp, JSObject* replacer_,
}
Rooted<PlainObject*> wrapper(cx);
RootedId emptyId(cx, NameToId(cx->names().empty));
RootedId emptyId(cx, NameToId(cx->names().empty_));
if (replacer && replacer->isCallable()) {
// We can skip creating the initial wrapper object if no replacer
// function is present.
@ -1823,11 +1823,11 @@ static bool Revive(JSContext* cx, HandleValue reviver, MutableHandleValue vp) {
return false;
}
if (!DefineDataProperty(cx, obj, cx->names().empty, vp)) {
if (!DefineDataProperty(cx, obj, cx->names().empty_, vp)) {
return false;
}
Rooted<jsid> id(cx, NameToId(cx->names().empty));
Rooted<jsid> id(cx, NameToId(cx->names().empty_));
return Walk(cx, obj, id, reviver, vp);
}
@ -2054,7 +2054,7 @@ static bool json_parseImmutable(JSContext* cx, unsigned argc, Value* vp) {
}
}
RootedId id(cx, NameToId(cx->names().empty));
RootedId id(cx, NameToId(cx->names().empty_));
return BuildImmutableProperty(cx, unfiltered, id, reviver, args.rval());
}
#endif

Просмотреть файл

@ -1071,7 +1071,7 @@ void js::SetAlreadyResolvedPromiseWithDefaultResolvingFunction(
// Step 4. Let resolve be
// ! CreateBuiltinFunction(stepsResolve, lengthResolve, "",
// « [[Promise]], [[AlreadyResolved]] »).
Handle<PropertyName*> funName = cx->names().empty;
Handle<PropertyName*> funName = cx->names().empty_;
resolveFn.set(NewNativeFunction(cx, ResolvePromiseFunction, 1, funName,
gc::AllocKind::FUNCTION_EXTENDED,
GenericObject));
@ -1497,7 +1497,7 @@ static bool PromiseReactionJob(JSContext* cx, unsigned argc, Value* vp);
// Step 1. Let job be a new Job Abstract Closure with no parameters that
// captures reaction and argument and performs the following steps
// when called:
Handle<PropertyName*> funName = cx->names().empty;
Handle<PropertyName*> funName = cx->names().empty_;
RootedFunction job(
cx, NewNativeFunction(cx, PromiseReactionJob, 0, funName,
gc::AllocKind::FUNCTION_EXTENDED, GenericObject));
@ -1803,7 +1803,7 @@ CreatePromiseObjectWithoutResolutionFunctions(JSContext* cx) {
// Step 4. Let executorClosure be a new Abstract Closure with parameters
// (resolve, reject) that captures promiseCapability and performs the
// following steps when called:
Handle<PropertyName*> funName = cx->names().empty;
Handle<PropertyName*> funName = cx->names().empty_;
RootedFunction executor(
cx, NewNativeFunction(cx, GetCapabilitiesExecutor, 2, funName,
gc::AllocKind::FUNCTION_EXTENDED, GenericObject));
@ -2470,7 +2470,7 @@ static bool PromiseResolveBuiltinThenableJob(JSContext* cx, unsigned argc,
// Step 1. Let job be a new Job Abstract Closure with no parameters that
// captures promiseToResolve, thenable, and then and performs the
// following steps when called:
Handle<PropertyName*> funName = cx->names().empty;
Handle<PropertyName*> funName = cx->names().empty_;
RootedFunction job(
cx, NewNativeFunction(cx, PromiseResolveThenableJob, 0, funName,
gc::AllocKind::FUNCTION_EXTENDED, GenericObject));
@ -2531,7 +2531,7 @@ static bool PromiseResolveBuiltinThenableJob(JSContext* cx, unsigned argc,
// Step 1. Let job be a new Job Abstract Closure with no parameters that
// captures promiseToResolve, thenable, and then and performs the
// following steps when called:
Handle<PropertyName*> funName = cx->names().empty;
Handle<PropertyName*> funName = cx->names().empty_;
RootedFunction job(
cx, NewNativeFunction(cx, PromiseResolveBuiltinThenableJob, 0, funName,
gc::AllocKind::FUNCTION_EXTENDED, GenericObject));

Просмотреть файл

@ -1385,7 +1385,7 @@ class ASTSerializer {
DebugOnly<uint32_t> lineno;
Value unrootedAtomContents(JSAtom* atom) {
return StringValue(atom ? atom : cx->names().empty);
return StringValue(atom ? atom : cx->names().empty_);
}
BinaryOperator binop(ParseNodeKind kind);

Просмотреть файл

@ -409,7 +409,7 @@ static bool RegExpInitializeIgnoringLastIndex(JSContext* cx,
Rooted<JSAtom*> pattern(cx);
if (patternValue.isUndefined()) {
/* Step 1. */
pattern = cx->names().empty;
pattern = cx->names().empty_;
} else {
/* Step 2. */
pattern = ToAtom<CanGC>(cx, patternValue);

Просмотреть файл

@ -186,7 +186,7 @@ class TaggedParserAtomIndex {
#undef METHOD_
static constexpr TaggedParserAtomIndex empty() {
return TaggedParserAtomIndex(WellKnownAtomId::empty);
return TaggedParserAtomIndex(WellKnownAtomId::empty_);
}
};
@ -232,7 +232,7 @@ class TaggedParserAtomIndex {
#undef METHOD_
static constexpr uint32_t empty() {
return uint32_t(WellKnownAtomId::empty) | WellKnownTag | WellKnownSubTag;
return uint32_t(WellKnownAtomId::empty_) | WellKnownTag | WellKnownSubTag;
}
};

Просмотреть файл

@ -3644,7 +3644,7 @@ void frontend::DumpTaggedParserAtomIndex(js::JSONPrinter& json,
json.property("tag", "WellKnown");
auto index = taggedIndex.toWellKnownAtomId();
switch (index) {
case WellKnownAtomId::empty:
case WellKnownAtomId::empty_:
json.property("atom", "");
break;
@ -3722,7 +3722,7 @@ void frontend::DumpTaggedParserAtomIndexNoQuote(
if (taggedIndex.isWellKnownAtomId()) {
auto index = taggedIndex.toWellKnownAtomId();
switch (index) {
case WellKnownAtomId::empty:
case WellKnownAtomId::empty_:
out.put("#<zero-length name>");
break;

Просмотреть файл

@ -990,7 +990,7 @@ bool BaselineCacheIRCompiler::emitArrayJoinResult(ObjOperandId objId,
{
Label arrayNotEmpty;
masm.branch32(Assembler::NotEqual, lengthAddr, Imm32(0), &arrayNotEmpty);
masm.movePtr(ImmGCPtr(cx_->names().empty), scratch);
masm.movePtr(ImmGCPtr(cx_->names().empty_), scratch);
masm.tagValue(JSVAL_TYPE_STRING, scratch, output.valueReg());
masm.jump(&finished);
masm.bind(&arrayNotEmpty);
@ -1238,7 +1238,7 @@ bool BaselineCacheIRCompiler::emitLoadStringCharResult(StringOperandId strId,
allocator.discardStack(masm);
// Return the empty string for out-of-bounds access.
masm.movePtr(ImmGCPtr(cx_->names().empty), scratch2);
masm.movePtr(ImmGCPtr(cx_->names().empty_), scratch2);
// This CacheIR op is always preceded by |LinearizeForCharAccess|, so we're
// guaranteed to see no nested ropes.

Просмотреть файл

@ -3763,7 +3763,7 @@ bool CacheIRCompiler::emitLoadFunctionNameResult(ObjOperandId objId) {
return false;
}
masm.loadFunctionName(obj, scratch, ImmGCPtr(cx_->names().empty),
masm.loadFunctionName(obj, scratch, ImmGCPtr(cx_->names().empty_),
failure->label());
masm.tagValue(JSVAL_TYPE_STRING, scratch, output.valueReg());

Просмотреть файл

@ -2232,7 +2232,7 @@ void CreateDependentString::generate(MacroAssembler& masm,
// Zero length matches use the empty string.
masm.branchTest32(Assembler::NonZero, temp1_, temp1_, &nonEmpty);
masm.movePtr(ImmGCPtr(names.empty), string_);
masm.movePtr(ImmGCPtr(names.empty_), string_);
masm.jump(&done);
masm.bind(&nonEmpty);
@ -8564,7 +8564,7 @@ void CodeGenerator::visitFunctionName(LFunctionName* lir) {
Label bail;
const JSAtomState& names = gen->runtime->names();
masm.loadFunctionName(function, output, ImmGCPtr(names.empty), &bail);
masm.loadFunctionName(function, output, ImmGCPtr(names.empty_), &bail);
bailoutFrom(&bail, lir->snapshot());
}
@ -11618,7 +11618,7 @@ void CodeGenerator::visitSubstr(LSubstr* lir) {
// Zero length, return emptystring.
masm.branchTest32(Assembler::NonZero, length, length, &nonZero);
const JSAtomState& names = gen->runtime->names();
masm.movePtr(ImmGCPtr(names.empty), output);
masm.movePtr(ImmGCPtr(names.empty_), output);
masm.jump(done);
// Substring from 0..|str.length|, return str.
@ -12058,7 +12058,7 @@ void CodeGenerator::visitCharAtMaybeOutOfBounds(LCharAtMaybeOutOfBounds* lir) {
// Return the empty string for out-of-bounds access.
const JSAtomState& names = gen->runtime->names();
masm.movePtr(ImmGCPtr(names.empty), output);
masm.movePtr(ImmGCPtr(names.empty_), output);
masm.spectreBoundsCheck32(index, Address(str, JSString::offsetOfLength()),
temp0, oolFromCharCode->rejoin());
@ -13614,7 +13614,7 @@ void CodeGenerator::visitArrayJoin(LArrayJoin* lir) {
Label notEmpty;
masm.branch32(Assembler::NotEqual, length, Imm32(0), &notEmpty);
const JSAtomState& names = gen->runtime->names();
masm.movePtr(ImmGCPtr(names.empty), output);
masm.movePtr(ImmGCPtr(names.empty_), output);
masm.jump(&skipCall);
masm.bind(&notEmpty);

Просмотреть файл

@ -3121,7 +3121,7 @@ JS_PUBLIC_API JSString* JS_NewUCStringCopyN(JSContext* cx, const char16_t* s,
AssertHeapIsIdle();
CHECK_THREAD(cx);
if (!n) {
return cx->names().empty;
return cx->names().empty_;
}
return NewStringCopyN<CanGC>(cx, s, n);
}

Просмотреть файл

@ -2970,7 +2970,7 @@ JSString* DateTimeHelper::timeZoneComment(JSContext* cx,
// Reject if the result string is empty.
size_t len = js_strlen(timeZoneStart);
if (len == 0) {
return cx->names().empty;
return cx->names().empty_;
}
// Parenthesize the returned display name.
@ -3048,7 +3048,7 @@ JSString* DateTimeHelper::timeZoneComment(JSContext* cx,
}
}
return cx->names().empty;
return cx->names().empty_;
}
#endif /* JS_HAS_INTL_API */

Просмотреть файл

@ -1968,7 +1968,7 @@ static bool CreateUserArrayBuffer(JSContext* cx, unsigned argc, Value* vp) {
// The reference is made through a private name, because we don't want to
// expose |userBuffer| to user-code.
auto* privateName = NewPrivateName(cx, cx->names().empty.toHandle());
auto* privateName = NewPrivateName(cx, cx->names().empty_.toHandle());
if (!privateName) {
return false;
}
@ -8744,7 +8744,7 @@ static bool TransplantableObject(JSContext* cx, unsigned argc, Value* vp) {
}
}
jsid emptyId = NameToId(cx->names().empty);
jsid emptyId = NameToId(cx->names().empty_);
RootedObject transplant(
cx, NewFunctionByIdWithReserved(cx, TransplantObject, 0, 0, emptyId));
if (!transplant) {

Просмотреть файл

@ -122,7 +122,7 @@ JSLinearString* JSStringBuilder::finishString() {
size_t len = length();
if (len == 0) {
return maybeCx_->names().empty;
return maybeCx_->names().empty_;
}
if (MOZ_UNLIKELY(!JSString::validateLength(maybeCx_, len))) {
@ -143,7 +143,7 @@ JSAtom* StringBuffer::finishAtom() {
size_t len = length();
if (len == 0) {
return maybeCx_->names().empty;
return maybeCx_->names().empty_;
}
if (isLatin1()) {

Просмотреть файл

@ -264,7 +264,7 @@ JSFunction* NewHandler(JSContext* cx, Native handler,
JS::Handle<JSObject*> target) {
cx->check(target);
JS::Handle<PropertyName*> funName = cx->names().empty;
JS::Handle<PropertyName*> funName = cx->names().empty_;
JS::Rooted<JSFunction*> handlerFun(
cx, NewNativeFunction(cx, handler, 0, funName,
gc::AllocKind::FUNCTION_EXTENDED, GenericObject));

Просмотреть файл

@ -156,7 +156,7 @@
MACRO_(element, "element") \
MACRO_(elementType, "elementType") \
MACRO_(else_, "else") \
MACRO0(empty, "") \
MACRO0(empty_, "") \
MACRO_(emptyRegExp, "(?:)") \
MACRO_(encodeURI, "encodeURI") \
MACRO_(encodeURIComponent, "encodeURIComponent") \

Просмотреть файл

@ -72,7 +72,7 @@ PropertyName* js::EnvironmentCoordinateNameSlow(JSScript* script,
/* Beware nameless destructuring formal. */
if (!id.isAtom()) {
return script->runtimeFromAnyThread()->commonNames->empty;
return script->runtimeFromAnyThread()->commonNames->empty_;
}
return id.toAtom()->asPropertyName();
}

Просмотреть файл

@ -14,7 +14,7 @@
inline JSString* js::ErrorObject::fileName(JSContext* cx) const {
Value val = getReservedSlot(FILENAME_SLOT);
return val.isString() ? val.toString() : cx->names().empty;
return val.isString() ? val.toString() : cx->names().empty_;
}
inline uint32_t js::ErrorObject::sourceId() const {

Просмотреть файл

@ -96,7 +96,7 @@ JSObject* AbstractGeneratorObject::createModuleGenerator(
// Create a handler function to wrap the module's script. This way
// we can access it later and restore the state.
Handle<PropertyName*> funName = cx->names().empty;
Handle<PropertyName*> funName = cx->names().empty_;
RootedFunction handlerFun(
cx, NewFunctionWithProto(cx, nullptr, 0,
FunctionFlags::INTERPRETED_GENERATOR_OR_ASYNC,

Просмотреть файл

@ -271,7 +271,7 @@ bool JSRuntime::initializeAtoms(JSContext* cx) {
}
MOZ_ASSERT(uintptr_t(names) == uintptr_t(commonNames + 1));
emptyString = commonNames->empty;
emptyString = commonNames->empty_;
// The self-hosted atoms are those that exist in a self-hosted JS source file,
// but are not defined in any of the well-known atom collections.

Просмотреть файл

@ -117,7 +117,7 @@ inline JSAtom* JSFunction::infallibleGetUnresolvedName(JSContext* cx) {
return name;
}
return cx->names().empty;
return cx->names().empty_;
}
/* static */ inline bool JSFunction::getAllocKindForThis(

Просмотреть файл

@ -688,7 +688,7 @@ static JSObject* CreateFunctionPrototype(JSContext* cx, JSProtoKey key) {
return NewFunctionWithProto(
cx, FunctionPrototype, 0, FunctionFlags::NATIVE_FUN, nullptr,
Handle<PropertyName*>(cx->names().empty), objectProto,
Handle<PropertyName*>(cx->names().empty_), objectProto,
gc::AllocKind::FUNCTION, TenuredObject);
}
@ -1753,7 +1753,7 @@ static JSAtom* SymbolToFunctionName(JSContext* cx, JS::Symbol* symbol,
// Step 4.b, no prefix fastpath.
if (!desc && prefixKind == FunctionPrefixKind::None) {
return cx->names().empty;
return cx->names().empty_;
}
// Step 5 (reordered).

Просмотреть файл

@ -899,7 +899,7 @@ static void ThrowResolutionError(JSContext* cx, Handle<ModuleObject*> module,
filename =
JS_NewStringCopyUTF8Z(cx, JS::ConstUTF8CharsZ(chars, strlen(chars)));
} else {
filename = cx->names().empty;
filename = cx->names().empty_;
}
if (!filename) {
return;

Просмотреть файл

@ -267,7 +267,7 @@ JSAtom* WasmFrameIter::functionDisplayAtom() const {
JSAtom* atom = instance()->getFuncDisplayAtom(cx, codeRange_->funcIndex());
if (!atom) {
cx->clearPendingException();
return cx->names().empty;
return cx->names().empty_;
}
return atom;