Backed out changeset 1760c6913c09 (bug 1549340) for rust bustage. CLOSED TREE
authorCsoregi Natalia <ncsoregi@mozilla.com>
Fri, 10 May 2019 18:16:09 +0300
changeset 535296 2c7be26078fe281ecfe9ad2d10e31a9b42a55fec
parent 535295 9d6ef733639969e2902303aacb3c88ee003e72cf
child 535297 44db460adb2b732a8444e0f35c968bd828313e12
push id2082
push userffxbld-merge
push dateMon, 01 Jul 2019 08:34:18 +0000
treeherdermozilla-release@2fb19d0466d2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1549340
milestone68.0a1
backs out1760c6913c094a2364658cbd73131383e452d890
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
Backed out changeset 1760c6913c09 (bug 1549340) for rust bustage. CLOSED TREE
dom/bindings/BindingUtils.cpp
js/public/PropertySpec.h
js/public/Symbol.h
js/src/builtin/TypedObject.cpp
js/src/ctypes/CTypes.cpp
js/src/jsapi.cpp
js/src/jsapi.h
js/src/vm/JSObject.cpp
--- a/dom/bindings/BindingUtils.cpp
+++ b/dom/bindings/BindingUtils.cpp
@@ -1138,27 +1138,16 @@ static int CompareIdsAtIndices(const voi
   const uint16_t index2 = *static_cast<const uint16_t*>(aElement2);
   const PropertyInfo* infos = static_cast<PropertyInfo*>(aClosure);
 
   MOZ_ASSERT(JSID_BITS(infos[index1].Id()) != JSID_BITS(infos[index2].Id()));
 
   return JSID_BITS(infos[index1].Id()) < JSID_BITS(infos[index2].Id()) ? -1 : 1;
 }
 
