Bug 1595745 - Part 16: Remove old-style initialisation for ProtoKey constructors. r=mgaudet
☠☠ backed out by ec8cad689121 ☠ ☠
authorAndré Bargull <andre.bargull@gmail.com>
Fri, 15 Nov 2019 15:54:19 +0000
changeset 502210 3b5c6aaf5a182cb13691f0917af88da2a0f4df8e
parent 502209 8e8c4124f21990d54d48215611651e6dd0cb3a98
child 502211 bc106b1c9d292c8c8aa72415e18610a1e4a4ef9f
push id114172
push userdluca@mozilla.com
push dateTue, 19 Nov 2019 11:31:10 +0000
treeherdermozilla-inbound@b5c5ba07d3db [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmgaudet
bugs1595745
milestone72.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 1595745 - Part 16: Remove old-style initialisation for ProtoKey constructors. r=mgaudet All JSProtoKey entries are now using `InitViaClassSpec`, so we can remove the 'init' parameter from `JS_FOR_PROTOTYPES` and update all callers accordingly. Furthermore the `protoTable` array can be changed to an array of `JSClass*` and `GlobalObject::resolveConstructor` can be cleaned-up to always use the ClassSpec initialisation path. Differential Revision: https://phabricator.services.mozilla.com/D52706
js/public/ProtoKey.h
js/src/jsapi.cpp
js/src/jspubtd.h
js/src/vm/GlobalObject.cpp
js/src/vm/JSAtom.cpp
js/src/vm/JSAtom.h
js/src/vm/JSObject.cpp
js/src/vm/JSObject.h
js/src/vm/Runtime.h
--- a/js/public/ProtoKey.h
+++ b/js/public/ProtoKey.h
@@ -5,20 +5,18 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef js_ProtoKey_h
 #define js_ProtoKey_h
 
 /* A higher-order macro for enumerating all JSProtoKey values. */
 /*
  * Consumers define macros as follows:
- * MACRO(name, init, clasp)
+ * MACRO(name, clasp)
  *   name:    The canonical name of the class.
- *   init:    Initialization function. These are |extern "C";|, and clients
- *            should use |extern "C" {}| as appropriate when using this macro.
  *   clasp:   The JSClass for this object, or "dummy" if it doesn't exist.
  *
  *
  * Consumers wishing to iterate over all the JSProtoKey values, can use
  * JS_FOR_EACH_PROTOTYPE. However, there are certain values that don't
  * correspond to real constructors, like Null or constructors that are disabled
  * via preprocessor directives. We still need to include these in the JSProtoKey
  * list in order to maintain binary XDR compatibility, but we need to provide a
@@ -43,105 +41,97 @@
 #endif
 
 #ifdef ENABLE_TYPED_OBJECTS
 #  define IF_TYPEDOBJ(REAL, IMAGINARY) REAL
 #else
 #  define IF_TYPEDOBJ(REAL, IMAGINARY) IMAGINARY
 #endif
 
-#define JS_FOR_PROTOTYPES_(REAL, IMAGINARY, REAL_IF_INTL, REAL_IF_BDATA)     \
-  IMAGINARY(Null, InitNullClass, dummy)                                      \
-  REAL(Object, InitViaClassSpec, OCLASP(Plain))                              \
-  REAL(Function, InitViaClassSpec, &JSFunction::class_)                      \
-  REAL(Array, InitViaClassSpec, OCLASP(Array))                               \
-  REAL(Boolean, InitViaClassSpec, OCLASP(Boolean))                           \
-  REAL(JSON, InitViaClassSpec, CLASP(JSON))                                  \
-  REAL(Date, InitViaClassSpec, OCLASP(Date))                                 \
-  REAL(Math, InitViaClassSpec, CLASP(Math))                                  \
-  REAL(Number, InitViaClassSpec, OCLASP(Number))                             \
-  REAL(String, InitViaClassSpec, OCLASP(String))                             \
-  REAL(RegExp, InitViaClassSpec, OCLASP(RegExp))                             \
-  REAL(Error, InitViaClassSpec, ERROR_CLASP(JSEXN_ERR))                      \
-  REAL(InternalError, InitViaClassSpec, ERROR_CLASP(JSEXN_INTERNALERR))      \
-  REAL(EvalError, InitViaClassSpec, ERROR_CLASP(JSEXN_EVALERR))              \
-  REAL(RangeError, InitViaClassSpec, ERROR_CLASP(JSEXN_RANGEERR))            \
-  REAL(ReferenceError, InitViaClassSpec, ERROR_CLASP(JSEXN_REFERENCEERR))    \
-  REAL(SyntaxError, InitViaClassSpec, ERROR_CLASP(JSEXN_SYNTAXERR))          \
-  REAL(TypeError, InitViaClassSpec, ERROR_CLASP(JSEXN_TYPEERR))              \
-  REAL(URIError, InitViaClassSpec, ERROR_CLASP(JSEXN_URIERR))                \
-  REAL(DebuggeeWouldRun, InitViaClassSpec,                                   \
-       ERROR_CLASP(JSEXN_DEBUGGEEWOULDRUN))                                  \
-  REAL(CompileError, InitViaClassSpec, ERROR_CLASP(JSEXN_WASMCOMPILEERROR))  \
-  REAL(LinkError, InitViaClassSpec, ERROR_CLASP(JSEXN_WASMLINKERROR))        \
-  REAL(RuntimeError, InitViaClassSpec, ERROR_CLASP(JSEXN_WASMRUNTIMEERROR))  \
-  REAL(ArrayBuffer, InitViaClassSpec, OCLASP(ArrayBuffer))                   \
-  REAL(Int8Array, InitViaClassSpec, TYPED_ARRAY_CLASP(Int8))                 \
-  REAL(Uint8Array, InitViaClassSpec, TYPED_ARRAY_CLASP(Uint8))               \
-  REAL(Int16Array, InitViaClassSpec, TYPED_ARRAY_CLASP(Int16))               \
-  REAL(Uint16Array, InitViaClassSpec, TYPED_ARRAY_CLASP(Uint16))             \
-  REAL(Int32Array, InitViaClassSpec, TYPED_ARRAY_CLASP(Int32))               \
-  REAL(Uint32Array, InitViaClassSpec, TYPED_ARRAY_CLASP(Uint32))             \
-  REAL(Float32Array, InitViaClassSpec, TYPED_ARRAY_CLASP(Float32))           \
-  REAL(Float64Array, InitViaClassSpec, TYPED_ARRAY_CLASP(Float64))           \
-  REAL(Uint8ClampedArray, InitViaClassSpec, TYPED_ARRAY_CLASP(Uint8Clamped)) \
-  REAL(BigInt64Array, InitViaClassSpec, TYPED_ARRAY_CLASP(BigInt64))         \
-  REAL(BigUint64Array, InitViaClassSpec, TYPED_ARRAY_CLASP(BigUint64))       \
-  REAL(BigInt, InitViaClassSpec, OCLASP(BigInt))                             \
-  REAL(Proxy, InitViaClassSpec, CLASP(Proxy))                                \
-  REAL(WeakMap, InitViaClassSpec, OCLASP(WeakMap))                           \
-  REAL(Map, InitViaClassSpec, OCLASP(Map))                                   \
-  REAL(Set, InitViaClassSpec, OCLASP(Set))                                   \
-  REAL(DataView, InitViaClassSpec, OCLASP(DataView))                         \
-  REAL(Symbol, InitViaClassSpec, OCLASP(Symbol))                             \
-  REAL(SharedArrayBuffer, InitViaClassSpec, OCLASP(SharedArrayBuffer))       \
-  REAL_IF_INTL(Intl, InitViaClassSpec, CLASP(Intl))                          \
-  REAL_IF_INTL(Collator, InitViaClassSpec, OCLASP(Collator))                 \
-  REAL_IF_INTL(DateTimeFormat, InitViaClassSpec, OCLASP(DateTimeFormat))     \
-  REAL_IF_INTL(Locale, InitViaClassSpec, OCLASP(Locale))                     \
-  REAL_IF_INTL(ListFormat, InitViaClassSpec, OCLASP(ListFormat))             \
-  REAL_IF_INTL(NumberFormat, InitViaClassSpec, OCLASP(NumberFormat))         \
-  REAL_IF_INTL(PluralRules, InitViaClassSpec, OCLASP(PluralRules))           \
-  REAL_IF_INTL(RelativeTimeFormat, InitViaClassSpec,                         \
-               OCLASP(RelativeTimeFormat))                                   \
-  REAL_IF_BDATA(TypedObject, InitViaClassSpec, OCLASP(TypedObjectModule))    \
-  REAL(Reflect, InitViaClassSpec, CLASP(Reflect))                            \
-  REAL(WeakSet, InitViaClassSpec, OCLASP(WeakSet))                           \
-  REAL(TypedArray, InitViaClassSpec,                                         \
-       &js::TypedArrayObject::sharedTypedArrayPrototypeClass)                \
-  REAL(Atomics, InitViaClassSpec, OCLASP(Atomics))                           \
-  REAL(SavedFrame, InitViaClassSpec, &js::SavedFrame::class_)                \
-  REAL(Promise, InitViaClassSpec, OCLASP(Promise))                           \
-  REAL(AsyncFunction, InitViaClassSpec, CLASP(AsyncFunction))                \
-  REAL(GeneratorFunction, InitViaClassSpec, CLASP(GeneratorFunction))        \
-  REAL(AsyncGeneratorFunction, InitViaClassSpec,                             \
-       CLASP(AsyncGeneratorFunction))                                        \
-  REAL(ReadableStream, InitViaClassSpec, &js::ReadableStream::class_)        \
-  REAL(ReadableStreamDefaultReader, InitViaClassSpec,                        \
-       &js::ReadableStreamDefaultReader::class_)                             \
-  REAL(ReadableStreamDefaultController, InitViaClassSpec,                    \
-       &js::ReadableStreamDefaultController::class_)                         \
-  REAL(ReadableByteStreamController, InitViaClassSpec,                       \
-       &js::ReadableByteStreamController::class_)                            \
-  REAL(WritableStream, InitViaClassSpec, &js::WritableStream::class_)        \
-  REAL(WritableStreamDefaultController, InitViaClassSpec,                    \
-       &js::WritableStreamDefaultController::class_)                         \
-  REAL(WritableStreamDefaultWriter, InitViaClassSpec,                        \
-       &js::WritableStreamDefaultWriter::class_)                             \
-  REAL(ByteLengthQueuingStrategy, InitViaClassSpec,                          \
-       &js::ByteLengthQueuingStrategy::class_)                               \
-  REAL(CountQueuingStrategy, InitViaClassSpec,                               \
-       &js::CountQueuingStrategy::class_)                                    \
-  REAL(WebAssembly, InitViaClassSpec, CLASP(WebAssembly))                    \
-  REAL(WasmModule, InitViaClassSpec, OCLASP(WasmModule))                     \
-  REAL(WasmInstance, InitViaClassSpec, OCLASP(WasmInstance))                 \
-  REAL(WasmMemory, InitViaClassSpec, OCLASP(WasmMemory))                     \
-  REAL(WasmTable, InitViaClassSpec, OCLASP(WasmTable))                       \
-  REAL(WasmGlobal, InitViaClassSpec, OCLASP(WasmGlobal))                     \
-  REAL(FinalizationGroup, InitViaClassSpec, OCLASP(FinalizationGroup))
+#define JS_FOR_PROTOTYPES_(REAL, IMAGINARY, REAL_IF_INTL, REAL_IF_BDATA)      \
+  IMAGINARY(Null, dummy)                                                      \
+  REAL(Object, OCLASP(Plain))                                                 \
+  REAL(Function, &JSFunction::class_)                                         \
+  REAL(Array, OCLASP(Array))                                                  \
+  REAL(Boolean, OCLASP(Boolean))                                              \
+  REAL(JSON, CLASP(JSON))                                                     \
+  REAL(Date, OCLASP(Date))                                                    \
+  REAL(Math, CLASP(Math))                                                     \
+  REAL(Number, OCLASP(Number))                                                \
+  REAL(String, OCLASP(String))                                                \
+  REAL(RegExp, OCLASP(RegExp))                                                \
+  REAL(Error, ERROR_CLASP(JSEXN_ERR))                                         \
+  REAL(InternalError, ERROR_CLASP(JSEXN_INTERNALERR))                         \
+  REAL(EvalError, ERROR_CLASP(JSEXN_EVALERR))                                 \
+  REAL(RangeError, ERROR_CLASP(JSEXN_RANGEERR))                               \
+  REAL(ReferenceError, ERROR_CLASP(JSEXN_REFERENCEERR))                       \
+  REAL(SyntaxError, ERROR_CLASP(JSEXN_SYNTAXERR))                             \
+  REAL(TypeError, ERROR_CLASP(JSEXN_TYPEERR))                                 \
+  REAL(URIError, ERROR_CLASP(JSEXN_URIERR))                                   \
+  REAL(DebuggeeWouldRun, ERROR_CLASP(JSEXN_DEBUGGEEWOULDRUN))                 \
+  REAL(CompileError, ERROR_CLASP(JSEXN_WASMCOMPILEERROR))                     \
+  REAL(LinkError, ERROR_CLASP(JSEXN_WASMLINKERROR))                           \
+  REAL(RuntimeError, ERROR_CLASP(JSEXN_WASMRUNTIMEERROR))                     \
+  REAL(ArrayBuffer, OCLASP(ArrayBuffer))                                      \
+  REAL(Int8Array, TYPED_ARRAY_CLASP(Int8))                                    \
+  REAL(Uint8Array, TYPED_ARRAY_CLASP(Uint8))                                  \
+  REAL(Int16Array, TYPED_ARRAY_CLASP(Int16))                                  \
+  REAL(Uint16Array, TYPED_ARRAY_CLASP(Uint16))                                \
+  REAL(Int32Array, TYPED_ARRAY_CLASP(Int32))                                  \
+  REAL(Uint32Array, TYPED_ARRAY_CLASP(Uint32))                                \
+  REAL(Float32Array, TYPED_ARRAY_CLASP(Float32))                              \
+  REAL(Float64Array, TYPED_ARRAY_CLASP(Float64))                              \
+  REAL(Uint8ClampedArray, TYPED_ARRAY_CLASP(Uint8Clamped))                    \
+  REAL(BigInt64Array, TYPED_ARRAY_CLASP(BigInt64))                            \
+  REAL(BigUint64Array, TYPED_ARRAY_CLASP(BigUint64))                          \
+  REAL(BigInt, OCLASP(BigInt))                                                \
+  REAL(Proxy, CLASP(Proxy))                                                   \
+  REAL(WeakMap, OCLASP(WeakMap))                                              \
+  REAL(Map, OCLASP(Map))                                                      \
+  REAL(Set, OCLASP(Set))                                                      \
+  REAL(DataView, OCLASP(DataView))                                            \
+  REAL(Symbol, OCLASP(Symbol))                                                \
+  REAL(SharedArrayBuffer, OCLASP(SharedArrayBuffer))                          \
+  REAL_IF_INTL(Intl, CLASP(Intl))                                             \
+  REAL_IF_INTL(Collator, OCLASP(Collator))                                    \
+  REAL_IF_INTL(DateTimeFormat, OCLASP(DateTimeFormat))                        \
+  REAL_IF_INTL(ListFormat, OCLASP(ListFormat))                                \
+  REAL_IF_INTL(Locale, OCLASP(Locale))                                        \
+  REAL_IF_INTL(NumberFormat, OCLASP(NumberFormat))                            \
+  REAL_IF_INTL(PluralRules, OCLASP(PluralRules))                              \
+  REAL_IF_INTL(RelativeTimeFormat, OCLASP(RelativeTimeFormat))                \
+  REAL_IF_BDATA(TypedObject, OCLASP(TypedObjectModule))                       \
+  REAL(Reflect, CLASP(Reflect))                                               \
+  REAL(WeakSet, OCLASP(WeakSet))                                              \
+  REAL(TypedArray, &js::TypedArrayObject::sharedTypedArrayPrototypeClass)     \
+  REAL(Atomics, OCLASP(Atomics))                                              \
+  REAL(SavedFrame, &js::SavedFrame::class_)                                   \
+  REAL(Promise, OCLASP(Promise))                                              \
+  REAL(AsyncFunction, CLASP(AsyncFunction))                                   \
+  REAL(GeneratorFunction, CLASP(GeneratorFunction))                           \
+  REAL(AsyncGeneratorFunction, CLASP(AsyncGeneratorFunction))                 \
+  REAL(ReadableStream, &js::ReadableStream::class_)                           \
+  REAL(ReadableStreamDefaultReader, &js::ReadableStreamDefaultReader::class_) \
+  REAL(ReadableStreamDefaultController,                                       \
+       &js::ReadableStreamDefaultController::class_)                          \
+  REAL(ReadableByteStreamController,                                          \
+       &js::ReadableByteStreamController::class_)                             \
+  REAL(WritableStream, &js::WritableStream::class_)                           \
+  REAL(WritableStreamDefaultController,                                       \
+       &js::WritableStreamDefaultController::class_)                          \
+  REAL(WritableStreamDefaultWriter, &js::WritableStreamDefaultWriter::class_) \
+  REAL(ByteLengthQueuingStrategy, &js::ByteLengthQueuingStrategy::class_)     \
+  REAL(CountQueuingStrategy, &js::CountQueuingStrategy::class_)               \
+  REAL(WebAssembly, CLASP(WebAssembly))                                       \
+  REAL(WasmModule, OCLASP(WasmModule))                                        \
+  REAL(WasmInstance, OCLASP(WasmInstance))                                    \
+  REAL(WasmMemory, OCLASP(WasmMemory))                                        \
+  REAL(WasmTable, OCLASP(WasmTable))                                          \
+  REAL(WasmGlobal, OCLASP(WasmGlobal))                                        \
+  REAL(FinalizationGroup, OCLASP(FinalizationGroup))
 
 #define JS_FOR_PROTOTYPES(REAL, IMAGINARY)                      \
   JS_FOR_PROTOTYPES_(REAL, IMAGINARY, IF_INTL(REAL, IMAGINARY), \
                      IF_TYPEDOBJ(REAL, IMAGINARY))
 
 #define JS_FOR_EACH_PROTOTYPE(MACRO) JS_FOR_PROTOTYPES(MACRO, MACRO)
 
 #endif /* js_ProtoKey_h */
--- a/js/src/jsapi.cpp
+++ b/js/src/jsapi.cpp
@@ -815,18 +815,18 @@ static const JSStdName* LookupStdName(co
   return nullptr;
 }
 
 /*
  * Table of standard classes, indexed by JSProtoKey. For entries where the
  * JSProtoKey does not correspond to a class with a meaningful constructor, we
  * insert a null entry into the table.
  */
-#define STD_NAME_ENTRY(name, init, clasp) {NAME_OFFSET(name), JSProto_##name},
-#define STD_DUMMY_ENTRY(name, init, dummy) {0, JSProto_Null},
+#define STD_NAME_ENTRY(name, clasp) {NAME_OFFSET(name), JSProto_##name},
+#define STD_DUMMY_ENTRY(name, dummy) {0, JSProto_Null},
 static const JSStdName standard_class_names[] = {
     JS_FOR_PROTOTYPES(STD_NAME_ENTRY, STD_DUMMY_ENTRY){0, JSProto_LIMIT}};
 
 /*
  * Table of top-level function and constant names and the JSProtoKey of the
  * standard class that initializes them.
  */
 static const JSStdName builtin_property_names[] = {
--- a/js/src/jspubtd.h
+++ b/js/src/jspubtd.h
@@ -41,17 +41,17 @@ enum JSType {
   JSTYPE_NULL,      /* null */
   JSTYPE_SYMBOL,    /* symbol */
   JSTYPE_BIGINT,    /* BigInt */
   JSTYPE_LIMIT
 };
 
 /* Dense index into cached prototypes and class atoms for standard objects. */
 enum JSProtoKey {
-#define PROTOKEY_AND_INITIALIZER(name, init, clasp) JSProto_##name,
+#define PROTOKEY_AND_INITIALIZER(name, clasp) JSProto_##name,
   JS_FOR_EACH_PROTOTYPE(PROTOKEY_AND_INITIALIZER)
 #undef PROTOKEY_AND_INITIALIZER
       JSProto_LIMIT
 };
 
 /* Struct forward declarations. */
 struct JS_PUBLIC_API JSClass;
 class JSErrorReport;
--- a/js/src/vm/GlobalObject.cpp
+++ b/js/src/vm/GlobalObject.cpp
@@ -60,51 +60,37 @@
 #include "gc/FreeOp-inl.h"
 #include "vm/JSObject-inl.h"
 #include "vm/JSScript-inl.h"
 #include "vm/NativeObject-inl.h"
 #include "vm/Realm-inl.h"
 
 using namespace js;
 
-struct ProtoTableEntry {
-  const JSClass* clasp;
-  ClassInitializerOp init;
-};
-
 namespace js {
 
 extern const JSClass IntlClass;
 extern const JSClass JSONClass;
 extern const JSClass MathClass;
 extern const JSClass ReflectClass;
 extern const JSClass WebAssemblyClass;
 
-#define DECLARE_PROTOTYPE_CLASS_INIT(name, init, clasp) \
-  extern JSObject* init(JSContext* cx, Handle<GlobalObject*> global);
-JS_FOR_EACH_PROTOTYPE(DECLARE_PROTOTYPE_CLASS_INIT)
-#undef DECLARE_PROTOTYPE_CLASS_INIT
-
 }  // namespace js
 
-JSObject* js::InitViaClassSpec(JSContext* cx, Handle<GlobalObject*> global) {
-  MOZ_CRASH("InitViaClassSpec() should not be called.");
-}
-
-static const ProtoTableEntry protoTable[JSProto_LIMIT] = {
-#define INIT_FUNC(name, init, clasp) {clasp, init},
-#define INIT_FUNC_DUMMY(name, init, clasp) {nullptr, nullptr},
+static const JSClass* const protoTable[JSProto_LIMIT] = {
+#define INIT_FUNC(name, clasp) clasp,
+#define INIT_FUNC_DUMMY(name, clasp) nullptr,
     JS_FOR_PROTOTYPES(INIT_FUNC, INIT_FUNC_DUMMY)
 #undef INIT_FUNC_DUMMY
 #undef INIT_FUNC
 };
 
 JS_FRIEND_API const JSClass* js::ProtoKeyToClass(JSProtoKey key) {
   MOZ_ASSERT(key < JSProto_LIMIT);
-  return protoTable[key].clasp;
+  return protoTable[key];
 }
 
 // This method is not in the header file to avoid having to include
 // TypedObject.h from GlobalObject.h. It is not generally perf
 // sensitive.
 TypedObjectModuleObject& js::GlobalObject::getTypedObjectModule() const {
   Value v = getConstructor(JSProto_TypedObject);
   // only gets called from contexts where TypedObject must be initialized
@@ -171,59 +157,34 @@ bool GlobalObject::resolveConstructor(JS
   // an allocation that re-entrantly tries to create the same prototype.
   AutoSuppressAllocationMetadataBuilder suppressMetadata(cx);
 
   // Constructor resolution may execute self-hosted scripts. These
   // self-hosted scripts do not call out to user code by construction. Allow
   // all scripts to execute, even in debuggee compartments that are paused.
   AutoSuppressDebuggeeNoExecuteChecks suppressNX(cx);
 
-  // There are two different kinds of initialization hooks. One of them is
-  // the class js::InitFoo hook, defined in a JSProtoKey-keyed table at the
-  // top of this file. The other lives in the ClassSpec for classes that
-  // define it. Classes may use one or the other, but not both.
-  ClassInitializerOp init = protoTable[key].init;
-  if (init == InitViaClassSpec) {
-    init = nullptr;
-  }
-
   // Some classes can be disabled at compile time, others at run time;
-  // if a feature is compile-time disabled, init and clasp are both null.
+  // if a feature is compile-time disabled, clasp is null.
   const JSClass* clasp = ProtoKeyToClass(key);
-  if ((!init && !clasp) || skipDeselectedConstructor(cx, key)) {
+  if (!clasp || skipDeselectedConstructor(cx, key)) {
     if (mode == IfClassIsDisabled::Throw) {
       JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr,
                                 JSMSG_CONSTRUCTOR_DISABLED,
                                 clasp ? clasp->name : "constructor");
       return false;
     }
     return true;
   }
 
-  // Some classes have no init routine, which means that they're disabled at
-  // compile-time. We could try to enforce that callers never pass such keys
-  // to resolveConstructor, but that would cramp the style of consumers like
-  // GlobalObject::initStandardClasses that want to just carpet-bomb-call
-  // resolveConstructor with every JSProtoKey. So it's easier to just handle
-  // it here.
-  bool haveSpec = clasp && clasp->specDefined();
-  if (!init && !haveSpec) {
+  // Class spec must have a constructor defined.
+  if (!clasp->specDefined()) {
     return true;
   }
 
-  // See if there's an old-style initialization hook.
-  if (init) {
-    MOZ_ASSERT(!haveSpec);
-    return init(cx, global);
-  }
-
-  //
-  // Ok, we're doing it with a class spec.
-  //
-
   bool isObjectOrFunction = key == JSProto_Function || key == JSProto_Object;
 
   // We need to create the prototype first, and immediately stash it in the
   // slot. This is so the following bootstrap ordering is possible:
   // * Object.prototype
   // * Function.prototype
   // * Function
   // * Object
--- a/js/src/vm/JSAtom.cpp
+++ b/js/src/vm/JSAtom.cpp
@@ -187,18 +187,17 @@ inline JSAtom* js::AtomStateEntry::asPtr
   }
   return atom;
 }
 
 UniqueChars js::AtomToPrintableString(JSContext* cx, JSAtom* atom) {
   return QuoteString(cx, atom);
 }
 
-#define DEFINE_PROTO_STRING(name, init, clasp) \
-  const char js_##name##_str[] = #name;
+#define DEFINE_PROTO_STRING(name, clasp) const char js_##name##_str[] = #name;
 JS_FOR_EACH_PROTOTYPE(DEFINE_PROTO_STRING)
 #undef DEFINE_PROTO_STRING
 
 #define CONST_CHAR_STR(idpart, id, text) const char js_##idpart##_str[] = text;
 FOR_EACH_COMMON_PROPERTYNAME(CONST_CHAR_STR)
 #undef CONST_CHAR_STR
 
 // Use a low initial capacity for the permanent atoms table to avoid penalizing
@@ -246,18 +245,17 @@ bool JSRuntime::initializeAtoms(JSContex
     return false;
   }
 
   static const CommonNameInfo cachedNames[] = {
 #define COMMON_NAME_INFO(idpart, id, text) \
   {js_##idpart##_str, sizeof(text) - 1},
       FOR_EACH_COMMON_PROPERTYNAME(COMMON_NAME_INFO)
 #undef COMMON_NAME_INFO
-#define COMMON_NAME_INFO(name, init, clasp) \
-  {js_##name##_str, sizeof(#name) - 1},
+#define COMMON_NAME_INFO(name, clasp) {js_##name##_str, sizeof(#name) - 1},
           JS_FOR_EACH_PROTOTYPE(COMMON_NAME_INFO)
 #undef COMMON_NAME_INFO
 #define COMMON_NAME_INFO(name) {#name, sizeof(#name) - 1},
               JS_FOR_EACH_WELL_KNOWN_SYMBOL(COMMON_NAME_INFO)
 #undef COMMON_NAME_INFO
 #define COMMON_NAME_INFO(name) {"Symbol." #name, sizeof("Symbol." #name) - 1},
                   JS_FOR_EACH_WELL_KNOWN_SYMBOL(COMMON_NAME_INFO)
 #undef COMMON_NAME_INFO
--- a/js/src/vm/JSAtom.h
+++ b/js/src/vm/JSAtom.h
@@ -22,18 +22,17 @@ namespace js {
  */
 extern UniqueChars AtomToPrintableString(JSContext* cx, JSAtom* atom);
 
 class PropertyName;
 
 } /* namespace js */
 
 /* Well-known predefined C strings. */
-#define DECLARE_PROTO_STR(name, init, clasp) \
-  extern const char js_##name##_str[];
+#define DECLARE_PROTO_STR(name, clasp) extern const char js_##name##_str[];
 JS_FOR_EACH_PROTOTYPE(DECLARE_PROTO_STR)
 #undef DECLARE_PROTO_STR
 
 #define DECLARE_CONST_CHAR_STR(idpart, id, text) \
   extern const char js_##idpart##_str[];
 FOR_EACH_COMMON_PROPERTYNAME(DECLARE_CONST_CHAR_STR)
 #undef DECLARE_CONST_CHAR_STR
 
--- a/js/src/vm/JSObject.cpp
+++ b/js/src/vm/JSObject.cpp
@@ -3410,19 +3410,19 @@ void GetObjectSlotNameFunctor::operator(
     do {
       const char* slotname = nullptr;
       const char* pattern = nullptr;
       if (obj->is<GlobalObject>()) {
         pattern = "CLASS_OBJECT(%s)";
         if (false) {
           ;
         }
-#define TEST_SLOT_MATCHES_PROTOTYPE(name, init, clasp) \
-  else if ((JSProto_##name) == slot) {                 \
-    slotname = js_##name##_str;                        \
+#define TEST_SLOT_MATCHES_PROTOTYPE(name, clasp) \
+  else if ((JSProto_##name) == slot) {           \
+    slotname = js_##name##_str;                  \
   }
         JS_FOR_EACH_PROTOTYPE(TEST_SLOT_MATCHES_PROTOTYPE)
 #undef TEST_SLOT_MATCHES_PROTOTYPE
       } else {
         pattern = "%s";
         if (obj->is<EnvironmentObject>()) {
           if (slot == EnvironmentObject::enclosingEnvironmentSlot()) {
             slotname = "enclosing_environment";
--- a/js/src/vm/JSObject.h
+++ b/js/src/vm/JSObject.h
@@ -805,21 +805,16 @@ MOZ_ALWAYS_INLINE const char* GetObjectC
  * types of environment.
  */
 Value GetThisValue(JSObject* obj);
 
 Value GetThisValueOfLexical(JSObject* env);
 
 Value GetThisValueOfWith(JSObject* env);
 
-/* * */
-
-using ClassInitializerOp = JSObject* (*)(JSContext* cx,
-                                         Handle<GlobalObject*> global);
-
 } /* namespace js */
 
 namespace js {
 
 bool NewObjectWithTaggedProtoIsCachable(JSContext* cx,
                                         Handle<TaggedProto> proto,
                                         NewObjectKind newKind,
                                         const JSClass* clasp);
--- a/js/src/vm/Runtime.h
+++ b/js/src/vm/Runtime.h
@@ -129,17 +129,17 @@ namespace JS {
 struct RuntimeSizes;
 }  // namespace JS
 
 /* Various built-in or commonly-used names pinned on first context. */
 struct JSAtomState {
 #define PROPERTYNAME_FIELD(idpart, id, text) js::ImmutablePropertyNamePtr id;
   FOR_EACH_COMMON_PROPERTYNAME(PROPERTYNAME_FIELD)
 #undef PROPERTYNAME_FIELD
-#define PROPERTYNAME_FIELD(name, init, clasp) js::ImmutablePropertyNamePtr name;
+#define PROPERTYNAME_FIELD(name, clasp) js::ImmutablePropertyNamePtr name;
   JS_FOR_EACH_PROTOTYPE(PROPERTYNAME_FIELD)
 #undef PROPERTYNAME_FIELD
 #define PROPERTYNAME_FIELD(name) js::ImmutablePropertyNamePtr name;
   JS_FOR_EACH_WELL_KNOWN_SYMBOL(PROPERTYNAME_FIELD)
 #undef PROPERTYNAME_FIELD
 #define PROPERTYNAME_FIELD(name) js::ImmutablePropertyNamePtr Symbol_##name;
   JS_FOR_EACH_WELL_KNOWN_SYMBOL(PROPERTYNAME_FIELD)
 #undef PROPERTYNAME_FIELD