Bug 1508064 - Simplify JS_FOR_PROTOTYPES. r=jandem
authorTed Campbell <tcampbell@mozilla.com>
Mon, 19 Nov 2018 13:54:02 +0000
changeset 503443 a50839e591523919115247c6bc8290c505fede76
parent 503442 87037e14247bbd23e32dd9084262b5aabe9bbf8d
child 503444 1963c82b5abf500d7b8f5d843896028bd2380615
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem
bugs1508064
milestone65.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 1508064 - Simplify JS_FOR_PROTOTYPES. r=jandem Add JS_FOR_PROTOTYPES_ macro that takes REAL_IF_SAB, etc helpers to handle conditional proto keys. This is easier to read and avoids macro expansion issues confusing clang-format. Differential Revision: https://phabricator.services.mozilla.com/D12238
js/public/ProtoKey.h
--- a/js/public/ProtoKey.h
+++ b/js/public/ProtoKey.h
@@ -49,17 +49,18 @@
 #endif
 
 #ifdef ENABLE_SHARED_ARRAY_BUFFER
 #define IF_SAB(REAL,IMAGINARY) REAL
 #else
 #define IF_SAB(REAL,IMAGINARY) IMAGINARY
 #endif
 
-#define JS_FOR_PROTOTYPES(REAL,IMAGINARY) \
+#define JS_FOR_PROTOTYPES_(REAL, IMAGINARY, \
+                           REAL_IF_INTL, REAL_IF_BDATA, REAL_IF_SAB, REAL_IF_BIGINT) \
     IMAGINARY(Null,             InitNullClass,          dummy) \
     REAL(Object,                InitViaClassSpec,       OCLASP(Plain)) \
     REAL(Function,              InitViaClassSpec,       &JSFunction::class_) \
     REAL(Array,                 InitViaClassSpec,       OCLASP(Array)) \
     REAL(Boolean,               InitBooleanClass,       OCLASP(Boolean)) \
     REAL(JSON,                  InitJSONClass,          CLASP(JSON)) \
     REAL(Date,                  InitViaClassSpec,       OCLASP(Date)) \
     REAL(Math,                  InitMathClass,          CLASP(Math)) \
@@ -83,30 +84,30 @@
     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)) \
-IF_BIGINT(REAL,IMAGINARY)(BigInt, InitViaClassSpec, OCLASP(BigInt)) \
+    REAL_IF_BIGINT(BigInt, InitViaClassSpec, OCLASP(BigInt)) \
     REAL(Proxy,                 InitProxyClass,         &js::ProxyClass) \
     REAL(WeakMap,               InitWeakMapClass,       OCLASP(WeakMap)) \
     REAL(Map,                   InitViaClassSpec,       OCLASP(Map)) \
     REAL(Set,                   InitViaClassSpec,       OCLASP(Set)) \
     REAL(DataView,              InitViaClassSpec,       OCLASP(DataView)) \
     REAL(Symbol,                InitSymbolClass,        OCLASP(Symbol)) \
-IF_SAB(REAL,IMAGINARY)(SharedArrayBuffer,       InitViaClassSpec, OCLASP(SharedArrayBuffer)) \
-IF_INTL(REAL,IMAGINARY) (Intl,                  InitIntlClass,          CLASP(Intl)) \
-IF_BDATA(REAL,IMAGINARY)(TypedObject,           InitTypedObjectModuleObject,   OCLASP(TypedObjectModule)) \
+    REAL_IF_SAB(SharedArrayBuffer, InitViaClassSpec, OCLASP(SharedArrayBuffer)) \
+    REAL_IF_INTL(Intl, InitIntlClass, CLASP(Intl)) \
+    REAL_IF_BDATA(TypedObject, InitTypedObjectModuleObject, OCLASP(TypedObjectModule)) \
     REAL(Reflect,               InitReflect,            nullptr) \
     REAL(WeakSet,               InitWeakSetClass,       OCLASP(WeakSet)) \
     REAL(TypedArray,            InitViaClassSpec,       &js::TypedArrayObject::sharedTypedArrayPrototypeClass) \
-IF_SAB(REAL,IMAGINARY)(Atomics, InitAtomicsClass, OCLASP(Atomics)) \
+    REAL_IF_SAB(Atomics, InitAtomicsClass, OCLASP(Atomics)) \
     REAL(SavedFrame,            InitViaClassSpec,       &js::SavedFrame::class_) \
     REAL(Promise,               InitViaClassSpec,       OCLASP(Promise)) \
     REAL(ReadableStream,        InitViaClassSpec,       &js::ReadableStream::class_) \
     REAL(ReadableStreamDefaultReader,           InitViaClassSpec, &js::ReadableStreamDefaultReader::class_) \
     REAL(ReadableStreamDefaultController,       InitViaClassSpec, &js::ReadableStreamDefaultController::class_) \
     REAL(ReadableByteStreamController,          InitViaClassSpec, &js::ReadableByteStreamController::class_) \
     IMAGINARY(WritableStream,   dummy,                  dummy) \
     IMAGINARY(WritableStreamDefaultWriter,      dummy,  dummy) \
@@ -115,11 +116,19 @@ IF_SAB(REAL,IMAGINARY)(Atomics, InitAtom
     REAL(CountQueuingStrategy,  InitViaClassSpec,       &js::CountQueuingStrategy::class_) \
     REAL(WebAssembly,           InitWebAssemblyClass,   CLASP(WebAssembly)) \
     IMAGINARY(WasmModule,       dummy,                  dummy) \
     IMAGINARY(WasmInstance,     dummy,                  dummy) \
     IMAGINARY(WasmMemory,       dummy,                  dummy) \
     IMAGINARY(WasmTable,        dummy,                  dummy) \
     IMAGINARY(WasmGlobal,       dummy,                  dummy) \
 
+#define JS_FOR_PROTOTYPES(REAL, IMAGINARY) \
+    JS_FOR_PROTOTYPES_(REAL, \
+                       IMAGINARY, \
+                       IF_INTL(REAL, IMAGINARY), \
+                       IF_BDATA(REAL, IMAGINARY), \
+                       IF_SAB(REAL, IMAGINARY), \
+                       IF_BIGINT(REAL, IMAGINARY))
+
 #define JS_FOR_EACH_PROTOTYPE(MACRO) JS_FOR_PROTOTYPES(MACRO,MACRO)
 
 #endif /* js_ProtoKey_h */