-// {JSPropertySpec,JSFunctionSpec} use {JSPropertySpec,JSFunctionSpec}::Name
-// and ConstantSpec uses `const char*` for name field.
-static inline JSPropertySpec::Name ToPropertySpecName(
-    JSPropertySpec::Name name) {
-  return name;
-}
-
-static inline JSPropertySpec::Name ToPropertySpecName(const char* name) {
-  return JSPropertySpec::Name(name);
-}
-
 template <typename SpecT>
 static bool InitIdsInternal(JSContext* cx, const Prefable<SpecT>* pref,
                             PropertyInfo* infos, PropertyType type) {
   MOZ_ASSERT(pref);
   MOZ_ASSERT(pref->specs);
 
   // Index of the Prefable that contains the id for the current PropertyInfo.
   uint32_t prefIndex = 0;
@@ -1167,18 +1156,17 @@ static bool InitIdsInternal(JSContext* c
     // We ignore whether the set of ids is enabled and just intern all the IDs,
     // because this is only done once per application runtime.
     const SpecT* spec = pref->specs;
     // Index of the property/function/constant spec for our current PropertyInfo
     // in the "specs" array of the relevant Prefable.
     uint32_t specIndex = 0;
     do {
       jsid id;
-      if (!JS::PropertySpecNameToPermanentId(cx, ToPropertySpecName(spec->name),
-                                             &id)) {
+      if (!JS::PropertySpecNameToPermanentId(cx, spec->name, &id)) {
         return false;
       }
       infos->SetId(id);
       infos->type = type;
       infos->prefIndex = prefIndex;
       infos->specIndex = specIndex++;
       ++infos;
     } while ((++spec)->name);
--- a/js/public/PropertySpec.h
+++ b/js/public/PropertySpec.h
@@ -14,17 +14,17 @@
 #include <stdint.h>     // uint8_t, uint16_t, int32_t, uint32_t, uintptr_t
 #include <type_traits>  // std::enable_if
 
 #include "jstypes.h"  // JS_PUBLIC_API
 
 #include "js/CallArgs.h"            // JSNative
 #include "js/PropertyDescriptor.h"  // JSPROP_*
 #include "js/RootingAPI.h"          // JS::MutableHandle
-#include "js/Symbol.h"              // JS::SymbolCode, PropertySpecNameIsSymbol
+#include "js/Symbol.h"              // JS::SymbolCode
 #include "js/Value.h"               // JS::Value
 
 struct JSContext;
 struct JSJitInfo;
 
 /**
  * Wrapper to relace JSNative for JSPropertySpecs and JSFunctionSpecs. This will
  * allow us to pass one JSJitInfo per function with the property/function spec,
@@ -143,133 +143,66 @@ struct JSPropertySpec {
       return AccessorsOrValue(getter, setter);
     }
 
     static constexpr AccessorsOrValue fromValue(ValueWrapper value) {
       return AccessorsOrValue(value);
     }
   };
 
-  union Name {
-   private:
-    const char* string_;
-    uintptr_t symbol_;
-
-   public:
-    Name() = delete;
-
-    explicit constexpr Name(const char* str) : string_(str) {}
-    explicit constexpr Name(JS::SymbolCode symbol)
-        : symbol_(uint32_t(symbol) + 1) {}
-
-    explicit operator bool() const { return !!symbol_; }
-
-    bool isSymbol() const { return JS::PropertySpecNameIsSymbol(symbol_); }
-    JS::SymbolCode symbol() const {
-      MOZ_ASSERT(isSymbol());
-      return JS::SymbolCode(symbol_ - 1);
-    }
-
-    bool isString() const { return !isSymbol(); }
-    const char* string() const {
-      MOZ_ASSERT(isString());
-      return string_;
-    }
-  };
-
-  Name name;
+  const char* name;
   uint8_t flags;
   AccessorsOrValue u;
 
  private:
   JSPropertySpec() = delete;
 
   constexpr JSPropertySpec(const char* name, uint8_t flags, AccessorsOrValue u)
       : name(name), flags(flags), u(u) {}
-  constexpr JSPropertySpec(JS::SymbolCode name, uint8_t flags,
-                           AccessorsOrValue u)
-      : name(name), flags(flags), u(u) {}
 
  public:
   JSPropertySpec(const JSPropertySpec& other) = default;
 
   static constexpr JSPropertySpec nativeAccessors(
       const char* name, uint8_t flags, JSNative getter,
       const JSJitInfo* getterInfo, JSNative setter = nullptr,
       const JSJitInfo* setterInfo = nullptr) {
     return JSPropertySpec(
         name, flags,
         AccessorsOrValue::fromAccessors(
             JSPropertySpec::Accessor::nativeAccessor(getter, getterInfo),
             JSPropertySpec::Accessor::nativeAccessor(setter, setterInfo)));
   }
 
-  static constexpr JSPropertySpec nativeAccessors(
-      JS::SymbolCode name, uint8_t flags, JSNative getter,
-      const JSJitInfo* getterInfo, JSNative setter = nullptr,
-      const JSJitInfo* setterInfo = nullptr) {
-    return JSPropertySpec(
-        name, flags,
-        AccessorsOrValue::fromAccessors(
-            JSPropertySpec::Accessor::nativeAccessor(getter, getterInfo),
-            JSPropertySpec::Accessor::nativeAccessor(setter, setterInfo)));
-  }
-
   static constexpr JSPropertySpec selfHostedAccessors(
       const char* name, uint8_t flags, const char* getterName,
       const char* setterName = nullptr) {
     return JSPropertySpec(
         name, flags | JSPROP_GETTER | (setterName ? JSPROP_SETTER : 0),
         AccessorsOrValue::fromAccessors(
             JSPropertySpec::Accessor::selfHostedAccessor(getterName),
             setterName
                 ? JSPropertySpec::Accessor::selfHostedAccessor(setterName)
                 : JSPropertySpec::Accessor::noAccessor()));
   }
 
-  static constexpr JSPropertySpec selfHostedAccessors(
-      JS::SymbolCode name, uint8_t flags, const char* getterName,
-      const char* setterName = nullptr) {
-    return JSPropertySpec(
-        name, flags | JSPROP_GETTER | (setterName ? JSPROP_SETTER : 0),
-        AccessorsOrValue::fromAccessors(
-            JSPropertySpec::Accessor::selfHostedAccessor(getterName),
-            setterName
-                ? JSPropertySpec::Accessor::selfHostedAccessor(setterName)
-                : JSPropertySpec::Accessor::noAccessor()));
-  }
-
   static constexpr JSPropertySpec int32Value(const char* name, uint8_t flags,
                                              int32_t n) {
     return JSPropertySpec(name, flags | JSPROP_INTERNAL_USE_BIT,
                           AccessorsOrValue::fromValue(
                               JSPropertySpec::ValueWrapper::int32Value(n)));
   }
 
-  static constexpr JSPropertySpec int32Value(JS::SymbolCode name, uint8_t flags,
-                                             int32_t n) {
-    return JSPropertySpec(name, flags | JSPROP_INTERNAL_USE_BIT,
-                          AccessorsOrValue::fromValue(
-                              JSPropertySpec::ValueWrapper::int32Value(n)));
-  }
-
   static constexpr JSPropertySpec stringValue(const char* name, uint8_t flags,
                                               const char* s) {
     return JSPropertySpec(name, flags | JSPROP_INTERNAL_USE_BIT,
                           AccessorsOrValue::fromValue(
                               JSPropertySpec::ValueWrapper::stringValue(s)));
   }
 
-  static constexpr JSPropertySpec stringValue(JS::SymbolCode name,
-                                              uint8_t flags, const char* s) {
-    return JSPropertySpec(name, flags | JSPROP_INTERNAL_USE_BIT,
-                          AccessorsOrValue::fromValue(
-                              JSPropertySpec::ValueWrapper::stringValue(s)));
-  }
-
   static constexpr JSPropertySpec sentinel() {
     return JSPropertySpec(nullptr, 0,
                           AccessorsOrValue::fromAccessors(
                               JSPropertySpec::Accessor::noAccessor(),
                               JSPropertySpec::Accessor::noAccessor()));
   }
 
   bool isAccessor() const { return !(flags & JSPROP_INTERNAL_USE_BIT); }
@@ -311,57 +244,71 @@ struct JSPropertySpec {
   }
 
   void checkAccessorsAreSelfHosted() const {
     MOZ_ASSERT(!u.accessors.getter.selfHosted.unused);
     MOZ_ASSERT(!u.accessors.setter.selfHosted.unused);
   }
 };
 
+// JSPropertySpec::{nativeAccessors, selfHostedAccessors,int32Value,
+// stringValue} methods require symbol names to be casted to `const char*`,
+// and the cast is `reinterpret_cast`.
+//
+// Provide a macro for the cast because of the following reasons:
+//
+//   * `reinterpret_cast` cannot be used in constexpr
+//   * using non-constexpr static method in parameter disables constexpr of
+//     above methods
+//   * top-level `reinterpret_cast` doesn't disable constexpr of above methods
+//
+#define SYMBOL_TO_PROPERTY_NAME(symbol) \
+  reinterpret_cast<const char*>(uint32_t(symbol) + 1)
+
 #define JS_CHECK_ACCESSOR_FLAGS(flags)                                         \
   (static_cast<std::enable_if<((flags) & ~(JSPROP_ENUMERATE |                  \
                                            JSPROP_PERMANENT)) == 0>::type>(0), \
    (flags))
 
 #define JS_PSG(name, getter, flags)                                     \
   JSPropertySpec::nativeAccessors(name, JS_CHECK_ACCESSOR_FLAGS(flags), \
                                   getter, nullptr)
 #define JS_PSGS(name, getter, setter, flags)                            \
   JSPropertySpec::nativeAccessors(name, JS_CHECK_ACCESSOR_FLAGS(flags), \
                                   getter, nullptr, setter, nullptr)
-#define JS_SYM_GET(symbol, getter, flags)                                 \
-  JSPropertySpec::nativeAccessors(::JS::SymbolCode::symbol,               \
-                                  JS_CHECK_ACCESSOR_FLAGS(flags), getter, \
-                                  nullptr)
+#define JS_SYM_GET(symbol, getter, flags)                \
+  JSPropertySpec::nativeAccessors(                       \
+      SYMBOL_TO_PROPERTY_NAME(::JS::SymbolCode::symbol), \
+      JS_CHECK_ACCESSOR_FLAGS(flags), getter, nullptr)
 #define JS_SELF_HOSTED_GET(name, getterName, flags)                         \
   JSPropertySpec::selfHostedAccessors(name, JS_CHECK_ACCESSOR_FLAGS(flags), \
                                       getterName)
 #define JS_SELF_HOSTED_GETSET(name, getterName, setterName, flags)          \
   JSPropertySpec::selfHostedAccessors(name, JS_CHECK_ACCESSOR_FLAGS(flags), \
                                       getterName, setterName)
 #define JS_SELF_HOSTED_SYM_GET(symbol, getterName, flags) \
   JSPropertySpec::selfHostedAccessors(                    \
-      ::JS::SymbolCode::symbol, JS_CHECK_ACCESSOR_FLAGS(flags), getterName)
+      SYMBOL_TO_PROPERTY_NAME(::JS::SymbolCode::symbol),  \
+      JS_CHECK_ACCESSOR_FLAGS(flags), getterName)
 #define JS_STRING_PS(name, string, flags) \
   JSPropertySpec::stringValue(name, flags, string)
 #define JS_STRING_SYM_PS(symbol, string, flags) \
-  JSPropertySpec::stringValue(::JS::SymbolCode::symbol, flags, string)
+  JSPropertySpec::stringValue(                  \
+      SYMBOL_TO_PROPERTY_NAME(::JS::SymbolCode::symbol), flags, string)
 #define JS_INT32_PS(name, value, flags) \
   JSPropertySpec::int32Value(name, flags, value)
 #define JS_PS_END JSPropertySpec::sentinel()
 
 /**
  * To define a native function, set call to a JSNativeWrapper. To define a
  * self-hosted function, set selfHostedName to the name of a function
  * compiled during JSRuntime::initSelfHosting.
  */
 struct JSFunctionSpec {
-  using Name = JSPropertySpec::Name;
-
-  Name name;
+  const char* name;
   JSNativeWrapper call;
   uint16_t nargs;
   uint16_t flags;
   const char* selfHostedName;
 };
 
 /*
  * Terminating sentinel initializer to put at the end of a JSFunctionSpec array
@@ -387,14 +334,16 @@ struct JSFunctionSpec {
 #define JS_SYM_FN(symbol, call, nargs, flags) \
   JS_SYM_FNSPEC(symbol, call, nullptr, nargs, flags, nullptr)
 #define JS_FNINFO(name, call, info, nargs, flags) \
   JS_FNSPEC(name, call, info, nargs, flags, nullptr)
 #define JS_SELF_HOSTED_FN(name, selfHostedName, nargs, flags) \
   JS_FNSPEC(name, nullptr, nullptr, nargs, flags, selfHostedName)
 #define JS_SELF_HOSTED_SYM_FN(symbol, selfHostedName, nargs, flags) \
   JS_SYM_FNSPEC(symbol, nullptr, nullptr, nargs, flags, selfHostedName)
-#define JS_SYM_FNSPEC(symbol, call, info, nargs, flags, selfHostedName) \
-  JS_FNSPEC(::JS::SymbolCode::symbol, call, info, nargs, flags, selfHostedName)
+#define JS_SYM_FNSPEC(symbol, call, info, nargs, flags, selfHostedName)      \
+  JS_FNSPEC(                                                                 \
+      reinterpret_cast<const char*>(uint32_t(::JS::SymbolCode::symbol) + 1), \
+      call, info, nargs, flags, selfHostedName)
 #define JS_FNSPEC(name, call, info, nargs, flags, selfHostedName) \
-  { JSFunctionSpec::Name(name), {call, info}, nargs, flags, selfHostedName }
+  { name, {call, info}, nargs, flags, selfHostedName }
 
 #endif  // js_PropertySpec_h
--- a/js/public/Symbol.h
+++ b/js/public/Symbol.h
@@ -98,15 +98,16 @@ extern JS_PUBLIC_API SymbolCode GetSymbo
  */
 extern JS_PUBLIC_API Symbol* GetWellKnownSymbol(JSContext* cx,
                                                 SymbolCode which);
 
 /**
  * Return true if the given JSPropertySpec::name or JSFunctionSpec::name value
  * is actually a symbol code and not a string. See JS_SYM_FN.
  */
-inline bool PropertySpecNameIsSymbol(uintptr_t name) {
-  return name != 0 && name - 1 < WellKnownSymbolLimit;
+inline bool PropertySpecNameIsSymbol(const char* name) {
+  uintptr_t u = reinterpret_cast<uintptr_t>(name);
+  return u != 0 && u - 1 < WellKnownSymbolLimit;
 }
 
 }  // namespace JS
 
 #endif /* js_Symbol_h */
--- a/js/src/builtin/TypedObject.cpp
+++ b/js/src/builtin/TypedObject.cpp
@@ -333,22 +333,18 @@ static const ClassOps ReferenceTypeDescr
 
 const Class js::ReferenceTypeDescr::class_ = {
     "Reference",
     JSCLASS_HAS_RESERVED_SLOTS(JS_DESCR_SLOTS) | JSCLASS_BACKGROUND_FINALIZE,
     &ReferenceTypeDescrClassOps};
 
 const JSFunctionSpec js::ReferenceTypeDescr::typeObjectMethods[] = {
     JS_SELF_HOSTED_FN("toSource", "DescrToSource", 0, 0),
-    {JSFunctionSpec::Name("array"), {nullptr, nullptr}, 1, 0, "ArrayShorthand"},
-    {JSFunctionSpec::Name("equivalent"),
-     {nullptr, nullptr},
-     1,
-     0,
-     "TypeDescrEquivalent"},
+    {"array", {nullptr, nullptr}, 1, 0, "ArrayShorthand"},
+    {"equivalent", {nullptr, nullptr}, 1, 0, "TypeDescrEquivalent"},
     JS_FS_END};
 
 static const uint32_t ReferenceSizes[] = {
 #define REFERENCE_SIZE(_kind, _type, _name) sizeof(_type),
     JS_FOR_EACH_REFERENCE_TYPE_REPR(REFERENCE_SIZE) 0
 #undef REFERENCE_SIZE
 };
 
@@ -476,36 +472,28 @@ static const ClassOps ArrayTypeDescrClas
 const Class ArrayTypeDescr::class_ = {
     "ArrayType",
     JSCLASS_HAS_RESERVED_SLOTS(JS_DESCR_SLOTS) | JSCLASS_BACKGROUND_FINALIZE,
     &ArrayTypeDescrClassOps};
 
 const JSPropertySpec ArrayMetaTypeDescr::typeObjectProperties[] = {JS_PS_END};
 
 const JSFunctionSpec ArrayMetaTypeDescr::typeObjectMethods[] = {
-    {JSFunctionSpec::Name("array"), {nullptr, nullptr}, 1, 0, "ArrayShorthand"},
+    {"array", {nullptr, nullptr}, 1, 0, "ArrayShorthand"},
     JS_SELF_HOSTED_FN("toSource", "DescrToSource", 0, 0),
-    {JSFunctionSpec::Name("equivalent"),
-     {nullptr, nullptr},
-     1,
-     0,
-     "TypeDescrEquivalent"},
+    {"equivalent", {nullptr, nullptr}, 1, 0, "TypeDescrEquivalent"},
     JS_SELF_HOSTED_FN("build", "TypedObjectArrayTypeBuild", 3, 0),
     JS_SELF_HOSTED_FN("from", "TypedObjectArrayTypeFrom", 3, 0),
     JS_FS_END};
 
 const JSPropertySpec ArrayMetaTypeDescr::typedObjectProperties[] = {JS_PS_END};
 
 const JSFunctionSpec ArrayMetaTypeDescr::typedObjectMethods[] = {
-    {JSFunctionSpec::Name("forEach"), {nullptr, nullptr}, 1, 0, "ArrayForEach"},
-    {JSFunctionSpec::Name("redimension"),
-     {nullptr, nullptr},
-     1,
-     0,
-     "TypedObjectArrayRedimension"},
+    {"forEach", {nullptr, nullptr}, 1, 0, "ArrayForEach"},
+    {"redimension", {nullptr, nullptr}, 1, 0, "TypedObjectArrayRedimension"},
     JS_SELF_HOSTED_FN("map", "TypedObjectArrayMap", 2, 0),
     JS_SELF_HOSTED_FN("reduce", "TypedObjectArrayReduce", 2, 0),
     JS_SELF_HOSTED_FN("filter", "TypedObjectArrayFilter", 1, 0),
     JS_FS_END};
 
 bool js::CreateUserSizeAndAlignmentProperties(JSContext* cx,
                                               HandleTypeDescr descr) {
   // If data is transparent, also store the public slots.
@@ -725,23 +713,19 @@ static const ClassOps StructTypeDescrCla
 const Class StructTypeDescr::class_ = {
     "StructType",
     JSCLASS_HAS_RESERVED_SLOTS(JS_DESCR_SLOTS) | JSCLASS_BACKGROUND_FINALIZE,
     &StructTypeDescrClassOps};
 
 const JSPropertySpec StructMetaTypeDescr::typeObjectProperties[] = {JS_PS_END};
 
 const JSFunctionSpec StructMetaTypeDescr::typeObjectMethods[] = {
-    {JSFunctionSpec::Name("array"), {nullptr, nullptr}, 1, 0, "ArrayShorthand"},
+    {"array", {nullptr, nullptr}, 1, 0, "ArrayShorthand"},
     JS_SELF_HOSTED_FN("toSource", "DescrToSource", 0, 0),
-    {JSFunctionSpec::Name("equivalent"),
-     {nullptr, nullptr},
-     1,
-     0,
-     "TypeDescrEquivalent"},
+    {"equivalent", {nullptr, nullptr}, 1, 0, "TypeDescrEquivalent"},
     JS_FS_END};
 
 const JSPropertySpec StructMetaTypeDescr::typedObjectProperties[] = {JS_PS_END};
 
 const JSFunctionSpec StructMetaTypeDescr::typedObjectMethods[] = {JS_FS_END};
 
 CheckedInt32 StructMetaTypeDescr::Layout::addField(int32_t fieldAlignment,
                                                    int32_t fieldSize) {
--- a/js/src/ctypes/CTypes.cpp
+++ b/js/src/ctypes/CTypes.cpp
@@ -1916,17 +1916,17 @@ static bool DefineABIConstant(JSContext*
 // ctypes.{Pointer,Array,Struct,Function}Type.
 static bool InitTypeConstructor(
     JSContext* cx, HandleObject parent, HandleObject CTypeProto,
     HandleObject CDataProto, const JSFunctionSpec spec,
     const JSFunctionSpec* fns, const JSPropertySpec* props,
     const JSFunctionSpec* instanceFns, const JSPropertySpec* instanceProps,
     MutableHandleObject typeProto, MutableHandleObject dataProto) {
   JSFunction* fun = js::DefineFunctionWithReserved(
-      cx, parent, spec.name.string(), spec.call.op, spec.nargs, spec.flags);
+      cx, parent, spec.name, spec.call.op, spec.nargs, spec.flags);
   if (!fun) {
     return false;
   }
 
   RootedObject obj(cx, JS_GetFunctionObject(fun));
   if (!obj) {
     return false;
   }
--- a/js/src/jsapi.cpp
+++ b/js/src/jsapi.cpp
@@ -2917,33 +2917,39 @@ JS_PUBLIC_API bool JSPropertySpec::getVa
   } else {
     MOZ_ASSERT(u.value.type == JSVAL_TYPE_INT32);
     vp.setInt32(u.value.int32);
   }
 
   return true;
 }
 
-bool PropertySpecNameToId(JSContext* cx, JSPropertySpec::Name name,
-                          MutableHandleId id,
+static JS::SymbolCode PropertySpecNameToSymbolCode(const char* name) {
+  MOZ_ASSERT(JS::PropertySpecNameIsSymbol(name));
+  uintptr_t u = reinterpret_cast<uintptr_t>(name);
+  return JS::SymbolCode(u - 1);
+}
+
+bool PropertySpecNameToId(JSContext* cx, const char* name, MutableHandleId id,
                           js::PinningBehavior pin = js::DoNotPinAtom) {
-  if (name.isSymbol()) {
-    id.set(SYMBOL_TO_JSID(cx->wellKnownSymbols().get(name.symbol())));
+  if (JS::PropertySpecNameIsSymbol(name)) {
+    JS::SymbolCode which = PropertySpecNameToSymbolCode(name);
+    id.set(SYMBOL_TO_JSID(cx->wellKnownSymbols().get(which)));
   } else {
-    JSAtom* atom = Atomize(cx, name.string(), strlen(name.string()), pin);
+    JSAtom* atom = Atomize(cx, name, strlen(name), pin);
     if (!atom) {
       return false;
     }
     id.set(AtomToId(atom));
   }
   return true;
 }
 
 JS_PUBLIC_API bool JS::PropertySpecNameToPermanentId(JSContext* cx,
-                                                     JSPropertySpec::Name name,
+                                                     const char* name,
                                                      jsid* idp) {
   // We are calling fromMarkedLocation(idp) even though idp points to a
   // location that will never be marked. This is OK because the whole point
   // of this API is to populate *idp with a jsid that does not need to be
   // marked.
   return PropertySpecNameToId(
       cx, name, MutableHandleId::fromMarkedLocation(idp), js::PinAtom);
 }
@@ -4656,46 +4662,44 @@ JS_PUBLIC_API JS::SymbolCode JS::GetSymb
 }
 
 JS_PUBLIC_API JS::Symbol* JS::GetWellKnownSymbol(JSContext* cx,
                                                  JS::SymbolCode which) {
   return cx->wellKnownSymbols().get(which);
 }
 
 #ifdef DEBUG
-static bool PropertySpecNameIsDigits(JSPropertySpec::Name name) {
-  if (name.isSymbol()) {
+static bool PropertySpecNameIsDigits(const char* s) {
+  if (JS::PropertySpecNameIsSymbol(s)) {
     return false;
   }
-  const char* s = name.string();
   if (!*s) {
     return false;
   }
   for (; *s; s++) {
     if (*s < '0' || *s > '9') {
       return false;
     }
   }
   return true;
 }
 #endif  // DEBUG
 
-JS_PUBLIC_API bool JS::PropertySpecNameEqualsId(JSPropertySpec::Name name,
-                                                HandleId id) {
-  if (name.isSymbol()) {
+JS_PUBLIC_API bool JS::PropertySpecNameEqualsId(const char* name, HandleId id) {
+  if (JS::PropertySpecNameIsSymbol(name)) {
     if (!JSID_IS_SYMBOL(id)) {
       return false;
     }
     Symbol* sym = JSID_TO_SYMBOL(id);
-    return sym->isWellKnownSymbol() && sym->code() == name.symbol();
+    return sym->isWellKnownSymbol() &&
+           sym->code() == PropertySpecNameToSymbolCode(name);
   }
 
   MOZ_ASSERT(!PropertySpecNameIsDigits(name));
-  return JSID_IS_ATOM(id) &&
-         JS_FlatStringEqualsAscii(JSID_TO_ATOM(id), name.string());
+  return JSID_IS_ATOM(id) && JS_FlatStringEqualsAscii(JSID_TO_ATOM(id), name);
 }
 
 JS_PUBLIC_API bool JS_Stringify(JSContext* cx, MutableHandleValue vp,
                                 HandleObject replacer, HandleValue space,
                                 JSONWriteCallback callback, void* data) {
   AssertHeapIsIdle();
   CHECK_THREAD(cx);
   cx->check(replacer, space);
--- a/js/src/jsapi.h
+++ b/js/src/jsapi.h
@@ -32,17 +32,16 @@
 #include "js/CompileOptions.h"
 #include "js/ErrorReport.h"
 #include "js/GCVector.h"
 #include "js/HashTable.h"
 #include "js/Id.h"
 #include "js/OffThreadScriptCompilation.h"
 #include "js/Principals.h"
 #include "js/PropertyDescriptor.h"
-#include "js/PropertySpec.h"
 #include "js/Realm.h"
 #include "js/RealmOptions.h"
 #include "js/RefCounted.h"
 #include "js/RootingAPI.h"
 #include "js/TracingAPI.h"
 #include "js/Transcoding.h"
 #include "js/UniquePtr.h"
 #include "js/Utility.h"
@@ -2543,30 +2542,28 @@ JS_PUBLIC_API size_t JS_GetStringEncodin
  */
 MOZ_MUST_USE JS_PUBLIC_API bool JS_EncodeStringToBuffer(JSContext* cx,
                                                         JSString* str,
                                                         char* buffer,
                                                         size_t length);
 
 namespace JS {
 
-JS_PUBLIC_API bool PropertySpecNameEqualsId(JSPropertySpec::Name name,
-                                            HandleId id);
+JS_PUBLIC_API bool PropertySpecNameEqualsId(const char* name, HandleId id);
 
 /**
  * Create a jsid that does not need to be marked for GC.
  *
  * 'name' is a JSPropertySpec::name or JSFunctionSpec::name value. The
  * resulting jsid, on success, is either an interned string or a well-known
  * symbol; either way it is immune to GC so there is no need to visit *idp
  * during GC marking.
  */
 JS_PUBLIC_API bool PropertySpecNameToPermanentId(JSContext* cx,
-                                                 JSPropertySpec::Name name,
-                                                 jsid* idp);
+                                                 const char* name, jsid* idp);
 
 } /* namespace JS */
 
 /************************************************************************/
 
 /*
  * Error reporting.
  *
--- a/js/src/vm/JSObject.cpp
+++ b/js/src/vm/JSObject.cpp
@@ -33,17 +33,17 @@
 #include "builtin/Symbol.h"
 #include "builtin/WeakSetObject.h"
 #include "frontend/BytecodeCompiler.h"
 #include "gc/Policy.h"
 #include "jit/BaselineJIT.h"
 #include "js/CharacterEncoding.h"
 #include "js/MemoryMetrics.h"
 #include "js/PropertyDescriptor.h"  // JS::FromPropertyDescriptor
-#include "js/PropertySpec.h"        // JSPropertySpec
+#include "js/PropertySpec.h"
 #include "js/Proxy.h"
 #include "js/UbiNode.h"
 #include "js/UniquePtr.h"
 #include "js/Wrapper.h"
 #include "util/Text.h"
 #include "util/Windows.h"
 #include "vm/ArgumentsObject.h"
 #include "vm/BytecodeUtil.h"
@@ -3009,17 +3009,17 @@ bool js::GetPropertyDescriptor(JSContext
   }
 
   MOZ_ASSERT(!desc.object());
   return true;
 }
 
 /* * */
 
-extern bool PropertySpecNameToId(JSContext* cx, JSPropertySpec::Name name,
+extern bool PropertySpecNameToId(JSContext* cx, const char* name,
                                  MutableHandleId id,
                                  js::PinningBehavior pin = js::DoNotPinAtom);
 
 // If a property or method is part of an experimental feature that can be
 // disabled at run-time by a preference, we keep it in the JSFunctionSpec /
 // JSPropertySpec list, but omit the definition if the preference is off.
 JS_FRIEND_API bool js::ShouldIgnorePropertyDefinition(JSContext* cx,
                                                       JSProtoKey key, jsid id) {