Bug 1773778 - Part 9: Remove deprecated ImmutablePropertyNamePtr typedef r=tcampbell
authorJon Coppeard <jcoppeard@mozilla.com>
Tue, 14 Jun 2022 12:30:11 +0000 (2022-06-14)
changeset 620846 72a47bfe4e5cdcb3efac7b09460fc62b2b74f53b
parent 620845 1c994fe58dc79c72aae48a57b0e561eddb097fa0
child 620847 b57c960a182378249376f747608cf5a2fd5eed9c
push id39850
push userctuns@mozilla.com
push dateTue, 14 Jun 2022 21:37:29 +0000 (2022-06-14)
treeherdermozilla-central@43f3eb2819cc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstcampbell
bugs1773778
milestone103.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1773778 - Part 9: Remove deprecated ImmutablePropertyNamePtr typedef r=tcampbell Differential Revision: https://phabricator.services.mozilla.com/D149119
js/src/builtin/Symbol.cpp
js/src/builtin/intl/DateTimeFormat.cpp
js/src/builtin/intl/RelativeTimeFormat.h
js/src/debugger/Object.cpp
js/src/debugger/Script.cpp
js/src/frontend/ParserAtom.cpp
js/src/gc/Barrier.h
js/src/vm/JSAtom-inl.h
js/src/vm/JSAtom.cpp
js/src/vm/JSAtomState.h
js/src/wasm/AsmJS.cpp
--- a/js/src/builtin/Symbol.cpp
+++ b/js/src/builtin/Symbol.cpp
@@ -50,17 +50,18 @@ const JSFunctionSpec SymbolObject::metho
 const JSFunctionSpec SymbolObject::staticMethods[] = {
     JS_FN("for", for_, 1, 0), JS_FN("keyFor", keyFor, 1, 0), JS_FS_END};
 
 static bool SymbolClassFinish(JSContext* cx, HandleObject ctor,
                               HandleObject proto) {
   Handle<NativeObject*> nativeCtor = ctor.as<NativeObject>();
 
   // Define the well-known symbol properties, such as Symbol.iterator.
-  ImmutablePropertyNamePtr* names = cx->names().wellKnownSymbolNames();
+  ImmutableTenuredPtr<PropertyName*>* names =
+      cx->names().wellKnownSymbolNames();
   RootedValue value(cx);
   unsigned attrs = JSPROP_READONLY | JSPROP_PERMANENT;
   WellKnownSymbols* wks = cx->runtime()->wellKnownSymbols;
   for (size_t i = 0; i < JS::WellKnownSymbolLimit; i++) {
     value.setSymbol(wks->get(i));
     if (!NativeDefineDataProperty(cx, nativeCtor, names[i], value, attrs)) {
       return false;
     }
--- a/js/src/builtin/intl/DateTimeFormat.cpp
+++ b/js/src/builtin/intl/DateTimeFormat.cpp
@@ -1133,17 +1133,17 @@ static bool intl_FormatDateTime(JSContex
   if (!str) {
     return false;
   }
 
   result.setString(str);
   return true;
 }
 
-using FieldType = js::ImmutablePropertyNamePtr JSAtomState::*;
+using FieldType = js::ImmutableTenuredPtr<PropertyName*> JSAtomState::*;
 
 static FieldType GetFieldTypeForPartType(mozilla::intl::DateTimePartType type) {
   switch (type) {
     case mozilla::intl::DateTimePartType::Literal:
       return &JSAtomState::literal;
     case mozilla::intl::DateTimePartType::Era:
       return &JSAtomState::era;
     case mozilla::intl::DateTimePartType::Year:
--- a/js/src/builtin/intl/RelativeTimeFormat.h
+++ b/js/src/builtin/intl/RelativeTimeFormat.h
@@ -70,17 +70,17 @@ class RelativeTimeFormatObject : public 
  * Usage: formatted = intl_FormatRelativeTime(relativeTimeFormat, t,
  *                                            unit, numeric, formatToParts)
  */
 [[nodiscard]] extern bool intl_FormatRelativeTime(JSContext* cx, unsigned argc,
                                                   JS::Value* vp);
 
 namespace intl {
 
-using FieldType = js::ImmutablePropertyNamePtr JSAtomState::*;
+using FieldType = js::ImmutableTenuredPtr<PropertyName*> JSAtomState::*;
 
 [[nodiscard]] bool FormattedRelativeTimeToParts(
     JSContext* cx, HandleString str,
     const mozilla::intl::NumberPartVector& parts, FieldType relativeTimeUnit,
     MutableHandleValue result);
 
 }  // namespace intl
 }  // namespace js
--- a/js/src/debugger/Object.cpp
+++ b/js/src/debugger/Object.cpp
@@ -20,17 +20,16 @@
 
 #include "builtin/Array.h"       // for NewDenseCopiedArray
 #include "builtin/Promise.h"     // for PromiseReactionRecordBuilder
 #include "debugger/Debugger.h"   // for Completion, Debugger
 #include "debugger/Frame.h"      // for DebuggerFrame
 #include "debugger/NoExecute.h"  // for LeaveDebuggeeNoExecute
 #include "debugger/Script.h"     // for DebuggerScript
 #include "debugger/Source.h"     // for DebuggerSource
-#include "gc/Barrier.h"          // for ImmutablePropertyNamePtr
 #include "gc/Tracer.h"  // for TraceManuallyBarrieredCrossCompartmentEdge
 #include "js/CompilationAndEvaluation.h"  //  for Compile
 #include "js/Conversions.h"               // for ToObject
 #include "js/friend/ErrorMessages.h"      // for GetErrorMessage, JSMSG_*
 #include "js/friend/WindowProxy.h"  // for IsWindow, IsWindowProxy, ToWindowIfWindowProxy
 #include "js/HeapAPI.h"             // for IsInsideNursery
 #include "js/Promise.h"             // for PromiseState
 #include "js/PropertyAndElement.h"       // for JS_GetProperty
--- a/js/src/debugger/Script.cpp
+++ b/js/src/debugger/Script.cpp
@@ -15,17 +15,16 @@
 
 #include "jsnum.h"             // for ToNumber
 #include "NamespaceImports.h"  // for CallArgs, RootedValue
 
 #include "builtin/Array.h"         // for NewDenseEmptyArray
 #include "debugger/Debugger.h"     // for DebuggerScriptReferent, Debugger
 #include "debugger/DebugScript.h"  // for DebugScript
 #include "debugger/Source.h"       // for DebuggerSource
-#include "gc/Barrier.h"            // for ImmutablePropertyNamePtr
 #include "gc/GC.h"                 // for MemoryUse, MemoryUse::Breakpoint
 #include "gc/Tracer.h"         // for TraceManuallyBarrieredCrossCompartmentEdge
 #include "gc/Zone.h"           // for Zone
 #include "gc/ZoneAllocator.h"  // for AddCellMemory
 #include "js/CallArgs.h"       // for CallArgs, CallArgsFromVp
 #include "js/friend/ErrorMessages.h"  // for GetErrorMessage, JSMSG_*
 #include "js/HeapAPI.h"               // for GCCellPtr
 #include "js/RootingAPI.h"            // for Rooted
--- a/js/src/frontend/ParserAtom.cpp
+++ b/js/src/frontend/ParserAtom.cpp
@@ -29,31 +29,31 @@ using namespace js::frontend;
 
 namespace js {
 namespace frontend {
 
 JSAtom* GetWellKnownAtom(JSContext* cx, WellKnownAtomId atomId) {
 #define ASSERT_OFFSET_(_, NAME, _2)              \
   static_assert(offsetof(JSAtomState, NAME) ==   \
                 int32_t(WellKnownAtomId::NAME) * \
-                    sizeof(js::ImmutablePropertyNamePtr));
+                    sizeof(js::ImmutableTenuredPtr<PropertyName*>));
   FOR_EACH_COMMON_PROPERTYNAME(ASSERT_OFFSET_);
 #undef ASSERT_OFFSET_
 
 #define ASSERT_OFFSET_(NAME, _)                  \
   static_assert(offsetof(JSAtomState, NAME) ==   \
                 int32_t(WellKnownAtomId::NAME) * \
-                    sizeof(js::ImmutablePropertyNamePtr));
+                    sizeof(js::ImmutableTenuredPtr<PropertyName*>));
   JS_FOR_EACH_PROTOTYPE(ASSERT_OFFSET_);
 #undef ASSERT_OFFSET_
 
 #define ASSERT_OFFSET_(NAME)                     \
   static_assert(offsetof(JSAtomState, NAME) ==   \
                 int32_t(WellKnownAtomId::NAME) * \
-                    sizeof(js::ImmutablePropertyNamePtr));
+                    sizeof(js::ImmutableTenuredPtr<PropertyName*>));
   JS_FOR_EACH_WELL_KNOWN_SYMBOL(ASSERT_OFFSET_);
 #undef ASSERT_OFFSET_
 
   static_assert(int32_t(WellKnownAtomId::abort) == 0,
                 "Unexpected order of WellKnownAtom");
 
   return (&cx->names().abort)[int32_t(atomId)];
 }
--- a/js/src/gc/Barrier.h
+++ b/js/src/gc/Barrier.h
@@ -1230,23 +1230,21 @@ struct DefaultHasher<js::WeakHeapPtr<T>>
 template <class T>
 struct DefaultHasher<js::UnsafeBarePtr<T>> : js::UnsafeBarePtrHasher<T> {};
 
 }  // namespace mozilla
 
 namespace js {
 
 class DebugEnvironmentProxy;
-class PropertyName;
 
 namespace jit {
 class JitCode;
 }  // namespace jit
 
-using ImmutablePropertyNamePtr = ImmutableTenuredPtr<PropertyName*>;
 using ImmutableSymbolPtr = ImmutableTenuredPtr<JS::Symbol*>;
 
 using WeakHeapPtrAtom = WeakHeapPtr<JSAtom*>;
 using WeakHeapPtrDebugEnvironmentProxy = WeakHeapPtr<DebugEnvironmentProxy*>;
 using WeakHeapPtrJitCode = WeakHeapPtr<jit::JitCode*>;
 using WeakHeapPtrSymbol = WeakHeapPtr<JS::Symbol*>;
 
 using HeapPtrJitCode = HeapPtr<jit::JitCode*>;
--- a/js/src/vm/JSAtom-inl.h
+++ b/js/src/vm/JSAtom-inl.h
@@ -132,26 +132,27 @@ static MOZ_ALWAYS_INLINE JSLinearString*
   }
 
   return str->ensureLinear(cx);
 }
 
 inline Handle<PropertyName*> TypeName(JSType type, const JSAtomState& names) {
   MOZ_ASSERT(type < JSTYPE_LIMIT);
   static_assert(offsetof(JSAtomState, undefined) +
-                    JSTYPE_LIMIT * sizeof(ImmutablePropertyNamePtr) <=
+                    JSTYPE_LIMIT * sizeof(ImmutableTenuredPtr<PropertyName*>) <=
                 sizeof(JSAtomState));
   static_assert(JSTYPE_UNDEFINED == 0);
   return (&names.undefined)[type];
 }
 
 inline Handle<PropertyName*> ClassName(JSProtoKey key, JSAtomState& atomState) {
   MOZ_ASSERT(key < JSProto_LIMIT);
   static_assert(offsetof(JSAtomState, Null) +
-                    JSProto_LIMIT * sizeof(ImmutablePropertyNamePtr) <=
+                    JSProto_LIMIT *
+                        sizeof(ImmutableTenuredPtr<PropertyName*>) <=
                 sizeof(JSAtomState));
   static_assert(JSProto_Null == 0);
   return (&atomState.Null)[key];
 }
 
 }  // namespace js
 
 #endif /* vm_JSAtom_inl_h */
--- a/js/src/vm/JSAtom.cpp
+++ b/js/src/vm/JSAtom.cpp
@@ -247,18 +247,18 @@ bool JSRuntime::initializeAtoms(JSContex
 #undef COMMON_NAME_INFO
   };
 
   commonNames = js_new<JSAtomState>();
   if (!commonNames) {
     return false;
   }
 
-  ImmutablePropertyNamePtr* names =
-      reinterpret_cast<ImmutablePropertyNamePtr*>(commonNames.ref());
+  ImmutableTenuredPtr<PropertyName*>* names =
+      reinterpret_cast<ImmutableTenuredPtr<PropertyName*>*>(commonNames.ref());
   for (size_t i = 0; i < uint32_t(WellKnownAtomId::Limit); i++) {
     const auto& info = wellKnownAtomInfos[i];
     JSAtom* atom = PermanentlyAtomizeCharsValidLength(
         cx, *atomSet, info.hash,
         reinterpret_cast<const Latin1Char*>(info.content), info.length);
     if (!atom) {
       return false;
     }
@@ -293,17 +293,17 @@ bool JSRuntime::initializeAtoms(JSContex
     return false;
   }
 
   {
     // Prevent GC until we have fully initialized the well known symbols table.
     // Faster than zeroing the array and null checking during every GC.
     gc::AutoSuppressGC nogc(cx);
 
-    ImmutablePropertyNamePtr* descriptions =
+    ImmutableTenuredPtr<PropertyName*>* descriptions =
         commonNames->wellKnownSymbolDescriptions();
     ImmutableSymbolPtr* symbols = reinterpret_cast<ImmutableSymbolPtr*>(wks);
     for (size_t i = 0; i < JS::WellKnownSymbolLimit; i++) {
       JS::Symbol* symbol =
           JS::Symbol::newWellKnown(cx, JS::SymbolCode(i), descriptions[i]);
       if (!symbol) {
         ReportOutOfMemory(cx);
         return false;
--- a/js/src/vm/JSAtomState.h
+++ b/js/src/vm/JSAtomState.h
@@ -7,49 +7,57 @@
 #ifndef vm_JSAtomState_h
 #define vm_JSAtomState_h
 
 #include "gc/Barrier.h"
 #include "js/ProtoKey.h"
 #include "js/Symbol.h"
 #include "vm/CommonPropertyNames.h"
 
+namespace js {
+class PropertyName;
+}  // namespace js
+
 /* Various built-in or commonly-used names pinned on first context. */
 struct JSAtomState {
-#define PROPERTYNAME_FIELD(idpart, id, text) js::ImmutablePropertyNamePtr id;
+#define PROPERTYNAME_FIELD(idpart, id, text) \
+  js::ImmutableTenuredPtr<js::PropertyName*> id;
   FOR_EACH_COMMON_PROPERTYNAME(PROPERTYNAME_FIELD)
 #undef PROPERTYNAME_FIELD
-#define PROPERTYNAME_FIELD(name, clasp) js::ImmutablePropertyNamePtr name;
+#define PROPERTYNAME_FIELD(name, clasp) \
+  js::ImmutableTenuredPtr<js::PropertyName*> name;
   JS_FOR_EACH_PROTOTYPE(PROPERTYNAME_FIELD)
 #undef PROPERTYNAME_FIELD
-#define PROPERTYNAME_FIELD(name) js::ImmutablePropertyNamePtr name;
+#define PROPERTYNAME_FIELD(name) \
+  js::ImmutableTenuredPtr<js::PropertyName*> name;
   JS_FOR_EACH_WELL_KNOWN_SYMBOL(PROPERTYNAME_FIELD)
 #undef PROPERTYNAME_FIELD
-#define PROPERTYNAME_FIELD(name) js::ImmutablePropertyNamePtr Symbol_##name;
+#define PROPERTYNAME_FIELD(name) \
+  js::ImmutableTenuredPtr<js::PropertyName*> Symbol_##name;
   JS_FOR_EACH_WELL_KNOWN_SYMBOL(PROPERTYNAME_FIELD)
 #undef PROPERTYNAME_FIELD
 
-  js::ImmutablePropertyNamePtr* wellKnownSymbolNames() {
+  js::ImmutableTenuredPtr<js::PropertyName*>* wellKnownSymbolNames() {
 #define FIRST_PROPERTYNAME_FIELD(name) return &name;
     JS_FOR_EACH_WELL_KNOWN_SYMBOL(FIRST_PROPERTYNAME_FIELD)
 #undef FIRST_PROPERTYNAME_FIELD
   }
 
-  js::ImmutablePropertyNamePtr* wellKnownSymbolDescriptions() {
+  js::ImmutableTenuredPtr<js::PropertyName*>* wellKnownSymbolDescriptions() {
 #define FIRST_PROPERTYNAME_FIELD(name) return &Symbol_##name;
     JS_FOR_EACH_WELL_KNOWN_SYMBOL(FIRST_PROPERTYNAME_FIELD)
 #undef FIRST_PROPERTYNAME_FIELD
   }
 };
 
 namespace js {
 
 #define NAME_OFFSET(name) offsetof(JSAtomState, name)
 
 inline Handle<PropertyName*> AtomStateOffsetToName(const JSAtomState& atomState,
                                                    size_t offset) {
-  return *reinterpret_cast<js::ImmutablePropertyNamePtr*>((char*)&atomState +
-                                                          offset);
+  return *reinterpret_cast<js::ImmutableTenuredPtr<js::PropertyName*>*>(
+      (char*)&atomState + offset);
 }
 
 } /* namespace js */
 
 #endif /* vm_JSAtomState_h */
--- a/js/src/wasm/AsmJS.cpp
+++ b/js/src/wasm/AsmJS.cpp
@@ -6515,17 +6515,17 @@ static bool GetDataProperty(JSContext* c
   if (!field) {
     return false;
   }
 
   return GetDataProperty(cx, objVal, field, v);
 }
 
 static bool GetDataProperty(JSContext* cx, HandleValue objVal,
-                            const ImmutablePropertyNamePtr& field,
+                            const ImmutableTenuredPtr<PropertyName*>& field,
                             MutableHandleValue v) {
   Handle<PropertyName*> fieldHandle = field;
   return GetDataProperty(cx, objVal, fieldHandle, v);
 }
 
 static bool HasObjectValueOfMethodPure(JSObject* obj, JSContext* cx) {
   Value v;
   if (!GetPropertyPure(cx, obj, NameToId(cx->names().valueOf), &v)) {