diff --git a/dom/bindings/BindingUtils.h b/dom/bindings/BindingUtils.h index a62a74f61af27..0eabf0ef42792 100644 --- a/dom/bindings/BindingUtils.h +++ b/dom/bindings/BindingUtils.h @@ -967,7 +967,6 @@ MOZ_ALWAYS_INLINE bool MaybeWrapValue(JSContext* cx, if (rval.isObject()) { return MaybeWrapObjectValue(cx, rval); } -#ifdef ENABLE_BIGINT // This could be optimized by checking the zone first, similar to // the way strings are handled. At present, this is used primarily // for structured cloning, so avoiding the overhead of JS_WrapValue @@ -975,7 +974,6 @@ MOZ_ALWAYS_INLINE bool MaybeWrapValue(JSContext* cx, if (rval.isBigInt()) { return JS_WrapValue(cx, rval); } -#endif MOZ_ASSERT(rval.isSymbol()); JS_MarkCrossZoneId(cx, SYMBOL_TO_JSID(rval.toSymbol())); } diff --git a/js/moz.configure b/js/moz.configure index cd26f93e8d961..8c799253c19ad 100644 --- a/js/moz.configure +++ b/js/moz.configure @@ -107,19 +107,6 @@ def disable_export_js(value): die('Setting %s is deprecated, use %s instead.', value.format('DISABLE_EXPORT_JS'), suggestion) -# Experimental BigInt support -# ======================================================= -js_option('--disable-bigint', - help='{Enable|Disable} BigInt') - -@depends('--disable-bigint') -def enable_bigint(value): - if value: - return True - -set_config('ENABLE_BIGINT', enable_bigint) -set_define('ENABLE_BIGINT', enable_bigint) - # JIT support # ======================================================= @depends(target) diff --git a/js/public/Class.h b/js/public/Class.h index 9da1b863a7354..c04694cee39c2 100644 --- a/js/public/Class.h +++ b/js/public/Class.h @@ -1038,9 +1038,7 @@ enum class ESClass { SetIterator, Arguments, Error, -#ifdef ENABLE_BIGINT BigInt, -#endif /** None of the above. */ Other diff --git a/js/public/CompileOptions.h b/js/public/CompileOptions.h index 7d8e462cdba49..8fa95a201215d 100644 --- a/js/public/CompileOptions.h +++ b/js/public/CompileOptions.h @@ -116,9 +116,7 @@ class JS_PUBLIC_API TransitiveCompileOptions { bool allowHTMLComments = true; bool isProbablySystemCode = false; bool hideScriptFromDebugger = false; -#ifdef ENABLE_BIGINT bool bigIntEnabledOption = false; -#endif /** * |introductionType| is a statically allocated C string: one of "eval", diff --git a/js/public/GCPolicyAPI.h b/js/public/GCPolicyAPI.h index 7d2185a96f23a..9eb1644e0fc35 100644 --- a/js/public/GCPolicyAPI.h +++ b/js/public/GCPolicyAPI.h @@ -47,7 +47,7 @@ // Expand the given macro D for each public GC pointer. #define FOR_EACH_PUBLIC_GC_POINTER_TYPE(D) \ D(JS::Symbol*) \ - IF_BIGINT(D(JS::BigInt*), ) \ + D(JS::BigInt*) \ D(JSAtom*) \ D(JSFunction*) \ D(JSObject*) \ diff --git a/js/public/MemoryMetrics.h b/js/public/MemoryMetrics.h index 4236439a5b401..69d27259743e8 100644 --- a/js/public/MemoryMetrics.h +++ b/js/public/MemoryMetrics.h @@ -569,7 +569,7 @@ struct UnusedGCThingSizes { MACRO(Other, GCHeapUnused, objectGroup) \ MACRO(Other, GCHeapUnused, string) \ MACRO(Other, GCHeapUnused, symbol) \ - IF_BIGINT(MACRO(Other, GCHeapUnused, bigInt), ) \ + MACRO(Other, GCHeapUnused, bigInt) \ MACRO(Other, GCHeapUnused, jitcode) \ MACRO(Other, GCHeapUnused, scope) \ MACRO(Other, GCHeapUnused, regExpShared) @@ -590,11 +590,9 @@ struct UnusedGCThingSizes { case JS::TraceKind::Symbol: symbol += n; break; -#ifdef ENABLE_BIGINT case JS::TraceKind::BigInt: bigInt += n; break; -#endif case JS::TraceKind::Script: script += n; break; @@ -648,8 +646,8 @@ struct UnusedGCThingSizes { struct ZoneStats { #define FOR_EACH_SIZE(MACRO) \ MACRO(Other, GCHeapUsed, symbolsGCHeap) \ - IF_BIGINT(MACRO(Other, GCHeapUsed, bigIntsGCHeap), ) \ - IF_BIGINT(MACRO(Other, MallocHeap, bigIntsMallocHeap), ) \ + MACRO(Other, GCHeapUsed, bigIntsGCHeap) \ + MACRO(Other, MallocHeap, bigIntsMallocHeap) \ MACRO(Other, GCHeapAdmin, gcHeapArenaAdmin) \ MACRO(Other, GCHeapUsed, lazyScriptsGCHeap) \ MACRO(Other, MallocHeap, lazyScriptsMallocHeap) \ diff --git a/js/public/ProtoKey.h b/js/public/ProtoKey.h index ddce5f0add8ef..a4427b15e215d 100644 --- a/js/public/ProtoKey.h +++ b/js/public/ProtoKey.h @@ -55,7 +55,7 @@ #endif #define JS_FOR_PROTOTYPES_(REAL, IMAGINARY, REAL_IF_INTL, REAL_IF_BDATA, \ - REAL_IF_SAB, REAL_IF_BIGINT) \ + REAL_IF_SAB) \ IMAGINARY(Null, InitNullClass, dummy) \ REAL(Object, InitViaClassSpec, OCLASP(Plain)) \ REAL(Function, InitViaClassSpec, &JSFunction::class_) \ @@ -90,7 +90,7 @@ REAL(Float32Array, InitViaClassSpec, TYPED_ARRAY_CLASP(Float32)) \ REAL(Float64Array, InitViaClassSpec, TYPED_ARRAY_CLASP(Float64)) \ REAL(Uint8ClampedArray, InitViaClassSpec, TYPED_ARRAY_CLASP(Uint8Clamped)) \ - REAL_IF_BIGINT(BigInt, InitViaClassSpec, OCLASP(BigInt)) \ + REAL(BigInt, InitViaClassSpec, OCLASP(BigInt)) \ REAL(Proxy, InitProxyClass, &js::ProxyClass) \ REAL(WeakMap, InitViaClassSpec, OCLASP(WeakMap)) \ REAL(Map, InitViaClassSpec, OCLASP(Map)) \ @@ -131,8 +131,7 @@ #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)) + IF_BDATA(REAL, IMAGINARY), IF_SAB(REAL, IMAGINARY)) #define JS_FOR_EACH_PROTOTYPE(MACRO) JS_FOR_PROTOTYPES(MACRO, MACRO) diff --git a/js/public/TraceKind.h b/js/public/TraceKind.h index b67dbb17584ff..574f6b1b3ab80 100644 --- a/js/public/TraceKind.h +++ b/js/public/TraceKind.h @@ -62,9 +62,7 @@ enum class TraceKind { LazyScript = 0x2F, Scope = 0x3F, RegExpShared = 0x4F, -#ifdef ENABLE_BIGINT BigInt = 0x5F -#endif }; const static uintptr_t OutOfLineTraceKindMask = 0x07; @@ -113,7 +111,7 @@ struct MapTypeToTraceKind { D(Shape, js::Shape, true) \ D(String, JSString, false) \ D(Symbol, JS::Symbol, false) \ - IF_BIGINT(D(BigInt, JS::BigInt, false), ) \ + D(BigInt, JS::BigInt, false) \ D(RegExpShared, js::RegExpShared, true) // Map from all public types to their trace kind. diff --git a/js/public/TracingAPI.h b/js/public/TracingAPI.h index 633b4aafdb228..07942bb4e13fc 100644 --- a/js/public/TracingAPI.h +++ b/js/public/TracingAPI.h @@ -159,9 +159,7 @@ class JS_PUBLIC_API CallbackTracer : public JSTracer { virtual void onSymbolEdge(JS::Symbol** symp) { onChild(JS::GCCellPtr(*symp)); } -#ifdef ENABLE_BIGINT virtual void onBigIntEdge(JS::BigInt** bip) { onChild(JS::GCCellPtr(*bip)); } -#endif virtual void onScriptEdge(JSScript** scriptp) { onChild(JS::GCCellPtr(*scriptp)); } @@ -259,9 +257,7 @@ class JS_PUBLIC_API CallbackTracer : public JSTracer { void dispatchToOnEdge(JSObject** objp) { onObjectEdge(objp); } void dispatchToOnEdge(JSString** strp) { onStringEdge(strp); } void dispatchToOnEdge(JS::Symbol** symp) { onSymbolEdge(symp); } -#ifdef ENABLE_BIGINT void dispatchToOnEdge(JS::BigInt** bip) { onBigIntEdge(bip); } -#endif void dispatchToOnEdge(JSScript** scriptp) { onScriptEdge(scriptp); } void dispatchToOnEdge(js::Shape** shapep) { onShapeEdge(shapep); } void dispatchToOnEdge(js::ObjectGroup** groupp) { onObjectGroupEdge(groupp); } diff --git a/js/public/TypeDecls.h b/js/public/TypeDecls.h index 4370b4b92f0e0..5fae7562d6f6c 100644 --- a/js/public/TypeDecls.h +++ b/js/public/TypeDecls.h @@ -40,9 +40,7 @@ struct PropertyKey; typedef unsigned char Latin1Char; class Symbol; -#ifdef ENABLE_BIGINT class BigInt; -#endif union Value; class Compartment; @@ -65,9 +63,7 @@ typedef Handle HandleObject; typedef Handle HandleScript; typedef Handle HandleString; typedef Handle HandleSymbol; -#ifdef ENABLE_BIGINT typedef Handle HandleBigInt; -#endif typedef Handle HandleValue; typedef MutableHandle MutableHandleFunction; @@ -76,9 +72,7 @@ typedef MutableHandle MutableHandleObject; typedef MutableHandle MutableHandleScript; typedef MutableHandle MutableHandleString; typedef MutableHandle MutableHandleSymbol; -#ifdef ENABLE_BIGINT typedef MutableHandle MutableHandleBigInt; -#endif typedef MutableHandle MutableHandleValue; typedef Rooted RootedObject; @@ -86,9 +80,7 @@ typedef Rooted RootedFunction; typedef Rooted RootedScript; typedef Rooted RootedString; typedef Rooted RootedSymbol; -#ifdef ENABLE_BIGINT typedef Rooted RootedBigInt; -#endif typedef Rooted RootedId; typedef Rooted RootedValue; @@ -98,19 +90,11 @@ typedef PersistentRooted PersistentRootedObject; typedef PersistentRooted PersistentRootedScript; typedef PersistentRooted PersistentRootedString; typedef PersistentRooted PersistentRootedSymbol; -#ifdef ENABLE_BIGINT typedef PersistentRooted PersistentRootedBigInt; -#endif typedef PersistentRooted PersistentRootedValue; } // namespace JS using jsid = JS::PropertyKey; -#ifdef ENABLE_BIGINT -# define IF_BIGINT(x, y) x -#else -# define IF_BIGINT(x, y) y -#endif - #endif /* js_TypeDecls_h */ diff --git a/js/public/UbiNode.h b/js/public/UbiNode.h index 417839c5994e9..8758f2f6bd9b2 100644 --- a/js/public/UbiNode.h +++ b/js/public/UbiNode.h @@ -1080,7 +1080,6 @@ class JS_PUBLIC_API Concrete : TracerConcrete { static const char16_t concreteTypeName[]; }; -#ifdef ENABLE_BIGINT template <> class JS_PUBLIC_API Concrete : TracerConcrete { protected: @@ -1096,7 +1095,6 @@ class JS_PUBLIC_API Concrete : TracerConcrete { const char16_t* typeName() const override { return concreteTypeName; } static const char16_t concreteTypeName[]; }; -#endif template <> class JS_PUBLIC_API Concrete : TracerConcreteWithRealm { diff --git a/js/public/Value.h b/js/public/Value.h index c58d3b2069652..bdd42a5331e70 100644 --- a/js/public/Value.h +++ b/js/public/Value.h @@ -61,9 +61,7 @@ enum JSValueType : uint8_t { JSVAL_TYPE_STRING = 0x06, JSVAL_TYPE_SYMBOL = 0x07, JSVAL_TYPE_PRIVATE_GCTHING = 0x08, -#ifdef ENABLE_BIGINT JSVAL_TYPE_BIGINT = 0x09, -#endif JSVAL_TYPE_OBJECT = 0x0c, // These never appear in a jsval; they are only provided as an out-of-band @@ -87,9 +85,7 @@ JS_ENUM_HEADER(JSValueTag, uint32_t){ JSVAL_TAG_STRING = JSVAL_TAG_CLEAR | JSVAL_TYPE_STRING, JSVAL_TAG_SYMBOL = JSVAL_TAG_CLEAR | JSVAL_TYPE_SYMBOL, JSVAL_TAG_PRIVATE_GCTHING = JSVAL_TAG_CLEAR | JSVAL_TYPE_PRIVATE_GCTHING, -# ifdef ENABLE_BIGINT JSVAL_TAG_BIGINT = JSVAL_TAG_CLEAR | JSVAL_TYPE_BIGINT, -# endif JSVAL_TAG_OBJECT = JSVAL_TAG_CLEAR | JSVAL_TYPE_OBJECT} JS_ENUM_FOOTER(JSValueTag); @@ -109,9 +105,7 @@ JS_ENUM_HEADER(JSValueTag, uint32_t){ JSVAL_TAG_SYMBOL = JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_SYMBOL, JSVAL_TAG_PRIVATE_GCTHING = JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_PRIVATE_GCTHING, -# ifdef ENABLE_BIGINT JSVAL_TAG_BIGINT = JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_BIGINT, -# endif JSVAL_TAG_OBJECT = JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_OBJECT} JS_ENUM_FOOTER(JSValueTag); @@ -132,9 +126,7 @@ enum JSValueShiftedTag : uint64_t { JSVAL_SHIFTED_TAG_SYMBOL = (((uint64_t)JSVAL_TAG_SYMBOL) << JSVAL_TAG_SHIFT), JSVAL_SHIFTED_TAG_PRIVATE_GCTHING = (((uint64_t)JSVAL_TAG_PRIVATE_GCTHING) << JSVAL_TAG_SHIFT), -# ifdef ENABLE_BIGINT JSVAL_SHIFTED_TAG_BIGINT = (((uint64_t)JSVAL_TAG_BIGINT) << JSVAL_TAG_SHIFT), -# endif JSVAL_SHIFTED_TAG_OBJECT = (((uint64_t)JSVAL_TAG_OBJECT) << JSVAL_TAG_SHIFT) }; @@ -357,9 +349,7 @@ union alignas(8) Value { uint32_t boo_; // Don't use |bool| -- it must be four bytes. JSString* str_; JS::Symbol* sym_; -# ifdef ENABLE_BIGINT JS::BigInt* bi_; -# endif JSObject* obj_; js::gc::Cell* cell_; void* ptr_; @@ -458,12 +448,10 @@ union alignas(8) Value { asBits_ = bitsFromTagAndPayload(JSVAL_TAG_SYMBOL, PayloadType(sym)); } -#ifdef ENABLE_BIGINT void setBigInt(JS::BigInt* bi) { MOZ_ASSERT(js::gc::IsCellPointerValid(bi)); asBits_ = bitsFromTagAndPayload(JSVAL_TAG_BIGINT, PayloadType(bi)); } -#endif void setObject(JSObject& obj) { MOZ_ASSERT(js::gc::IsCellPointerValid(&obj)); @@ -611,9 +599,7 @@ union alignas(8) Value { bool isSymbol() const { return toTag() == JSVAL_TAG_SYMBOL; } -#ifdef ENABLE_BIGINT bool isBigInt() const { return toTag() == JSVAL_TAG_BIGINT; } -#endif bool isObject() const { #if defined(JS_NUNBOX32) @@ -671,11 +657,9 @@ union alignas(8) Value { if (MOZ_UNLIKELY(isPrivateGCThing())) { return JS::GCThingTraceKind(toGCThing()); } -#ifdef ENABLE_BIGINT if (MOZ_UNLIKELY(isBigInt())) { return JS::TraceKind::BigInt; } -#endif return JS::TraceKind(toTag() & 0x03); } @@ -736,7 +720,6 @@ union alignas(8) Value { #endif } -#ifdef ENABLE_BIGINT JS::BigInt* toBigInt() const { MOZ_ASSERT(isBigInt()); # if defined(JS_NUNBOX32) @@ -745,7 +728,6 @@ union alignas(8) Value { return reinterpret_cast(asBits_ ^ JSVAL_SHIFTED_TAG_BIGINT); # endif } -#endif JSObject& toObject() const { MOZ_ASSERT(isObject()); @@ -861,11 +843,9 @@ union alignas(8) Value { MOZ_ASSERT(JS::GCThingTraceKind(cell) != JS::TraceKind::Symbol, "Private GC thing Values must not be symbols. Make a " "SymbolValue instead."); -#ifdef ENABLE_BIGINT MOZ_ASSERT(JS::GCThingTraceKind(cell) != JS::TraceKind::BigInt, "Private GC thing Values must not be BigInts. Make a " "BigIntValue instead."); -#endif MOZ_ASSERT(JS::GCThingTraceKind(cell) != JS::TraceKind::Object, "Private GC thing Values must not be objects. Make an " "ObjectValue instead."); @@ -969,13 +949,11 @@ static inline Value SymbolValue(JS::Symbol* sym) { return v; } -#ifdef ENABLE_BIGINT static inline Value BigIntValue(JS::BigInt* bi) { Value v; v.setBigInt(bi); return v; } -#endif static inline Value BooleanValue(bool boo) { Value v; @@ -1178,9 +1156,7 @@ class WrappedPtrOperations { bool isDouble() const { return value().isDouble(); } bool isString() const { return value().isString(); } bool isSymbol() const { return value().isSymbol(); } -#ifdef ENABLE_BIGINT bool isBigInt() const { return value().isBigInt(); } -#endif bool isObject() const { return value().isObject(); } bool isMagic() const { return value().isMagic(); } bool isMagic(JSWhyMagic why) const { return value().isMagic(why); } @@ -1196,9 +1172,7 @@ class WrappedPtrOperations { double toDouble() const { return value().toDouble(); } JSString* toString() const { return value().toString(); } JS::Symbol* toSymbol() const { return value().toSymbol(); } -#ifdef ENABLE_BIGINT JS::BigInt* toBigInt() const { return value().toBigInt(); } -#endif JSObject& toObject() const { return value().toObject(); } JSObject* toObjectOrNull() const { return value().toObjectOrNull(); } gc::Cell* toGCThing() const { return value().toGCThing(); } @@ -1238,9 +1212,7 @@ class MutableWrappedPtrOperations bool setNumber(double d) { return value().setNumber(d); } void setString(JSString* str) { this->value().setString(str); } void setSymbol(JS::Symbol* sym) { this->value().setSymbol(sym); } -#ifdef ENABLE_BIGINT void setBigInt(JS::BigInt* bi) { this->value().setBigInt(bi); } -#endif void setObject(JSObject& obj) { this->value().setObject(obj); } void setObjectOrNull(JSObject* arg) { this->value().setObjectOrNull(arg); } void setPrivate(void* ptr) { this->value().setPrivate(ptr); } @@ -1271,9 +1243,7 @@ class HeapBase void setMagic(JSWhyMagic why) { setBarriered(JS::MagicValue(why)); } void setString(JSString* str) { setBarriered(JS::StringValue(str)); } void setSymbol(JS::Symbol* sym) { setBarriered(JS::SymbolValue(sym)); } -#ifdef ENABLE_BIGINT void setBigInt(JS::BigInt* bi) { setBarriered(JS::BigIntValue(bi)); } -#endif void setObject(JSObject& obj) { setBarriered(JS::ObjectValue(obj)); } void setPrivateGCThing(js::gc::Cell* cell) { setBarriered(JS::PrivateGCThingValue(cell)); @@ -1329,13 +1299,11 @@ auto MapGCThingTyped(const JS::Value& val, F&& f) { MOZ_ASSERT(gc::IsCellPointerValid(sym)); return mozilla::Some(f(sym)); } -#ifdef ENABLE_BIGINT if (val.isBigInt()) { JS::BigInt* bi = val.toBigInt(); MOZ_ASSERT(gc::IsCellPointerValid(bi)); return mozilla::Some(f(bi)); } -#endif if (MOZ_UNLIKELY(val.isPrivateGCThing())) { MOZ_ASSERT(gc::IsCellPointerValid(val.toGCThing())); return mozilla::Some(MapGCThingTyped(val.toGCCellPtr(), std::move(f))); diff --git a/js/src/NamespaceImports.h b/js/src/NamespaceImports.h index e99018d316c40..4a6c3a98b09f2 100644 --- a/js/src/NamespaceImports.h +++ b/js/src/NamespaceImports.h @@ -110,9 +110,7 @@ using JS::RootedObject; using JS::RootedScript; using JS::RootedString; using JS::RootedSymbol; -#ifdef ENABLE_BIGINT using JS::RootedBigInt; -#endif using JS::RootedValue; using JS::PersistentRooted; @@ -122,9 +120,7 @@ using JS::PersistentRootedObject; using JS::PersistentRootedScript; using JS::PersistentRootedString; using JS::PersistentRootedSymbol; -#ifdef ENABLE_BIGINT using JS::PersistentRootedBigInt; -#endif using JS::PersistentRootedValue; using JS::Handle; @@ -134,9 +130,7 @@ using JS::HandleObject; using JS::HandleScript; using JS::HandleString; using JS::HandleSymbol; -#ifdef ENABLE_BIGINT using JS::HandleBigInt; -#endif using JS::HandleValue; using JS::MutableHandle; @@ -146,9 +140,7 @@ using JS::MutableHandleObject; using JS::MutableHandleScript; using JS::MutableHandleString; using JS::MutableHandleSymbol; -#ifdef ENABLE_BIGINT using JS::MutableHandleBigInt; -#endif using JS::MutableHandleValue; using JS::FalseHandleValue; @@ -168,9 +160,7 @@ using JS::Zone; using JS::Symbol; using JS::SymbolCode; -#ifdef ENABLE_BIGINT using JS::BigInt; -#endif } /* namespace js */ diff --git a/js/src/builtin/Array.cpp b/js/src/builtin/Array.cpp index 41584b395f212..9895e3b3610d2 100644 --- a/js/src/builtin/Array.cpp +++ b/js/src/builtin/Array.cpp @@ -1312,7 +1312,7 @@ static bool ArrayJoinDenseKernel(JSContext* cx, SeparatorOp sepOp, * with those as well. */ break; - } else if (IF_BIGINT(elem.isBigInt(), false)) { + } else if (elem.isBigInt()) { // ToString(bigint) doesn't access bigint.toString or // anything like that, so it can't mutate the array we're // walking through, so it *could* be handled here. We don't diff --git a/js/src/builtin/Boolean.cpp b/js/src/builtin/Boolean.cpp index 4c53476b8def6..443734fe912bf 100644 --- a/js/src/builtin/Boolean.cpp +++ b/js/src/builtin/Boolean.cpp @@ -16,9 +16,7 @@ #include "jit/InlinableNatives.h" #include "js/PropertySpec.h" #include "util/StringBuffer.h" -#ifdef ENABLE_BIGINT -# include "vm/BigIntType.h" -#endif +#include "vm/BigIntType.h" #include "vm/GlobalObject.h" #include "vm/JSAtom.h" #include "vm/JSContext.h" @@ -162,11 +160,9 @@ JS_PUBLIC_API bool js::ToBooleanSlow(HandleValue v) { if (v.isString()) { return v.toString()->length() != 0; } -#ifdef ENABLE_BIGINT if (v.isBigInt()) { return !v.toBigInt()->isZero(); } -#endif MOZ_ASSERT(v.isObject()); return !EmulatesUndefined(&v.toObject()); diff --git a/js/src/builtin/JSON.cpp b/js/src/builtin/JSON.cpp index 9abc984b9eca0..1d5ada8d14016 100644 --- a/js/src/builtin/JSON.cpp +++ b/js/src/builtin/JSON.cpp @@ -16,9 +16,7 @@ #include "jsutil.h" #include "builtin/Array.h" -#ifdef ENABLE_BIGINT -# include "builtin/BigInt.h" -#endif +#include "builtin/BigInt.h" #include "builtin/String.h" #include "js/PropertySpec.h" #include "js/StableStringChars.h" @@ -291,7 +289,7 @@ static bool PreprocessValue(JSContext* cx, HandleObject holder, KeyType key, // Step 2. Modified by BigInt spec 6.1 to check for a toJSON method on the // BigInt prototype when the value is a BigInt. - if (vp.isObject() || IF_BIGINT(vp.isBigInt(), false)) { + if (vp.isObject() || vp.isBigInt()) { RootedValue toJSON(cx); RootedObject obj(cx, JS::ToObject(cx, vp)); if (!obj) { @@ -359,14 +357,11 @@ static bool PreprocessValue(JSContext* cx, HandleObject holder, KeyType key, if (!Unbox(cx, obj, vp)) { return false; } - } -#ifdef ENABLE_BIGINT - else if (cls == ESClass::BigInt) { + } else if (cls == ESClass::BigInt) { if (!Unbox(cx, obj, vp)) { return false; } } -#endif } return true; @@ -681,14 +676,12 @@ static bool Str(JSContext* cx, const Value& v, StringifyContext* scx) { return NumberValueToStringBuffer(cx, v, scx->sb); } -#ifdef ENABLE_BIGINT /* Step 10 in the BigInt proposal. */ if (v.isBigInt()) { JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_BIGINT_NOT_SERIALIZABLE); return false; } -#endif /* Step 10. */ MOZ_ASSERT(v.isObject()); diff --git a/js/src/builtin/MapObject.cpp b/js/src/builtin/MapObject.cpp index bf2f57ce3bb6c..d764987f5e262 100644 --- a/js/src/builtin/MapObject.cpp +++ b/js/src/builtin/MapObject.cpp @@ -59,7 +59,7 @@ bool HashableValue::setValue(JSContext* cx, HandleValue v) { MOZ_ASSERT(value.isUndefined() || value.isNull() || value.isBoolean() || value.isNumber() || value.isString() || value.isSymbol() || - value.isObject() || IF_BIGINT(value.isBigInt(), false)); + value.isObject() || value.isBigInt()); return true; } @@ -80,11 +80,9 @@ static HashNumber HashValue(const Value& v, if (v.isSymbol()) { return v.toSymbol()->hash(); } -#ifdef ENABLE_BIGINT if (v.isBigInt()) { return v.toBigInt()->hash(); } -#endif if (v.isObject()) { return hcs.scramble(v.asRawBits()); } @@ -101,7 +99,6 @@ bool HashableValue::operator==(const HashableValue& other) const { // Two HashableValues are equal if they have equal bits. bool b = (value.asRawBits() == other.value.asRawBits()); -#ifdef ENABLE_BIGINT // BigInt values are considered equal if they represent the same // integer. This test should use a comparison function that doesn't // require a JSContext once one is defined in the BigInt class. @@ -111,7 +108,6 @@ bool HashableValue::operator==(const HashableValue& other) const { RootedValue otherRoot(cx, other.value); SameValue(cx, valueRoot, otherRoot, &b); } -#endif #ifdef DEBUG bool same; diff --git a/js/src/builtin/Object.cpp b/js/src/builtin/Object.cpp index 3929df7a3d689..5f1f1ce377518 100644 --- a/js/src/builtin/Object.cpp +++ b/js/src/builtin/Object.cpp @@ -8,9 +8,7 @@ #include "mozilla/MaybeOneOf.h" -#ifdef ENABLE_BIGINT -# include "builtin/BigInt.h" -#endif +#include "builtin/BigInt.h" #include "builtin/Eval.h" #include "builtin/SelfHostingDefines.h" #include "builtin/String.h" diff --git a/js/src/builtin/ReflectParse.cpp b/js/src/builtin/ReflectParse.cpp index c1277e17ac715..7ad0a5eb7b0e9 100644 --- a/js/src/builtin/ReflectParse.cpp +++ b/js/src/builtin/ReflectParse.cpp @@ -21,9 +21,7 @@ #include "frontend/Parser.h" #include "js/CharacterEncoding.h" #include "js/StableStringChars.h" -#ifdef ENABLE_BIGINT -# include "vm/BigIntType.h" -#endif +#include "vm/BigIntType.h" #include "vm/JSAtom.h" #include "vm/JSObject.h" #include "vm/RegExpObject.h" @@ -2950,9 +2948,7 @@ bool ASTSerializer::expression(ParseNode* pn, MutableHandleValue dst) { case ParseNodeKind::StringExpr: case ParseNodeKind::RegExpExpr: case ParseNodeKind::NumberExpr: -#ifdef ENABLE_BIGINT case ParseNodeKind::BigIntExpr: -#endif case ParseNodeKind::TrueExpr: case ParseNodeKind::FalseExpr: case ParseNodeKind::NullExpr: @@ -3125,14 +3121,12 @@ bool ASTSerializer::literal(ParseNode* pn, MutableHandleValue dst) { val.setNumber(pn->as().value()); break; -#ifdef ENABLE_BIGINT case ParseNodeKind::BigIntExpr: { BigInt* x = pn->as().box()->value(); cx->check(x); val.setBigInt(x); break; } -#endif case ParseNodeKind::NullExpr: val.setNull(); diff --git a/js/src/frontend/BytecodeEmitter.cpp b/js/src/frontend/BytecodeEmitter.cpp index 99c2865ac8085..1cd5e8b0b996e 100644 --- a/js/src/frontend/BytecodeEmitter.cpp +++ b/js/src/frontend/BytecodeEmitter.cpp @@ -1061,12 +1061,10 @@ bool BytecodeEmitter::checkSideEffects(ParseNode* pn, bool* answer) { *answer = false; return true; -#ifdef ENABLE_BIGINT case ParseNodeKind::BigIntExpr: MOZ_ASSERT(pn->is()); *answer = false; return true; -#endif // |this| can throw in derived class constructors, including nested arrow // functions or eval. @@ -4394,11 +4392,9 @@ bool ParseNode::getConstantValue(JSContext* cx, case ParseNodeKind::NumberExpr: vp.setNumber(as().value()); return true; -#ifdef ENABLE_BIGINT case ParseNodeKind::BigIntExpr: vp.setBigInt(as().box()->value()); return true; -#endif case ParseNodeKind::TemplateStringExpr: case ParseNodeKind::StringExpr: vp.setString(as().atom()); @@ -4977,14 +4973,12 @@ bool BytecodeEmitter::emitCopyDataProperties(CopyOption option) { return true; } -#ifdef ENABLE_BIGINT bool BytecodeEmitter::emitBigIntOp(BigInt* bigint) { if (!numberList.append(BigIntValue(bigint))) { return false; } return emitIndex32(JSOP_BIGINT, numberList.length() - 1); } -#endif bool BytecodeEmitter::emitIterator() { // Convert iterable to iterator. @@ -9244,13 +9238,11 @@ bool BytecodeEmitter::emitTree( } break; -#ifdef ENABLE_BIGINT case ParseNodeKind::BigIntExpr: if (!emitBigIntOp(pn->as().box()->value())) { return false; } break; -#endif case ParseNodeKind::RegExpExpr: if (!emitRegExp(objectList.add(pn->as().objbox()))) { diff --git a/js/src/frontend/BytecodeEmitter.h b/js/src/frontend/BytecodeEmitter.h index ebd5ef3f6b8bf..d0a6f5b5c5f9c 100644 --- a/js/src/frontend/BytecodeEmitter.h +++ b/js/src/frontend/BytecodeEmitter.h @@ -540,9 +540,7 @@ struct MOZ_STACK_CLASS BytecodeEmitter { MOZ_MUST_USE bool emitNumberOp(double dval); -#ifdef ENABLE_BIGINT MOZ_MUST_USE bool emitBigIntOp(BigInt* bigint); -#endif MOZ_MUST_USE bool emitThisLiteral(ThisLiteral* pn); MOZ_MUST_USE bool emitGetFunctionThis(NameNode* thisName); diff --git a/js/src/frontend/FoldConstants.cpp b/js/src/frontend/FoldConstants.cpp index 501420c4eb4ae..04e62f9f03b8c 100644 --- a/js/src/frontend/FoldConstants.cpp +++ b/js/src/frontend/FoldConstants.cpp @@ -398,9 +398,7 @@ static bool ContainsHoistedDeclaration(JSContext* cx, ParseNode* node, case ParseNodeKind::ThisExpr: case ParseNodeKind::Elision: case ParseNodeKind::NumberExpr: -#ifdef ENABLE_BIGINT case ParseNodeKind::BigIntExpr: -#endif case ParseNodeKind::NewExpr: case ParseNodeKind::Generator: case ParseNodeKind::ParamsBody: @@ -482,9 +480,7 @@ static bool IsEffectless(ParseNode* node) { node->isKind(ParseNodeKind::StringExpr) || node->isKind(ParseNodeKind::TemplateStringExpr) || node->isKind(ParseNodeKind::NumberExpr) || -#ifdef ENABLE_BIGINT node->isKind(ParseNodeKind::BigIntExpr) || -#endif node->isKind(ParseNodeKind::NullExpr) || node->isKind(ParseNodeKind::RawUndefinedExpr) || node->isKind(ParseNodeKind::Function); @@ -500,11 +496,9 @@ static Truthiness Boolish(ParseNode* pn) { ? Truthy : Falsy; -#ifdef ENABLE_BIGINT case ParseNodeKind::BigIntExpr: return (pn->as().box()->value()->isZero()) ? Falsy : Truthy; -#endif case ParseNodeKind::StringExpr: case ParseNodeKind::TemplateStringExpr: @@ -574,13 +568,9 @@ static bool FoldTypeOfExpr(JSContext* cx, FullParseHandler* handler, result = cx->names().string; } else if (expr->isKind(ParseNodeKind::NumberExpr)) { result = cx->names().number; - } -#ifdef ENABLE_BIGINT - else if (expr->isKind(ParseNodeKind::BigIntExpr)) { + } else if (expr->isKind(ParseNodeKind::BigIntExpr)) { result = cx->names().bigint; - } -#endif - else if (expr->isKind(ParseNodeKind::NullExpr)) { + } else if (expr->isKind(ParseNodeKind::NullExpr)) { result = cx->names().object; } else if (expr->isKind(ParseNodeKind::TrueExpr) || expr->isKind(ParseNodeKind::FalseExpr)) { diff --git a/js/src/frontend/FullParseHandler.h b/js/src/frontend/FullParseHandler.h index cfabb761ffbc7..34c8f43f11d61 100644 --- a/js/src/frontend/FullParseHandler.h +++ b/js/src/frontend/FullParseHandler.h @@ -130,7 +130,6 @@ class FullParseHandler { return new_(value, decimalPoint, pos); } -#ifdef ENABLE_BIGINT // The Boxer object here is any object that can allocate BigIntBoxes. // Specifically, a Boxer has a .newBigIntBox(T) method that accepts a // BigInt* argument and returns a BigIntBox*. @@ -142,7 +141,6 @@ class FullParseHandler { } return new_(box, pos); } -#endif BooleanLiteralType newBooleanLiteral(bool cond, const TokenPos& pos) { return new_(cond, pos); diff --git a/js/src/frontend/NameFunctions.cpp b/js/src/frontend/NameFunctions.cpp index 35c040cf2fb77..159424e3b39b8 100644 --- a/js/src/frontend/NameFunctions.cpp +++ b/js/src/frontend/NameFunctions.cpp @@ -464,11 +464,9 @@ class NameResolver { MOZ_ASSERT(cur->is()); break; -#ifdef ENABLE_BIGINT case ParseNodeKind::BigIntExpr: MOZ_ASSERT(cur->is()); break; -#endif case ParseNodeKind::TypeOfNameExpr: case ParseNodeKind::SuperBase: diff --git a/js/src/frontend/ParseNode.cpp b/js/src/frontend/ParseNode.cpp index 080daf25ebc57..3547d895c3142 100644 --- a/js/src/frontend/ParseNode.cpp +++ b/js/src/frontend/ParseNode.cpp @@ -169,11 +169,9 @@ void ParseNode::dump(GenericPrinter& out, int indent) { case PN_NUMBER: as().dump(out, indent); return; -# ifdef ENABLE_BIGINT case PN_BIGINT: as().dump(out, indent); return; -# endif case PN_REGEXP: as().dump(out, indent); return; @@ -220,11 +218,9 @@ void NumericLiteral::dump(GenericPrinter& out, int indent) { } } -# ifdef ENABLE_BIGINT void BigIntLiteral::dump(GenericPrinter& out, int indent) { out.printf("(%s)", parseNodeNames[size_t(getKind())]); } -# endif void RegExpLiteral::dump(GenericPrinter& out, int indent) { out.printf("(%s)", parseNodeNames[size_t(getKind())]); @@ -432,22 +428,18 @@ TraceListNode::TraceListNode(js::gc::Cell* gcThing, TraceListNode* traceLink) MOZ_ASSERT(gcThing->isTenured()); } -#ifdef ENABLE_BIGINT BigIntBox* TraceListNode::asBigIntBox() { MOZ_ASSERT(isBigIntBox()); return static_cast(this); } -#endif ObjectBox* TraceListNode::asObjectBox() { MOZ_ASSERT(isObjectBox()); return static_cast(this); } -#ifdef ENABLE_BIGINT BigIntBox::BigIntBox(BigInt* bi, TraceListNode* traceLink) : TraceListNode(bi, traceLink) {} -#endif ObjectBox::ObjectBox(JSObject* obj, TraceListNode* traceLink) : TraceListNode(obj, traceLink), emitLink(nullptr) { diff --git a/js/src/frontend/ParseNode.h b/js/src/frontend/ParseNode.h index 0c04720db454a..c2b3f4f9b41c1 100644 --- a/js/src/frontend/ParseNode.h +++ b/js/src/frontend/ParseNode.h @@ -10,9 +10,7 @@ #include "mozilla/Attributes.h" #include "frontend/TokenStream.h" -#ifdef ENABLE_BIGINT -# include "vm/BigIntType.h" -#endif +#include "vm/BigIntType.h" #include "vm/BytecodeUtil.h" #include "vm/Printer.h" #include "vm/Scope.h" @@ -48,9 +46,7 @@ class ParseContext; class FullParseHandler; class FunctionBox; class ObjectBox; -#ifdef ENABLE_BIGINT class BigIntBox; -#endif #define FOR_EACH_PARSE_NODE_KIND(F) \ F(EmptyStmt, NullaryNode) \ @@ -80,7 +76,7 @@ class BigIntBox; F(PrivateName, NameNode) \ F(ComputedName, UnaryNode) \ F(NumberExpr, NumericLiteral) \ - IF_BIGINT(F(BigIntExpr, BigIntLiteral), /**/) \ + F(BigIntExpr, BigIntLiteral) \ F(StringExpr, NameNode) \ F(TemplateStringListExpr, ListNode) \ F(TemplateStringExpr, NameNode) \ @@ -535,12 +531,10 @@ enum ParseNodeArity { PN_NAME, /* name, label, string */ PN_FIELD, /* field name, optional initializer */ PN_NUMBER, /* numeric literal */ -#ifdef ENABLE_BIGINT - PN_BIGINT, /* BigInt literal */ -#endif - PN_REGEXP, /* regexp literal */ - PN_LOOP, /* loop control (break/continue) */ - PN_SCOPE /* lexical scope */ + PN_BIGINT, /* BigInt literal */ + PN_REGEXP, /* regexp literal */ + PN_LOOP, /* loop control (break/continue) */ + PN_SCOPE /* lexical scope */ }; // FIXME: Remove `*Type` (bug 1489008) @@ -579,7 +573,7 @@ enum ParseNodeArity { MACRO(RawUndefinedLiteral, RawUndefinedLiteralType, asRawUndefinedLiteral) \ \ MACRO(NumericLiteral, NumericLiteralType, asNumericLiteral) \ - IF_BIGINT(MACRO(BigIntLiteral, BigIntLiteralType, asBigIntLiteral), ) \ + MACRO(BigIntLiteral, BigIntLiteralType, asBigIntLiteral) \ \ MACRO(RegExpLiteral, RegExpLiteralType, asRegExpLiteral) \ \ @@ -708,9 +702,7 @@ class ParseNode { /* True if pn is a parsenode representing a literal constant. */ bool isLiteral() const { return isKind(ParseNodeKind::NumberExpr) || -#ifdef ENABLE_BIGINT isKind(ParseNodeKind::BigIntExpr) || -#endif isKind(ParseNodeKind::StringExpr) || isKind(ParseNodeKind::TrueExpr) || isKind(ParseNodeKind::FalseExpr) || @@ -1531,7 +1523,6 @@ class NumericLiteral : public ParseNode { void setDecimalPoint(DecimalPoint d) { decimalPoint_ = d; } }; -#ifdef ENABLE_BIGINT class BigIntLiteral : public ParseNode { BigIntBox* box_; @@ -1558,7 +1549,6 @@ class BigIntLiteral : public ParseNode { BigIntBox* box() const { return box_; } }; -#endif class LexicalScopeNode : public ParseNode { LexicalScope::Data* bindings; @@ -2164,14 +2154,10 @@ class TraceListNode { TraceListNode(js::gc::Cell* gcThing, TraceListNode* traceLink); -#ifdef ENABLE_BIGINT bool isBigIntBox() const { return gcThing->is(); } -#endif bool isObjectBox() const { return gcThing->is(); } -#ifdef ENABLE_BIGINT BigIntBox* asBigIntBox(); -#endif ObjectBox* asObjectBox(); virtual void trace(JSTracer* trc); @@ -2180,13 +2166,11 @@ class TraceListNode { static void TraceList(JSTracer* trc, TraceListNode* listHead); }; -#ifdef ENABLE_BIGINT class BigIntBox : public TraceListNode { public: BigIntBox(BigInt* bi, TraceListNode* link); BigInt* value() const { return gcThing->as(); } }; -#endif class ObjectBox : public TraceListNode { protected: diff --git a/js/src/frontend/Parser.cpp b/js/src/frontend/Parser.cpp index 98fb1c665f431..5bd02f91e025b 100644 --- a/js/src/frontend/Parser.cpp +++ b/js/src/frontend/Parser.cpp @@ -275,11 +275,9 @@ ObjectBox* ParserBase::newObjectBox(JSObject* obj) { return newTraceListNode(obj); } -#ifdef ENABLE_BIGINT BigIntBox* ParserBase::newBigIntBox(BigInt* val) { return newTraceListNode(val); } -#endif template FunctionBox* PerHandlerParser::newFunctionBox( @@ -9020,7 +9018,6 @@ GeneralParser::newRegExp() { return asFinalParser()->newRegExp(); } -#ifdef ENABLE_BIGINT template BigIntLiteral* Parser::newBigInt() { // The token's charBuffer contains the DecimalIntegerLiteral or @@ -9054,7 +9051,6 @@ typename ParseHandler::BigIntLiteralType GeneralParser::newBigInt() { return asFinalParser()->newBigInt(); } -#endif /* ENABLE_BIGINT */ // |exprPossibleError| is the PossibleError state within |expr|, // |possibleError| is the surrounding PossibleError state. @@ -10080,10 +10076,8 @@ typename ParseHandler::Node GeneralParser::primaryExpr( case TokenKind::Number: return newNumber(anyChars.currentToken()); -#ifdef ENABLE_BIGINT case TokenKind::BigInt: return newBigInt(); -#endif case TokenKind::True: return handler.newBooleanLiteral(true, pos()); diff --git a/js/src/frontend/Parser.h b/js/src/frontend/Parser.h index ac248a5735a8b..bb92c7badc44e 100644 --- a/js/src/frontend/Parser.h +++ b/js/src/frontend/Parser.h @@ -399,9 +399,7 @@ class MOZ_STACK_CLASS ParserBase : private JS::AutoGCRooter, public: ObjectBox* newObjectBox(JSObject* obj); -#ifdef ENABLE_BIGINT BigIntBox* newBigIntBox(BigInt* val); -#endif mozilla::Maybe newGlobalScopeData( ParseContext::Scope& scope); @@ -1385,9 +1383,7 @@ class MOZ_STACK_CLASS GeneralParser : public PerHandlerParser { return handler.newNumber(tok.number(), tok.decimalPoint(), tok.pos); } -#ifdef ENABLE_BIGINT inline BigIntLiteralType newBigInt(); -#endif protected: // Match the current token against the BindingIdentifier production with @@ -1530,9 +1526,7 @@ class MOZ_STACK_CLASS Parser final inline void setInParametersOfAsyncFunction(bool inParameters); RegExpLiteralType newRegExp(); -#ifdef ENABLE_BIGINT BigIntLiteralType newBigInt(); -#endif // Parse a module. ModuleNodeType moduleBody(ModuleSharedContext* modulesc); @@ -1685,9 +1679,7 @@ class MOZ_STACK_CLASS Parser final inline void setInParametersOfAsyncFunction(bool inParameters); RegExpLiteralType newRegExp(); -#ifdef ENABLE_BIGINT BigIntLiteralType newBigInt(); -#endif // Parse a module. ModuleNodeType moduleBody(ModuleSharedContext* modulesc); diff --git a/js/src/frontend/SyntaxParseHandler.h b/js/src/frontend/SyntaxParseHandler.h index 1eb0aeaf4d3a1..c4ea3b38d3915 100644 --- a/js/src/frontend/SyntaxParseHandler.h +++ b/js/src/frontend/SyntaxParseHandler.h @@ -207,9 +207,7 @@ class SyntaxParseHandler { return NodeGeneric; } -#ifdef ENABLE_BIGINT BigIntLiteralType newBigInt() { return NodeGeneric; } -#endif BooleanLiteralType newBooleanLiteral(bool cond, const TokenPos& pos) { return NodeGeneric; diff --git a/js/src/frontend/TokenKind.h b/js/src/frontend/TokenKind.h index a572f21797948..2b0bb62a6e999 100644 --- a/js/src/frontend/TokenKind.h +++ b/js/src/frontend/TokenKind.h @@ -76,7 +76,7 @@ MACRO(PrivateName, "private identifier") \ MACRO(Number, "numeric literal") \ MACRO(String, "string literal") \ - IF_BIGINT(MACRO(BigInt, "bigint literal"), ) \ + MACRO(BigInt, "bigint literal") \ \ /* start of template literal with substitutions */ \ MACRO(TemplateHead, "'${'") \ diff --git a/js/src/frontend/TokenStream.cpp b/js/src/frontend/TokenStream.cpp index 743355343bff8..46960f34d75e3 100644 --- a/js/src/frontend/TokenStream.cpp +++ b/js/src/frontend/TokenStream.cpp @@ -2142,12 +2142,9 @@ MOZ_MUST_USE bool TokenStreamSpecific::decimalNumber( // Numbers contain no escapes, so we can read directly from |sourceUnits|. double dval; -#ifdef ENABLE_BIGINT bool isBigInt = false; -#endif DecimalPoint decimalPoint = NoDecimal; - if (unit != '.' && unit != 'e' && unit != 'E' && - IF_BIGINT(unit != 'n', true)) { + if (unit != '.' && unit != 'e' && unit != 'E' && unit != 'n') { // NOTE: |unit| may be EOF here. ungetCodeUnit(unit); @@ -2157,14 +2154,10 @@ MOZ_MUST_USE bool TokenStreamSpecific::decimalNumber( this->sourceUnits.addressOfNextCodeUnit(), &dval)) { return false; } - } -#ifdef ENABLE_BIGINT - else if (unit == 'n' && anyCharsAccess().options().bigIntEnabledOption) { + } else if (unit == 'n' && anyCharsAccess().options().bigIntEnabledOption) { isBigInt = true; unit = peekCodeUnit(); - } -#endif - else { + } else { // Consume any decimal dot and fractional component. if (unit == '.') { decimalPoint = HasDecimal; @@ -2226,11 +2219,9 @@ MOZ_MUST_USE bool TokenStreamSpecific::decimalNumber( noteBadToken.release(); -#ifdef ENABLE_BIGINT if (isBigInt) { return bigIntLiteral(start, modifier, out); } -#endif newNumberToken(dval, decimalPoint, start, modifier, out); return true; @@ -2361,7 +2352,6 @@ MOZ_MUST_USE bool TokenStreamSpecific::regexpLiteral( return true; } -#ifdef ENABLE_BIGINT template MOZ_MUST_USE bool TokenStreamSpecific::bigIntLiteral( TokenStart start, Modifier modifier, TokenKind* out) { @@ -2386,7 +2376,6 @@ MOZ_MUST_USE bool TokenStreamSpecific::bigIntLiteral( newBigIntToken(start, modifier, out); return true; } -#endif template MOZ_MUST_USE bool TokenStreamSpecific::getTokenInternal( @@ -2552,10 +2541,8 @@ MOZ_MUST_USE bool TokenStreamSpecific::getTokenInternal( if (c1kind == ZeroDigit) { TokenStart start(this->sourceUnits, -1); int radix; -#ifdef ENABLE_BIGINT bool isLegacyOctalOrNoctal = false; bool isBigInt = false; -#endif const Unit* numStart; unit = getCodeUnit(); if (unit == 'x' || unit == 'X') { @@ -2608,9 +2595,7 @@ MOZ_MUST_USE bool TokenStreamSpecific::getTokenInternal( } } else if (IsAsciiDigit(unit)) { radix = 8; -#ifdef ENABLE_BIGINT isLegacyOctalOrNoctal = true; -#endif // one past the '0' numStart = this->sourceUnits.addressOfNextCodeUnit() - 1; @@ -2645,7 +2630,6 @@ MOZ_MUST_USE bool TokenStreamSpecific::getTokenInternal( return decimalNumber(unit, start, numStart, modifier, ttp); } -#ifdef ENABLE_BIGINT if (unit == 'n' && anyCharsAccess().options().bigIntEnabledOption) { if (isLegacyOctalOrNoctal) { error(JSMSG_BIGINT_INVALID_SYNTAX); @@ -2656,9 +2640,6 @@ MOZ_MUST_USE bool TokenStreamSpecific::getTokenInternal( } else { ungetCodeUnit(unit); } -#else - ungetCodeUnit(unit); -#endif // Error if an identifier-start code point appears immediately // after the number. Somewhat surprisingly, if we don't check @@ -2679,11 +2660,9 @@ MOZ_MUST_USE bool TokenStreamSpecific::getTokenInternal( } } -#ifdef ENABLE_BIGINT if (isBigInt) { return bigIntLiteral(start, modifier, ttp); } -#endif double dval; if (!GetFullInteger(anyCharsAccess().cx, numStart, diff --git a/js/src/frontend/TokenStream.h b/js/src/frontend/TokenStream.h index 97b7eec0f5fd2..ae3e2fbd89fb5 100644 --- a/js/src/frontend/TokenStream.h +++ b/js/src/frontend/TokenStream.h @@ -1954,12 +1954,10 @@ class GeneralTokenStreamChars : public SpecializedTokenStreamCharsBase { token->setNumber(dval, decimalPoint); } -#ifdef ENABLE_BIGINT void newBigIntToken(TokenStart start, TokenStreamShared::Modifier modifier, TokenKind* out) { newToken(TokenKind::BigInt, start, modifier, out); } -#endif void newAtomToken(TokenKind kind, JSAtom* atom, TokenStart start, TokenStreamShared::Modifier modifier, TokenKind* out) { @@ -2412,9 +2410,7 @@ class MOZ_STACK_CLASS TokenStreamSpecific using TokenStreamCharsShared::copyCharBufferTo; using TokenStreamCharsShared::drainCharBufferIntoAtom; using TokenStreamCharsShared::isAsciiCodePoint; -#ifdef ENABLE_BIGINT using GeneralCharsBase::newBigIntToken; -#endif using CharsBase::peekCodeUnit; using GeneralCharsBase::newRegExpToken; using GeneralCharsBase::newSimpleToken; diff --git a/js/src/fuzz-tests/tests.cpp b/js/src/fuzz-tests/tests.cpp index e2d041dd26438..37a543aa5925d 100644 --- a/js/src/fuzz-tests/tests.cpp +++ b/js/src/fuzz-tests/tests.cpp @@ -43,9 +43,7 @@ static JSObject* jsfuzz_createGlobal(JSContext* cx, JSPrincipals* principals) { JS::RootedObject newGlobal(cx); JS::RealmOptions options; options.creationOptions().setStreamsEnabled(true); -#ifdef ENABLE_BIGINT options.creationOptions().setBigIntEnabled(true); -#endif newGlobal = JS_NewGlobalObject(cx, getGlobalClass(), principals, JS::FireOnNewGlobalHook, options); if (!newGlobal) { diff --git a/js/src/gc/AllocKind.h b/js/src/gc/AllocKind.h index 25b72e20d8147..6610155e8e223 100644 --- a/js/src/gc/AllocKind.h +++ b/js/src/gc/AllocKind.h @@ -66,7 +66,7 @@ namespace gc { D(FAT_INLINE_ATOM, String, js::FatInlineAtom, js::FatInlineAtom, true, false, true) \ D(ATOM, String, js::NormalAtom, js::NormalAtom, true, false, true) \ D(SYMBOL, Symbol, JS::Symbol, JS::Symbol, true, false, false) \ - IF_BIGINT(D(BIGINT, BigInt, JS::BigInt, JS::BigInt, true, false, false),) \ + D(BIGINT, BigInt, JS::BigInt, JS::BigInt, true, false, false) \ D(JITCODE, JitCode, js::jit::JitCode, js::jit::JitCode, false, false, false) \ D(SCOPE, Scope, js::Scope, js::Scope, true, false, true) \ D(REGEXP_SHARED, RegExpShared, js::RegExpShared, js::RegExpShared, true, false, true) diff --git a/js/src/gc/AtomMarking.cpp b/js/src/gc/AtomMarking.cpp index 943b07a2c291f..282174c01899a 100644 --- a/js/src/gc/AtomMarking.cpp +++ b/js/src/gc/AtomMarking.cpp @@ -184,9 +184,9 @@ void AtomMarkingRuntime::markAtomValue(JSContext* cx, const Value& value) { markAtom(cx, value.toSymbol()); return; } - MOZ_ASSERT_IF(value.isGCThing(), value.isObject() || - value.isPrivateGCThing() || - IF_BIGINT(value.isBigInt(), false)); + MOZ_ASSERT_IF(value.isGCThing(), + value.isObject() || value.isPrivateGCThing() || + value.isBigInt()); } void AtomMarkingRuntime::adoptMarkedAtoms(Zone* target, Zone* source) { @@ -267,9 +267,9 @@ bool AtomMarkingRuntime::valueIsMarked(Zone* zone, const Value& value) { return atomIsMarked(zone, value.toSymbol()); } - MOZ_ASSERT_IF(value.isGCThing(), value.isObject() || - value.isPrivateGCThing() || - IF_BIGINT(value.isBigInt(), false)); + MOZ_ASSERT_IF(value.isGCThing(), + value.isObject() || value.isPrivateGCThing() || + value.isBigInt()); return true; } diff --git a/js/src/gc/DeletePolicy.h b/js/src/gc/DeletePolicy.h index c9947e655c144..4f66ef3d2f3e6 100644 --- a/js/src/gc/DeletePolicy.h +++ b/js/src/gc/DeletePolicy.h @@ -25,9 +25,7 @@ struct ClearEdgesTracer : public JS::CallbackTracer { void onObjectEdge(JSObject** objp) override; void onStringEdge(JSString** strp) override; void onSymbolEdge(JS::Symbol** symp) override; -#ifdef ENABLE_BIGINT void onBigIntEdge(JS::BigInt** bip) override; -#endif void onScriptEdge(JSScript** scriptp) override; void onShapeEdge(js::Shape** shapep) override; void onObjectGroupEdge(js::ObjectGroup** groupp) override; diff --git a/js/src/gc/GC.cpp b/js/src/gc/GC.cpp index b95eab747a2b5..ec5e50c0687cc 100644 --- a/js/src/gc/GC.cpp +++ b/js/src/gc/GC.cpp @@ -229,9 +229,7 @@ #include "js/SliceBudget.h" #include "proxy/DeadObjectProxy.h" #include "util/Windows.h" -#ifdef ENABLE_BIGINT -# include "vm/BigIntType.h" -#endif +#include "vm/BigIntType.h" #include "vm/Debugger.h" #include "vm/GeckoProfiler.h" #include "vm/JSAtom.h" @@ -506,10 +504,7 @@ static const FinalizePhase BackgroundFinalizePhases[] = { {gcstats::PhaseKind::SWEEP_STRING, {AllocKind::FAT_INLINE_STRING, AllocKind::STRING, AllocKind::EXTERNAL_STRING, AllocKind::FAT_INLINE_ATOM, AllocKind::ATOM, - AllocKind::SYMBOL, -#ifdef ENABLE_BIGINT - AllocKind::BIGINT -#endif + AllocKind::SYMBOL, AllocKind::BIGINT }}, {gcstats::PhaseKind::SWEEP_SHAPE, {AllocKind::SHAPE, AllocKind::ACCESSOR_SHAPE, AllocKind::BASE_SHAPE, @@ -8383,10 +8378,8 @@ JS::GCCellPtr::GCCellPtr(const Value& v) : ptr(0) { ptr = checkedCast(&v.toObject(), JS::TraceKind::Object); } else if (v.isSymbol()) { ptr = checkedCast(v.toSymbol(), JS::TraceKind::Symbol); -#ifdef ENABLE_BIGINT } else if (v.isBigInt()) { ptr = checkedCast(v.toBigInt(), JS::TraceKind::BigInt); -#endif } else if (v.isPrivateGCThing()) { ptr = checkedCast(v.toGCThing(), v.toGCThing()->getTraceKind()); } else { @@ -9003,11 +8996,9 @@ void js::gc::ClearEdgesTracer::onStringEdge(JSString** strp) { void js::gc::ClearEdgesTracer::onSymbolEdge(JS::Symbol** symp) { clearEdge(symp); } -#ifdef ENABLE_BIGINT void js::gc::ClearEdgesTracer::onBigIntEdge(JS::BigInt** bip) { clearEdge(bip); } -#endif void js::gc::ClearEdgesTracer::onScriptEdge(JSScript** scriptp) { clearEdge(scriptp); } diff --git a/js/src/gc/Marking-inl.h b/js/src/gc/Marking-inl.h index 24a13408d0a63..ba0fc2347171a 100644 --- a/js/src/gc/Marking-inl.h +++ b/js/src/gc/Marking-inl.h @@ -13,10 +13,7 @@ #include "gc/RelocationOverlay.h" -#ifdef ENABLE_BIGINT -# include "vm/BigIntType.h" -#endif - +#include "vm/BigIntType.h" #include "vm/RegExpShared.h" namespace js { @@ -32,9 +29,7 @@ struct TaggedPtr { static JS::Value wrap(JSObject* obj) { return JS::ObjectOrNullValue(obj); } static JS::Value wrap(JSString* str) { return JS::StringValue(str); } static JS::Value wrap(JS::Symbol* sym) { return JS::SymbolValue(sym); } -#ifdef ENABLE_BIGINT static JS::Value wrap(JS::BigInt* bi) { return JS::BigIntValue(bi); } -#endif template static JS::Value wrap(T* priv) { static_assert(mozilla::IsBaseOf::value, diff --git a/js/src/gc/Marking.cpp b/js/src/gc/Marking.cpp index 2488dd42d97d4..53de2b4663888 100644 --- a/js/src/gc/Marking.cpp +++ b/js/src/gc/Marking.cpp @@ -22,9 +22,7 @@ #include "js/SliceBudget.h" #include "vm/ArgumentsObject.h" #include "vm/ArrayObject.h" -#ifdef ENABLE_BIGINT -# include "vm/BigIntType.h" -#endif +#include "vm/BigIntType.h" #include "vm/Debugger.h" #include "vm/EnvironmentObject.h" #include "vm/RegExpShared.h" @@ -803,12 +801,10 @@ template <> void GCMarker::traverse(JS::Symbol* thing) { markAndTraceChildren(thing); } -#ifdef ENABLE_BIGINT template <> void GCMarker::traverse(JS::BigInt* thing) { markAndTraceChildren(thing); } -#endif template <> void GCMarker::traverse(RegExpShared* thing) { markAndTraceChildren(thing); @@ -1496,9 +1492,7 @@ void js::GCMarker::lazilyMarkChildren(ObjectGroup* group) { } } -#ifdef ENABLE_BIGINT void JS::BigInt::traceChildren(JSTracer* trc) { return; } -#endif template static void VisitTraceList(const Functor& f, const int32_t* traceList, @@ -1659,7 +1653,7 @@ inline static bool ObjectDenseElementsMayBeMarkable(NativeObject* nobj) { static const uint32_t flagMask = TYPE_FLAG_STRING | TYPE_FLAG_SYMBOL | TYPE_FLAG_LAZYARGS | TYPE_FLAG_ANYOBJECT | - IF_BIGINT(TYPE_FLAG_BIGINT, 0); + TYPE_FLAG_BIGINT; bool mayBeMarkable = typeSet->hasAnyFlag(flagMask) || typeSet->getObjectCount() != 0; @@ -1776,13 +1770,9 @@ inline void GCMarker::processMarkStackTop(SliceBudget& budget) { } } else if (v.isSymbol()) { traverseEdge(obj, v.toSymbol()); - } -#ifdef ENABLE_BIGINT - else if (v.isBigInt()) { + } else if (v.isBigInt()) { traverseEdge(obj, v.toBigInt()); - } -#endif - else if (v.isPrivateGCThing()) { + } else if (v.isPrivateGCThing()) { // v.toGCCellPtr cannot be inlined, so construct one manually. Cell* cell = v.toGCThing(); traverseEdge(obj, JS::GCCellPtr(cell, cell->getTraceKind())); diff --git a/js/src/gc/RootMarking.cpp b/js/src/gc/RootMarking.cpp index 9b40245fcd20e..d3eb1461ed5e6 100644 --- a/js/src/gc/RootMarking.cpp +++ b/js/src/gc/RootMarking.cpp @@ -466,9 +466,7 @@ class BufferGrayRootsTracer final : public JS::CallbackTracer { void onStringEdge(JSString** stringp) override { bufferRoot(*stringp); } void onScriptEdge(JSScript** scriptp) override { bufferRoot(*scriptp); } void onSymbolEdge(JS::Symbol** symbolp) override { bufferRoot(*symbolp); } -#ifdef ENABLE_BIGINT void onBigIntEdge(JS::BigInt** bip) override { bufferRoot(*bip); } -#endif void onChild(const JS::GCCellPtr& thing) override { MOZ_CRASH("Unexpected gray root kind"); diff --git a/js/src/gc/Tracer.cpp b/js/src/gc/Tracer.cpp index 2bfb68e507653..2483707109ec1 100644 --- a/js/src/gc/Tracer.cpp +++ b/js/src/gc/Tracer.cpp @@ -15,9 +15,7 @@ #include "gc/PublicIterators.h" #include "gc/Zone.h" #include "util/Text.h" -#ifdef ENABLE_BIGINT -# include "vm/BigIntType.h" -#endif +#include "vm/BigIntType.h" #include "vm/JSFunction.h" #include "vm/JSScript.h" #include "vm/Shape.h" @@ -334,11 +332,9 @@ JS_PUBLIC_API void JS_GetTraceThingInfo(char* buf, size_t bufsize, name = "symbol"; break; -#ifdef ENABLE_BIGINT case JS::TraceKind::BigInt: name = "BigInt"; break; -#endif default: name = "INVALID"; diff --git a/js/src/gdb/lib-for-tests/prologue.py b/js/src/gdb/lib-for-tests/prologue.py index 2735cf09c4d5e..5b751d56547e0 100644 --- a/js/src/gdb/lib-for-tests/prologue.py +++ b/js/src/gdb/lib-for-tests/prologue.py @@ -83,13 +83,6 @@ def assert_subprinter_registered(printer, subprinter): "%s" % (printer, subprinter, output)) -enable_bigint = False -try: - if gdb.lookup_type('JS::BigInt'): - enable_bigint = True -except Exception: - pass - # Request full stack traces for Python errors. gdb.execute('set python print-stack full') diff --git a/js/src/gdb/mozilla/jsval.py b/js/src/gdb/mozilla/jsval.py index b65a4b2fb1b1f..0ec679bbcb6e3 100644 --- a/js/src/gdb/mozilla/jsval.py +++ b/js/src/gdb/mozilla/jsval.py @@ -152,18 +152,10 @@ def get(key): self.MAGIC = get('JSVAL_TYPE_MAGIC') self.STRING = get('JSVAL_TYPE_STRING') self.SYMBOL = get('JSVAL_TYPE_SYMBOL') + self.BIGINT = get('JSVAL_TYPE_BIGINT') self.NULL = get('JSVAL_TYPE_NULL') self.OBJECT = get('JSVAL_TYPE_OBJECT') - self.enable_bigint = False - try: - # Looking up the tag will throw an exception if BigInt is not - # enabled. - self.BIGINT = get('JSVAL_TYPE_BIGINT') - self.enable_bigint = True - except Exception: - pass - # Let self.magic_names be an array whose i'th element is the name of # the i'th magic value. d = gdb.types.make_enum_dict(gdb.lookup_type('JSWhyMagic')) @@ -218,7 +210,7 @@ def to_string(self): value = self.box.as_address().cast(self.cache.JSObject_ptr_t) elif tag == self.jtc.SYMBOL: value = self.box.as_address().cast(self.cache.JSSymbol_ptr_t) - elif self.jtc.enable_bigint and tag == self.jtc.BIGINT: + elif tag == self.jtc.BIGINT: return '$JS::BigIntValue()' else: value = 'unrecognized!' diff --git a/js/src/gdb/tests/test-jsval.cpp b/js/src/gdb/tests/test-jsval.cpp index 55c230e7cf6ab..9fe172e6fcaf6 100644 --- a/js/src/gdb/tests/test-jsval.cpp +++ b/js/src/gdb/tests/test-jsval.cpp @@ -2,9 +2,7 @@ #include "jsapi.h" #include "js/Symbol.h" -#ifdef ENABLE_BIGINT -# include "vm/BigIntType.h" -#endif +#include "vm/BigIntType.h" FRAGMENT(jsval, simple) { using namespace JS; @@ -23,9 +21,7 @@ FRAGMENT(jsval, simple) { RootedString hello(cx, JS_NewStringCopyZ(cx, "Hello!")); RootedValue friendly_string(cx, StringValue(hello)); RootedValue symbol(cx, SymbolValue(GetSymbolFor(cx, hello))); -#ifdef ENABLE_BIGINT RootedValue bi(cx, BigIntValue(BigInt::zero(cx))); -#endif RootedValue global(cx); global.setObject(*CurrentGlobalOrNull(cx)); @@ -47,8 +43,6 @@ FRAGMENT(jsval, simple) { use(empty_string); use(friendly_string); use(symbol); -#ifdef ENABLE_BIGINT use(bi); -#endif use(global); } diff --git a/js/src/gdb/tests/test-jsval.py b/js/src/gdb/tests/test-jsval.py index 24e0f9685427f..f542fc8eeb65d 100644 --- a/js/src/gdb/tests/test-jsval.py +++ b/js/src/gdb/tests/test-jsval.py @@ -16,7 +16,6 @@ assert_pretty('empty_string', '$JS::Value("")') assert_pretty('friendly_string', '$JS::Value("Hello!")') assert_pretty('symbol', '$JS::Value(Symbol.for("Hello!"))') -if enable_bigint: - assert_pretty('bi', '$JS::BigIntValue()') +assert_pretty('bi', '$JS::BigIntValue()') assert_pretty('global', '$JS::Value((JSObject *) [object global] delegate)') assert_pretty('onehundredthirtysevenonehundredtwentyeighths', '$JS::DoubleValue(1.0703125)') diff --git a/js/src/jit/BaselineBailouts.cpp b/js/src/jit/BaselineBailouts.cpp index be622c81353a5..0ed68ff2cece5 100644 --- a/js/src/jit/BaselineBailouts.cpp +++ b/js/src/jit/BaselineBailouts.cpp @@ -2183,9 +2183,7 @@ bool jit::FinishBailoutToBaseline(BaselineBailoutInfo* bailoutInfo) { case Bailout_NonObjectInput: case Bailout_NonStringInput: case Bailout_NonSymbolInput: -#ifdef ENABLE_BIGINT case Bailout_NonBigIntInput: -#endif case Bailout_NonSharedTypedArrayInput: case Bailout_Debugger: case Bailout_UninitializedThis: diff --git a/js/src/jit/BaselineCompiler.cpp b/js/src/jit/BaselineCompiler.cpp index 4603bf7a0738f..08f07ca796b91 100644 --- a/js/src/jit/BaselineCompiler.cpp +++ b/js/src/jit/BaselineCompiler.cpp @@ -2042,12 +2042,10 @@ bool BaselineInterpreterCodeGen::emit_JSOP_DOUBLE() { MOZ_CRASH("NYI: interpreter JSOP_DOUBLE"); } -#ifdef ENABLE_BIGINT template bool BaselineCodeGen::emit_JSOP_BIGINT() { return emit_JSOP_DOUBLE(); } -#endif template <> bool BaselineCompilerCodeGen::emit_JSOP_STRING() { diff --git a/js/src/jit/BaselineCompiler.h b/js/src/jit/BaselineCompiler.h index cf88e0b2af76f..c99c9b78bd4fa 100644 --- a/js/src/jit/BaselineCompiler.h +++ b/js/src/jit/BaselineCompiler.h @@ -55,7 +55,7 @@ namespace jit { _(JSOP_UINT24) \ _(JSOP_RESUMEINDEX) \ _(JSOP_DOUBLE) \ - IF_BIGINT(_(JSOP_BIGINT), ) \ + _(JSOP_BIGINT) \ _(JSOP_STRING) \ _(JSOP_SYMBOL) \ _(JSOP_OBJECT) \ diff --git a/js/src/jit/BaselineIC.cpp b/js/src/jit/BaselineIC.cpp index 9787dbbd5f720..7e2042e0b50dc 100644 --- a/js/src/jit/BaselineIC.cpp +++ b/js/src/jit/BaselineIC.cpp @@ -1464,11 +1464,9 @@ bool ICTypeMonitor_PrimitiveSet::Compiler::generateStubCode( masm.branchTestSymbol(Assembler::Equal, R0, &success); } -#ifdef ENABLE_BIGINT if (flags_ & TypeToFlag(JSVAL_TYPE_BIGINT)) { masm.branchTestBigInt(Assembler::Equal, R0, &success); } -#endif if (flags_ & TypeToFlag(JSVAL_TYPE_OBJECT)) { masm.branchTestObject(Assembler::Equal, R0, &success); @@ -1810,11 +1808,9 @@ bool ICTypeUpdate_PrimitiveSet::Compiler::generateStubCode( masm.branchTestSymbol(Assembler::Equal, R0, &success); } -#ifdef ENABLE_BIGINT if (flags_ & TypeToFlag(JSVAL_TYPE_BIGINT)) { masm.branchTestBigInt(Assembler::Equal, R0, &success); } -#endif if (flags_ & TypeToFlag(JSVAL_TYPE_OBJECT)) { masm.branchTestObject(Assembler::Equal, R0, &success); diff --git a/js/src/jit/BaselineInspector.cpp b/js/src/jit/BaselineInspector.cpp index 17c01b2e7ce27..c2952eccea440 100644 --- a/js/src/jit/BaselineInspector.cpp +++ b/js/src/jit/BaselineInspector.cpp @@ -485,11 +485,9 @@ static bool GuardType(CacheIRReader& reader, case CacheOp::GuardIsSymbol: guardType[guardOperand] = MIRType::Symbol; break; -#ifdef ENABLE_BIGINT case CacheOp::GuardIsBigInt: guardType[guardOperand] = MIRType::BigInt; break; -#endif case CacheOp::GuardIsNumber: guardType[guardOperand] = MIRType::Double; break; diff --git a/js/src/jit/CacheIR.cpp b/js/src/jit/CacheIR.cpp index 5ffef3c66adac..6469d953d1a48 100644 --- a/js/src/jit/CacheIR.cpp +++ b/js/src/jit/CacheIR.cpp @@ -1952,13 +1952,9 @@ bool GetPropIRGenerator::tryAttachPrimitive(ValOperandId valId, HandleId id) { protoKey = JSProto_Boolean; } else if (val_.isSymbol()) { protoKey = JSProto_Symbol; - } -#ifdef ENABLE_BIGINT - else if (val_.isBigInt()) { + } else if (val_.isBigInt()) { protoKey = JSProto_BigInt; - } -#endif - else { + } else { MOZ_ASSERT(val_.isNullOrUndefined() || val_.isMagic()); return false; } @@ -5444,7 +5440,7 @@ bool CompareIRGenerator::tryAttachPrimitiveUndefined(ValOperandId lhsId, // undefined) auto isPrimitive = [](HandleValue& x) { return x.isString() || x.isSymbol() || x.isBoolean() || x.isNumber() || - IF_BIGINT(x.isBigInt(), false); + x.isBigInt(); }; if (!(lhsVal_.isNullOrUndefined() && isPrimitive(rhsVal_)) && @@ -5464,11 +5460,9 @@ bool CompareIRGenerator::tryAttachPrimitiveUndefined(ValOperandId lhsId, case JSVAL_TYPE_SYMBOL: writer.guardIsSymbol(id); return; -#ifdef ENABLE_BIGINT case JSVAL_TYPE_BIGINT: writer.guardIsBigInt(id); return; -#endif case JSVAL_TYPE_STRING: writer.guardIsString(id); return; diff --git a/js/src/jit/CacheIR.h b/js/src/jit/CacheIR.h index 25355b84460fd..a8c8317fca239 100644 --- a/js/src/jit/CacheIR.h +++ b/js/src/jit/CacheIR.h @@ -109,13 +109,11 @@ class SymbolOperandId : public OperandId { explicit SymbolOperandId(uint16_t id) : OperandId(id) {} }; -#ifdef ENABLE_BIGINT class BigIntOperandId : public OperandId { public: BigIntOperandId() = default; explicit BigIntOperandId(uint16_t id) : OperandId(id) {} }; -#endif class Int32OperandId : public OperandId { public: @@ -133,10 +131,8 @@ class TypedOperandId : public OperandId { : OperandId(id.id()), type_(JSVAL_TYPE_STRING) {} MOZ_IMPLICIT TypedOperandId(SymbolOperandId id) : OperandId(id.id()), type_(JSVAL_TYPE_SYMBOL) {} -#ifdef ENABLE_BIGINT MOZ_IMPLICIT TypedOperandId(BigIntOperandId id) : OperandId(id.id()), type_(JSVAL_TYPE_BIGINT) {} -#endif MOZ_IMPLICIT TypedOperandId(Int32OperandId id) : OperandId(id.id()), type_(JSVAL_TYPE_INT32) {} MOZ_IMPLICIT TypedOperandId(ValueTagOperandId val) @@ -187,7 +183,7 @@ extern const char* const CacheKindNames[]; _(GuardIsBoolean) \ _(GuardIsString) \ _(GuardIsSymbol) \ - IF_BIGINT(_(GuardIsBigInt), ) \ + _(GuardIsBigInt) \ _(GuardIsNumber) \ _(GuardIsInt32) \ _(GuardIsInt32Index) \ @@ -608,12 +604,10 @@ class MOZ_RAII CacheIRWriter : public JS::CustomAutoRooter { writeOpWithOperandId(CacheOp::GuardIsSymbol, val); return SymbolOperandId(val.id()); } -#ifdef ENABLE_BIGINT BigIntOperandId guardIsBigInt(ValOperandId val) { writeOpWithOperandId(CacheOp::GuardIsBigInt, val); return BigIntOperandId(val.id()); } -#endif Int32OperandId guardIsInt32(ValOperandId val) { Int32OperandId res(nextOperandId_++); writeOpWithOperandId(CacheOp::GuardIsInt32, val); diff --git a/js/src/jit/CacheIRCompiler.cpp b/js/src/jit/CacheIRCompiler.cpp index f26473eddceac..21b851a71e032 100644 --- a/js/src/jit/CacheIRCompiler.cpp +++ b/js/src/jit/CacheIRCompiler.cpp @@ -1477,7 +1477,6 @@ bool CacheIRCompiler::emitGuardIsSymbol() { return true; } -#ifdef ENABLE_BIGINT bool CacheIRCompiler::emitGuardIsBigInt() { JitSpew(JitSpew_Codegen, __FUNCTION__); ValOperandId inputId = reader.valOperandId(); @@ -1493,7 +1492,6 @@ bool CacheIRCompiler::emitGuardIsBigInt() { masm.branchTestBigInt(Assembler::NotEqual, input, failure->label()); return true; } -#endif bool CacheIRCompiler::emitGuardIsInt32() { JitSpew(JitSpew_Codegen, __FUNCTION__); @@ -1591,11 +1589,9 @@ bool CacheIRCompiler::emitGuardType() { case JSVAL_TYPE_SYMBOL: masm.branchTestSymbol(Assembler::NotEqual, input, failure->label()); break; -#ifdef ENABLE_BIGINT case JSVAL_TYPE_BIGINT: masm.branchTestBigInt(Assembler::NotEqual, input, failure->label()); break; -#endif case JSVAL_TYPE_INT32: masm.branchTestInt32(Assembler::NotEqual, input, failure->label()); break; diff --git a/js/src/jit/CacheIRCompiler.h b/js/src/jit/CacheIRCompiler.h index 4940b0db86ddb..a7c0402681ae2 100644 --- a/js/src/jit/CacheIRCompiler.h +++ b/js/src/jit/CacheIRCompiler.h @@ -26,7 +26,7 @@ namespace jit { _(GuardIsBoolean) \ _(GuardIsString) \ _(GuardIsSymbol) \ - IF_BIGINT(_(GuardIsBigInt), ) \ + _(GuardIsBigInt) \ _(GuardIsNumber) \ _(GuardIsInt32) \ _(GuardIsInt32Index) \ diff --git a/js/src/jit/CodeGenerator.cpp b/js/src/jit/CodeGenerator.cpp index ec0c07ced1195..59883fecf1473 100644 --- a/js/src/jit/CodeGenerator.cpp +++ b/js/src/jit/CodeGenerator.cpp @@ -786,7 +786,7 @@ void CodeGenerator::testValueTruthyKernel( bool mightBeString = valueMIR->mightBeType(MIRType::String); bool mightBeSymbol = valueMIR->mightBeType(MIRType::Symbol); bool mightBeDouble = valueMIR->mightBeType(MIRType::Double); - bool mightBeBigInt = IF_BIGINT(valueMIR->mightBeType(MIRType::BigInt), false); + bool mightBeBigInt = valueMIR->mightBeType(MIRType::BigInt); int tagCount = int(mightBeUndefined) + int(mightBeNull) + int(mightBeBoolean) + int(mightBeInt32) + int(mightBeObject) + int(mightBeString) + int(mightBeSymbol) + int(mightBeDouble) + @@ -904,7 +904,6 @@ void CodeGenerator::testValueTruthyKernel( --tagCount; } -#ifdef ENABLE_BIGINT if (mightBeBigInt) { MOZ_ASSERT(tagCount != 0); Label notBigInt; @@ -921,7 +920,6 @@ void CodeGenerator::testValueTruthyKernel( masm.bind(¬BigInt); --tagCount; } -#endif if (mightBeSymbol) { // All symbols are truthy. @@ -1265,13 +1263,11 @@ void CodeGenerator::visitValueToString(LValueToString* lir) { bailoutFrom(&bail, lir->snapshot()); } -#ifdef ENABLE_BIGINT // BigInt if (lir->mir()->input()->mightBeType(MIRType::BigInt)) { // No fastpath currently implemented. masm.branchTestBigInt(Assembler::Equal, tag, ool->entry()); } -#endif #ifdef DEBUG masm.assumeUnreachable("Unexpected type for MValueToString."); @@ -4009,10 +4005,8 @@ void CodeGenerator::visitToNumeric(LToNumeric* lir) { bool maybeInt32 = lir->mir()->mightBeType(MIRType::Int32); bool maybeDouble = lir->mir()->mightBeType(MIRType::Double); bool maybeNumber = maybeInt32 || maybeDouble; -#ifdef ENABLE_BIGINT bool maybeBigInt = lir->mir()->mightBeType(MIRType::BigInt); -#endif - int checks = int(maybeNumber) + IF_BIGINT(int(maybeBigInt), 0); + int checks = int(maybeNumber) + int(maybeBigInt); OutOfLineCode* ool = oolCallVM(ToNumericInfo, lir, ArgList(operand), StoreValueTo(output)); @@ -4031,14 +4025,12 @@ void CodeGenerator::visitToNumeric(LToNumeric* lir) { Label* target = checks ? &done : ool->entry(); masm.branchTestNumber(cond, operand, target); } -#ifdef ENABLE_BIGINT if (maybeBigInt) { checks--; Condition cond = checks ? Equal : NotEqual; Label* target = checks ? &done : ool->entry(); masm.branchTestBigInt(cond, operand, target); } -#endif MOZ_ASSERT(checks == 0); masm.bind(&done); @@ -5676,7 +5668,7 @@ void CodeGenerator::emitAssertGCThingResult(Register input, MIRType type, const TemporaryTypeSet* typeset) { MOZ_ASSERT(type == MIRType::Object || type == MIRType::ObjectOrNull || type == MIRType::String || type == MIRType::Symbol || - IF_BIGINT(type == MIRType::BigInt, false)); + type == MIRType::BigInt); AllocatableGeneralRegisterSet regs(GeneralRegisterSet::All()); regs.take(input); @@ -5734,11 +5726,9 @@ void CodeGenerator::emitAssertGCThingResult(Register input, MIRType type, case MIRType::Symbol: callee = JS_FUNC_TO_DATA_PTR(void*, AssertValidSymbolPtr); break; -# ifdef ENABLE_BIGINT case MIRType::BigInt: callee = JS_FUNC_TO_DATA_PTR(void*, AssertValidBigIntPtr); break; -# endif default: MOZ_CRASH(); } @@ -5853,9 +5843,7 @@ void CodeGenerator::emitDebugResultChecks(LInstruction* ins) { case MIRType::ObjectOrNull: case MIRType::String: case MIRType::Symbol: -# ifdef ENABLE_BIGINT case MIRType::BigInt: -# endif emitGCThingResultChecks(ins, mir); break; case MIRType::Value: @@ -11254,14 +11242,12 @@ void CodeGenerator::visitTypeOfV(LTypeOfV* lir) { bool testNull = input->mightBeType(MIRType::Null); bool testString = input->mightBeType(MIRType::String); bool testSymbol = input->mightBeType(MIRType::Symbol); -#ifdef ENABLE_BIGINT bool testBigInt = input->mightBeType(MIRType::BigInt); -#endif unsigned numTests = unsigned(testObject) + unsigned(testNumber) + unsigned(testBoolean) + unsigned(testUndefined) + unsigned(testNull) + unsigned(testString) + - unsigned(testSymbol) + unsigned(IF_BIGINT(testBigInt, 0)); + unsigned(testSymbol) + unsigned(testBigInt); MOZ_ASSERT_IF(!input->emptyResultTypeSet(), numTests > 0); @@ -11372,7 +11358,6 @@ void CodeGenerator::visitTypeOfV(LTypeOfV* lir) { numTests--; } -#ifdef ENABLE_BIGINT if (testBigInt) { Label notBigInt; if (numTests > 1) { @@ -11385,7 +11370,6 @@ void CodeGenerator::visitTypeOfV(LTypeOfV* lir) { masm.bind(¬BigInt); numTests--; } -#endif MOZ_ASSERT(numTests == 0); diff --git a/js/src/jit/IonAnalysis.cpp b/js/src/jit/IonAnalysis.cpp index 5aa3b1d87ea6f..f07dfef663b63 100644 --- a/js/src/jit/IonAnalysis.cpp +++ b/js/src/jit/IonAnalysis.cpp @@ -2345,7 +2345,7 @@ static bool CanCompareRegExp(MCompare* compare, MDefinition* def) { value->mightBeType(MIRType::Double) || value->mightBeType(MIRType::Float32) || value->mightBeType(MIRType::Symbol) || - IF_BIGINT(value->mightBeType(MIRType::BigInt), false)) { + value->mightBeType(MIRType::BigInt)) { return false; } @@ -3177,9 +3177,7 @@ static bool IsResumableMIRType(MIRType type) { case MIRType::Float32: case MIRType::String: case MIRType::Symbol: -# ifdef ENABLE_BIGINT case MIRType::BigInt: -# endif case MIRType::Object: case MIRType::MagicOptimizedArguments: case MIRType::MagicOptimizedOut: diff --git a/js/src/jit/IonBuilder.cpp b/js/src/jit/IonBuilder.cpp index 30cd6833d3e77..55ae1594b120f 100644 --- a/js/src/jit/IonBuilder.cpp +++ b/js/src/jit/IonBuilder.cpp @@ -717,11 +717,9 @@ AbortReasonOr IonBuilder::analyzeNewLoopTypes( case JSOP_DEC: type = inspector->expectedResultType(last); break; -#ifdef ENABLE_BIGINT case JSOP_BIGINT: type = MIRType::BigInt; break; -#endif default: break; } @@ -1341,9 +1339,7 @@ AbortReasonOr IonBuilder::addOsrValueTypeBarrier( case MIRType::Double: case MIRType::String: case MIRType::Symbol: -#ifdef ENABLE_BIGINT case MIRType::BigInt: -#endif case MIRType::Object: if (type != def->type()) { MUnbox* unbox = MUnbox::New(alloc(), def, type, MUnbox::Fallible); @@ -1936,9 +1932,7 @@ AbortReasonOr IonBuilder::inspectOpcode(JSOp op) { return jsop_compare(op); case JSOP_DOUBLE: -#ifdef ENABLE_BIGINT case JSOP_BIGINT: -#endif pushConstant(info().getConst(pc)); return Ok(); @@ -2809,13 +2803,9 @@ AbortReasonOr IonBuilder::improveTypesAtTypeOfCompare(MCompare* ins, filter.addType(TypeSet::StringType(), alloc_->lifoAlloc()); } else if (constant->toString() == TypeName(JSTYPE_SYMBOL, names)) { filter.addType(TypeSet::SymbolType(), alloc_->lifoAlloc()); - } -#ifdef ENABLE_BIGINT - else if (constant->toString() == TypeName(JSTYPE_BIGINT, names)) { + } else if (constant->toString() == TypeName(JSTYPE_BIGINT, names)) { filter.addType(TypeSet::BigIntType(), alloc_->lifoAlloc()); - } -#endif - else if (constant->toString() == TypeName(JSTYPE_OBJECT, names)) { + } else if (constant->toString() == TypeName(JSTYPE_OBJECT, names)) { filter.addType(TypeSet::NullType(), alloc_->lifoAlloc()); if (trueBranch) { filter.addType(TypeSet::AnyObjectType(), alloc_->lifoAlloc()); @@ -3059,10 +3049,8 @@ AbortReasonOr IonBuilder::improveTypesAtTest(MDefinition* ins, alloc_->lifoAlloc()); // ToBoolean(0.0) == false base.addType(TypeSet::StringType(), alloc_->lifoAlloc()); // ToBoolean("") == false -#ifdef ENABLE_BIGINT base.addType(TypeSet::BigIntType(), alloc_->lifoAlloc()); // ToBoolean(0n) == false -#endif // If the typeset does emulate undefined, then we cannot filter out // objects. @@ -3371,7 +3359,7 @@ AbortReasonOr IonBuilder::bitnotTrySpecialized(bool* emitted, if (input->mightBeType(MIRType::Object) || input->mightBeType(MIRType::Symbol) || - IF_BIGINT(input->mightBeType(MIRType::BigInt), false)) { + input->mightBeType(MIRType::BigInt)) { return Ok(); } @@ -3825,9 +3813,7 @@ AbortReasonOr IonBuilder::jsop_tonumeric() { types->addType(TypeSet::Int32Type(), lifoAlloc); types->addType(TypeSet::DoubleType(), lifoAlloc); -#ifdef ENABLE_BIGINT types->addType(TypeSet::BigIntType(), lifoAlloc); -#endif if (peeked->type() == MIRType::Value && peeked->resultTypeSet() && peeked->resultTypeSet()->isSubset(types)) { @@ -6270,7 +6256,7 @@ static bool ObjectOrSimplePrimitive(MDefinition* op) { // Return true if op is either undefined/null/boolean/int32/symbol or an // object. return !op->mightBeType(MIRType::String) && - IF_BIGINT(!op->mightBeType(MIRType::BigInt), true) && + !op->mightBeType(MIRType::BigInt) && !op->mightBeType(MIRType::Double) && !op->mightBeType(MIRType::Float32) && !op->mightBeType(MIRType::MagicOptimizedArguments) && @@ -7521,11 +7507,9 @@ JSObject* IonBuilder::testSingletonPropertyTypes(MDefinition* obj, jsid id) { key = JSProto_Symbol; break; -#ifdef ENABLE_BIGINT case MIRType::BigInt: key = JSProto_BigInt; break; -#endif case MIRType::Int32: case MIRType::Double: diff --git a/js/src/jit/IonTypes.h b/js/src/jit/IonTypes.h index bcc18088bff9d..152a13c51d83e 100644 --- a/js/src/jit/IonTypes.h +++ b/js/src/jit/IonTypes.h @@ -124,9 +124,7 @@ enum BailoutKind { Bailout_NonObjectInput, Bailout_NonStringInput, Bailout_NonSymbolInput, -#ifdef ENABLE_BIGINT Bailout_NonBigIntInput, -#endif // Atomic operations require shared memory, bail out if the typed array // maps unshared memory. @@ -226,10 +224,8 @@ inline const char* BailoutKindString(BailoutKind kind) { return "Bailout_NonStringInput"; case Bailout_NonSymbolInput: return "Bailout_NonSymbolInput"; -#ifdef ENABLE_BIGINT case Bailout_NonBigIntInput: return "Bailout_NonBigIntInput"; -#endif case Bailout_NonSharedTypedArrayInput: return "Bailout_NonSharedTypedArrayInput"; case Bailout_Debugger: @@ -448,9 +444,7 @@ enum class MIRType : uint8_t { // Types above have trivial conversion to a number. String, Symbol, -#ifdef ENABLE_BIGINT BigInt, -#endif // Types above are primitive (including undefined and null). Object, MagicOptimizedArguments, // JS_OPTIMIZED_ARGUMENTS magic value. @@ -499,10 +493,8 @@ static inline MIRType MIRTypeFromValueType(JSValueType type) { return MIRType::String; case JSVAL_TYPE_SYMBOL: return MIRType::Symbol; -#ifdef ENABLE_BIGINT case JSVAL_TYPE_BIGINT: return MIRType::BigInt; -#endif case JSVAL_TYPE_BOOLEAN: return MIRType::Boolean; case JSVAL_TYPE_NULL: @@ -533,10 +525,8 @@ static inline JSValueType ValueTypeFromMIRType(MIRType type) { return JSVAL_TYPE_STRING; case MIRType::Symbol: return JSVAL_TYPE_SYMBOL; -#ifdef ENABLE_BIGINT case MIRType::BigInt: return JSVAL_TYPE_BIGINT; -#endif case MIRType::MagicOptimizedArguments: case MIRType::MagicOptimizedOut: case MIRType::MagicHole: @@ -591,10 +581,8 @@ static inline const char* StringFromMIRType(MIRType type) { return "String"; case MIRType::Symbol: return "Symbol"; -#ifdef ENABLE_BIGINT case MIRType::BigInt: return "BigInt"; -#endif case MIRType::Object: return "Object"; case MIRType::MagicOptimizedArguments: @@ -657,7 +645,7 @@ static inline bool IsNumberType(MIRType type) { } static inline bool IsNumericType(MIRType type) { - return IsNumberType(type) || IF_BIGINT(type == MIRType::BigInt, false); + return IsNumberType(type) || type == MIRType::BigInt; } static inline bool IsTypeRepresentableAsDouble(MIRType type) { diff --git a/js/src/jit/JitFrames.cpp b/js/src/jit/JitFrames.cpp index f215856699217..61b67ebb24ea3 100644 --- a/js/src/jit/JitFrames.cpp +++ b/js/src/jit/JitFrames.cpp @@ -1500,11 +1500,9 @@ static Value FromSymbolPayload(uintptr_t payload) { return SymbolValue(reinterpret_cast(payload)); } -#ifdef ENABLE_BIGINT static Value FromBigIntPayload(uintptr_t payload) { return BigIntValue(reinterpret_cast(payload)); } -#endif static Value FromTypedPayload(JSValueType type, uintptr_t payload) { switch (type) { @@ -1516,10 +1514,8 @@ static Value FromTypedPayload(JSValueType type, uintptr_t payload) { return FromStringPayload(payload); case JSVAL_TYPE_SYMBOL: return FromSymbolPayload(payload); -#ifdef ENABLE_BIGINT case JSVAL_TYPE_BIGINT: return FromBigIntPayload(payload); -#endif case JSVAL_TYPE_OBJECT: return FromObjectPayload(payload); default: @@ -1616,10 +1612,8 @@ Value SnapshotIterator::allocationValue(const RValueAllocation& alloc, return FromStringPayload(fromStack(alloc.stackOffset2())); case JSVAL_TYPE_SYMBOL: return FromSymbolPayload(fromStack(alloc.stackOffset2())); -#ifdef ENABLE_BIGINT case JSVAL_TYPE_BIGINT: return FromBigIntPayload(fromStack(alloc.stackOffset2())); -#endif case JSVAL_TYPE_OBJECT: return FromObjectPayload(fromStack(alloc.stackOffset2())); default: @@ -1741,9 +1735,7 @@ void SnapshotIterator::writeAllocationValuePayload( break; case JSVAL_TYPE_STRING: case JSVAL_TYPE_SYMBOL: -#ifdef ENABLE_BIGINT case JSVAL_TYPE_BIGINT: -#endif case JSVAL_TYPE_OBJECT: WriteFrameSlot(fp_, alloc.stackOffset2(), uintptr_t(v.toGCThing())); break; diff --git a/js/src/jit/LIR.h b/js/src/jit/LIR.h index 49737de734237..a4f3835043c61 100644 --- a/js/src/jit/LIR.h +++ b/js/src/jit/LIR.h @@ -525,9 +525,7 @@ class LDefinition { return LDefinition::INT32; case MIRType::String: case MIRType::Symbol: -#ifdef ENABLE_BIGINT case MIRType::BigInt: -#endif case MIRType::Object: case MIRType::ObjectOrNull: return LDefinition::OBJECT; diff --git a/js/src/jit/Lowering.cpp b/js/src/jit/Lowering.cpp index 413cca345e413..e917af4d80b67 100644 --- a/js/src/jit/Lowering.cpp +++ b/js/src/jit/Lowering.cpp @@ -606,11 +606,9 @@ void LIRGenerator::visitTest(MTest* test) { // TestPolicy). MOZ_ASSERT(opd->type() != MIRType::String); -#ifdef ENABLE_BIGINT // BigInt is boxed in type analysis. MOZ_ASSERT(opd->type() != MIRType::BigInt, "BigInt should be boxed by TestPolicy"); -#endif // Testing a constant. if (MConstant* constant = opd->maybeConstantValue()) { @@ -2112,9 +2110,7 @@ void LIRGenerator::visitToNumberInt32(MToNumberInt32* convert) { case MIRType::String: case MIRType::Symbol: -#ifdef ENABLE_BIGINT case MIRType::BigInt: -#endif case MIRType::Object: case MIRType::Undefined: // Objects might be effectful. Symbols and BigInts throw. Undefined @@ -2921,10 +2917,8 @@ void LIRGenerator::visitNot(MNot* ins) { // String is converted to length of string in the type analysis phase (see // TestPolicy). MOZ_ASSERT(op->type() != MIRType::String); -#ifdef ENABLE_BIGINT MOZ_ASSERT(op->type() != MIRType::BigInt, "BigInt should be boxed by TestPolicy"); -#endif // - boolean: x xor 1 // - int32: LCompare(x, 0) @@ -4720,11 +4714,9 @@ void LIRGenerator::visitConstant(MConstant* ins) { case MIRType::Symbol: define(new (alloc()) LPointer(ins->toSymbol()), ins); break; -#ifdef ENABLE_BIGINT case MIRType::BigInt: define(new (alloc()) LPointer(ins->toBigInt()), ins); break; -#endif case MIRType::Object: define(new (alloc()) LPointer(&ins->toObject()), ins); break; diff --git a/js/src/jit/MCallOptimize.cpp b/js/src/jit/MCallOptimize.cpp index 1eb89c11c04b7..80f379e7b7b3e 100644 --- a/js/src/jit/MCallOptimize.cpp +++ b/js/src/jit/MCallOptimize.cpp @@ -2139,7 +2139,7 @@ IonBuilder::InliningResult IonBuilder::inlineStrFromCharCode( // don't try to inline String.fromCharCode() for these value types. if (codeUnit->mightBeType(MIRType::Object) || codeUnit->mightBeType(MIRType::Symbol) || - IF_BIGINT(codeUnit->mightBeType(MIRType::BigInt), false)) { + codeUnit->mightBeType(MIRType::BigInt)) { return InliningStatus_NotInlined; } @@ -3627,7 +3627,7 @@ IonBuilder::InliningResult IonBuilder::inlineToInteger(CallInfo& callInfo) { if (input->mightBeType(MIRType::Object) || input->mightBeType(MIRType::String) || input->mightBeType(MIRType::Symbol) || - IF_BIGINT(input->mightBeType(MIRType::BigInt), false) || + input->mightBeType(MIRType::BigInt) || input->mightBeType(MIRType::Undefined) || input->mightBeMagicType()) { return InliningStatus_NotInlined; } @@ -3753,14 +3753,14 @@ IonBuilder::InliningResult IonBuilder::inlineAtomicsCompareExchange( MDefinition* oldval = callInfo.getArg(2); if (oldval->mightBeType(MIRType::Object) || oldval->mightBeType(MIRType::Symbol) || - IF_BIGINT(oldval->mightBeType(MIRType::BigInt), false)) { + oldval->mightBeType(MIRType::BigInt)) { return InliningStatus_NotInlined; } MDefinition* newval = callInfo.getArg(3); if (newval->mightBeType(MIRType::Object) || newval->mightBeType(MIRType::Symbol) || - IF_BIGINT(newval->mightBeType(MIRType::BigInt), false)) { + newval->mightBeType(MIRType::BigInt)) { return InliningStatus_NotInlined; } @@ -3801,7 +3801,7 @@ IonBuilder::InliningResult IonBuilder::inlineAtomicsExchange( MDefinition* value = callInfo.getArg(2); if (value->mightBeType(MIRType::Object) || value->mightBeType(MIRType::Symbol) || - IF_BIGINT(value->mightBeType(MIRType::BigInt), false)) { + value->mightBeType(MIRType::BigInt)) { return InliningStatus_NotInlined; } @@ -3887,7 +3887,7 @@ IonBuilder::InliningResult IonBuilder::inlineAtomicsStore(CallInfo& callInfo) { if (value->mightBeType(MIRType::Object) || value->mightBeType(MIRType::Symbol) || - IF_BIGINT(value->mightBeType(MIRType::BigInt), false)) { + value->mightBeType(MIRType::BigInt)) { return InliningStatus_NotInlined; } @@ -3933,7 +3933,7 @@ IonBuilder::InliningResult IonBuilder::inlineAtomicsBinop( MDefinition* value = callInfo.getArg(2); if (value->mightBeType(MIRType::Object) || value->mightBeType(MIRType::Symbol) || - IF_BIGINT(value->mightBeType(MIRType::BigInt), false)) { + value->mightBeType(MIRType::BigInt)) { return InliningStatus_NotInlined; } diff --git a/js/src/jit/MIR.cpp b/js/src/jit/MIR.cpp index d127c75ce457a..69e82bfa4af21 100644 --- a/js/src/jit/MIR.cpp +++ b/js/src/jit/MIR.cpp @@ -939,11 +939,9 @@ MConstant::MConstant(TempAllocator& alloc, const js::Value& vp, case MIRType::Symbol: payload_.sym = vp.toSymbol(); break; -#ifdef ENABLE_BIGINT case MIRType::BigInt: payload_.bi = vp.toBigInt(); break; -#endif case MIRType::Object: payload_.obj = &vp.toObject(); // Create a singleton type set for the object. This isn't necessary for @@ -1021,9 +1019,7 @@ void MConstant::assertInitializedPayload() const { case MIRType::String: case MIRType::Object: case MIRType::Symbol: -# ifdef ENABLE_BIGINT case MIRType::BigInt: -# endif # if MOZ_LITTLE_ENDIAN MOZ_ASSERT_IF(JS_BITS_PER_WORD == 32, (payload_.asBits >> 32) == 0); # else @@ -1115,11 +1111,9 @@ void MConstant::printOpcode(GenericPrinter& out) const { case MIRType::Symbol: out.printf("symbol at %p", (void*)toSymbol()); break; -# ifdef ENABLE_BIGINT case MIRType::BigInt: out.printf("BigInt at %p", (void*)toBigInt()); break; -# endif case MIRType::String: out.printf("string %p", (void*)toString()); break; @@ -1181,10 +1175,8 @@ Value MConstant::toJSValue() const { return StringValue(toString()); case MIRType::Symbol: return SymbolValue(toSymbol()); -#ifdef ENABLE_BIGINT case MIRType::BigInt: return BigIntValue(toBigInt()); -#endif case MIRType::Object: return ObjectValue(toObject()); case MIRType::MagicOptimizedArguments: @@ -1226,11 +1218,9 @@ bool MConstant::valueToBoolean(bool* res) const { case MIRType::Symbol: *res = true; return true; -#ifdef ENABLE_BIGINT case MIRType::BigInt: *res = !toBigInt()->isZero(); return true; -#endif case MIRType::String: *res = toString()->length() != 0; return true; @@ -1772,11 +1762,9 @@ void MUnbox::printOpcode(GenericPrinter& out) const { case MIRType::Symbol: out.printf("to Symbol"); break; -# ifdef ENABLE_BIGINT case MIRType::BigInt: out.printf("to BigInt"); break; -# endif case MIRType::Object: out.printf("to Object"); break; @@ -2255,9 +2243,7 @@ bool jit::TypeSetIncludes(TypeSet* types, MIRType input, TypeSet* inputTypes) { case MIRType::Float32: case MIRType::String: case MIRType::Symbol: -#ifdef ENABLE_BIGINT case MIRType::BigInt: -#endif case MIRType::MagicOptimizedArguments: return types->hasType( TypeSet::PrimitiveType(ValueTypeFromMIRType(input))); @@ -2518,10 +2504,10 @@ MDefinition* MBinaryBitwiseInstruction::foldUnnecessaryBitop() { void MBinaryBitwiseInstruction::infer(BaselineInspector*, jsbytecode*) { if (getOperand(0)->mightBeType(MIRType::Object) || getOperand(0)->mightBeType(MIRType::Symbol) || - IF_BIGINT(getOperand(0)->mightBeType(MIRType::BigInt), false) || + getOperand(0)->mightBeType(MIRType::BigInt) || getOperand(1)->mightBeType(MIRType::Object) || getOperand(1)->mightBeType(MIRType::Symbol) || - IF_BIGINT(getOperand(1)->mightBeType(MIRType::BigInt), false)) { + getOperand(1)->mightBeType(MIRType::BigInt)) { specialization_ = MIRType::None; setResultType(MIRType::Value); } else { @@ -2546,8 +2532,8 @@ void MShiftInstruction::infer(BaselineInspector*, jsbytecode*) { getOperand(1)->mightBeType(MIRType::Object) || getOperand(0)->mightBeType(MIRType::Symbol) || getOperand(1)->mightBeType(MIRType::Symbol) || - IF_BIGINT(getOperand(0)->mightBeType(MIRType::BigInt), false) || - IF_BIGINT(getOperand(1)->mightBeType(MIRType::BigInt), false)) { + getOperand(0)->mightBeType(MIRType::BigInt) || + getOperand(1)->mightBeType(MIRType::BigInt)) { specialization_ = MIRType::None; setResultType(MIRType::Value); } else { @@ -2561,8 +2547,8 @@ void MUrsh::infer(BaselineInspector* inspector, jsbytecode* pc) { getOperand(1)->mightBeType(MIRType::Object) || getOperand(0)->mightBeType(MIRType::Symbol) || getOperand(1)->mightBeType(MIRType::Symbol) || - IF_BIGINT(getOperand(0)->mightBeType(MIRType::BigInt), false) || - IF_BIGINT(getOperand(1)->mightBeType(MIRType::BigInt), false)) { + getOperand(0)->mightBeType(MIRType::BigInt) || + getOperand(1)->mightBeType(MIRType::BigInt)) { specialization_ = MIRType::None; setResultType(MIRType::Value); return; @@ -3603,11 +3589,9 @@ MDefinition* MTypeOf::foldsTo(TempAllocator& alloc) { case MIRType::Symbol: type = JSTYPE_SYMBOL; break; -#ifdef ENABLE_BIGINT case MIRType::BigInt: type = JSTYPE_BIGINT; break; -#endif case MIRType::Null: type = JSTYPE_OBJECT; break; @@ -4225,16 +4209,12 @@ bool MCompare::tryFoldTypeOf(bool* result) { *result = (jsop() == JSOP_STRICTNE || jsop() == JSOP_NE); return true; } - } -#ifdef ENABLE_BIGINT - else if (constant->toString() == TypeName(JSTYPE_BIGINT, names)) { + } else if (constant->toString() == TypeName(JSTYPE_BIGINT, names)) { if (!typeOf->input()->mightBeType(MIRType::BigInt)) { *result = (jsop() == JSOP_STRICTNE || jsop() == JSOP_NE); return true; } - } -#endif - else if (constant->toString() == TypeName(JSTYPE_OBJECT, names)) { + } else if (constant->toString() == TypeName(JSTYPE_OBJECT, names)) { if (!typeOf->input()->mightBeType(MIRType::Object) && !typeOf->input()->mightBeType(MIRType::Null)) { *result = (jsop() == JSOP_STRICTNE || jsop() == JSOP_NE); @@ -5481,10 +5461,8 @@ bool MConstant::appendRoots(MRootList& roots) const { return roots.append(toString()); case MIRType::Symbol: return roots.append(toSymbol()); -#ifdef ENABLE_BIGINT case MIRType::BigInt: return roots.append(toBigInt()); -#endif case MIRType::Object: return roots.append(&toObject()); case MIRType::Undefined: @@ -6222,10 +6200,7 @@ static bool TryAddTypeBarrierForWrite(TempAllocator& alloc, case MIRType::Double: case MIRType::String: case MIRType::Symbol: -#ifdef ENABLE_BIGINT - case MIRType::BigInt: -#endif - { + case MIRType::BigInt: { // The property is a particular primitive type, guard by unboxing the // value before the write. if (!(*pvalue)->mightBeType(propertyType)) { diff --git a/js/src/jit/MIR.h b/js/src/jit/MIR.h index 674f87c60e81a..7d59c5370618e 100644 --- a/js/src/jit/MIR.h +++ b/js/src/jit/MIR.h @@ -890,7 +890,7 @@ static inline bool SimpleArithOperand(MDefinition* op) { return !op->emptyResultTypeSet() && !op->mightBeType(MIRType::Object) && !op->mightBeType(MIRType::String) && !op->mightBeType(MIRType::Symbol) && - IF_BIGINT(!op->mightBeType(MIRType::BigInt), true) && + !op->mightBeType(MIRType::BigInt) && !op->mightBeType(MIRType::MagicOptimizedArguments) && !op->mightBeType(MIRType::MagicHole) && !op->mightBeType(MIRType::MagicIsConstructing); @@ -1390,9 +1390,7 @@ class MConstant : public MNullaryInstruction { double d; JSString* str; JS::Symbol* sym; -#ifdef ENABLE_BIGINT BigInt* bi; -#endif JSObject* obj; uint64_t asBits; }; @@ -1510,12 +1508,10 @@ class MConstant : public MNullaryInstruction { MOZ_ASSERT(type() == MIRType::Symbol); return payload_.sym; } -#ifdef ENABLE_BIGINT BigInt* toBigInt() const { MOZ_ASSERT(type() == MIRType::BigInt); return payload_.bi; } -#endif JSObject& toObject() const { MOZ_ASSERT(type() == MIRType::Object); return *payload_.obj; @@ -3353,8 +3349,7 @@ class MUnbox final : public MUnaryInstruction, public BoxInputsPolicy::Data { MOZ_ASSERT(type == MIRType::Boolean || type == MIRType::Int32 || type == MIRType::Double || type == MIRType::String || - type == MIRType::Symbol || - IF_BIGINT(type == MIRType::BigInt, false) || + type == MIRType::Symbol || type == MIRType::BigInt || type == MIRType::Object); TemporaryTypeSet* resultSet = ins->resultTypeSet(); @@ -3396,11 +3391,9 @@ class MUnbox final : public MUnaryInstruction, public BoxInputsPolicy::Data { case MIRType::Symbol: kind = Bailout_NonSymbolInput; break; -#ifdef ENABLE_BIGINT case MIRType::BigInt: kind = Bailout_NonBigIntInput; break; -#endif case MIRType::Object: kind = Bailout_NonObjectInput; break; @@ -3717,7 +3710,7 @@ class MToDouble : public MToFPInstruction { // ToNumber(symbol) and ToNumber(bigint) throw. if (def->mightBeType(MIRType::Object) || def->mightBeType(MIRType::Symbol) || - IF_BIGINT(def->mightBeType(MIRType::BigInt), false)) { + def->mightBeType(MIRType::BigInt)) { setGuard(); } } @@ -3758,11 +3751,9 @@ class MToDouble : public MToFPInstruction { if (input()->type() == MIRType::Symbol) { return false; } -#ifdef ENABLE_BIGINT if (input()->type() == MIRType::BigInt) { return false; } -#endif return true; } @@ -3787,7 +3778,7 @@ class MToFloat32 : public MToFPInstruction { // ToNumber(symbol) and ToNumber(BigInt) throw. if (def->mightBeType(MIRType::Object) || def->mightBeType(MIRType::Symbol) || - IF_BIGINT(def->mightBeType(MIRType::BigInt), false)) { + def->mightBeType(MIRType::BigInt)) { setGuard(); } } @@ -4079,7 +4070,7 @@ class MToNumberInt32 : public MUnaryInstruction, public ToInt32Policy::Data { // ToNumber(symbol) and ToNumber(BigInt) throw. if (def->mightBeType(MIRType::Object) || def->mightBeType(MIRType::Symbol) || - IF_BIGINT(def->mightBeType(MIRType::BigInt), false)) { + def->mightBeType(MIRType::BigInt)) { setGuard(); } } @@ -4135,7 +4126,7 @@ class MTruncateToInt32 : public MUnaryInstruction, public ToInt32Policy::Data { // ToInt32(symbol) and ToInt32(BigInt) throw. if (def->mightBeType(MIRType::Object) || def->mightBeType(MIRType::Symbol) || - IF_BIGINT(def->mightBeType(MIRType::BigInt), false)) { + def->mightBeType(MIRType::BigInt)) { setGuard(); } } @@ -4178,7 +4169,7 @@ class MToString : public MUnaryInstruction, public ToStringPolicy::Data { // those cases and run side-effects in baseline instead. if (def->mightBeType(MIRType::Object) || def->mightBeType(MIRType::Symbol) || - IF_BIGINT(def->mightBeType(MIRType::BigInt), false)) { + def->mightBeType(MIRType::BigInt)) { setGuard(); } } diff --git a/js/src/jit/MacroAssembler.cpp b/js/src/jit/MacroAssembler.cpp index 2c69d1c6ca9b8..172c09716500d 100644 --- a/js/src/jit/MacroAssembler.cpp +++ b/js/src/jit/MacroAssembler.cpp @@ -65,11 +65,9 @@ static void EmitTypeCheck(MacroAssembler& masm, Assembler::Condition cond, case JSVAL_TYPE_SYMBOL: masm.branchTestSymbol(cond, src, label); break; -#ifdef ENABLE_BIGINT case JSVAL_TYPE_BIGINT: masm.branchTestBigInt(cond, src, label); break; -#endif case JSVAL_TYPE_NULL: masm.branchTestNull(cond, src, label); break; @@ -104,10 +102,7 @@ void MacroAssembler::guardTypeSet(const Source& address, const TypeSet* types, Label matched; TypeSet::Type tests[] = {TypeSet::Int32Type(), TypeSet::UndefinedType(), TypeSet::BooleanType(), TypeSet::StringType(), - TypeSet::SymbolType(), -#ifdef ENABLE_BIGINT - TypeSet::BigIntType(), -#endif + TypeSet::SymbolType(), TypeSet::BigIntType(), TypeSet::NullType(), TypeSet::MagicArgType(), TypeSet::AnyObjectType()}; @@ -3402,11 +3397,9 @@ void MacroAssembler::maybeBranchTestType(MIRType type, MDefinition* maybeDef, case MIRType::Symbol: branchTestSymbol(Equal, tag, label); break; -#ifdef ENABLE_BIGINT case MIRType::BigInt: branchTestBigInt(Equal, tag, label); break; -#endif case MIRType::Object: branchTestObject(Equal, tag, label); break; diff --git a/js/src/jit/MacroAssembler.h b/js/src/jit/MacroAssembler.h index 6949317f05bb9..07eeefccbc5ee 100644 --- a/js/src/jit/MacroAssembler.h +++ b/js/src/jit/MacroAssembler.h @@ -1432,10 +1432,8 @@ class MacroAssembler : public MacroAssemblerSpecific { Label* label) PER_SHARED_ARCH; inline void branchTestSymbol(Condition cond, Register tag, Label* label) PER_SHARED_ARCH; -#ifdef ENABLE_BIGINT inline void branchTestBigInt(Condition cond, Register tag, Label* label) PER_SHARED_ARCH; -#endif inline void branchTestNull(Condition cond, Register tag, Label* label) PER_SHARED_ARCH; inline void branchTestObject(Condition cond, Register tag, @@ -1499,13 +1497,11 @@ class MacroAssembler : public MacroAssemblerSpecific { Label* label) DEFINED_ON(arm, arm64, mips32, mips64, x86_shared); -#ifdef ENABLE_BIGINT inline void branchTestBigInt(Condition cond, const BaseIndex& address, Label* label) PER_SHARED_ARCH; inline void branchTestBigInt(Condition cond, const ValueOperand& value, Label* label) DEFINED_ON(arm, arm64, mips32, mips64, x86_shared); -#endif inline void branchTestNull(Condition cond, const Address& address, Label* label) PER_SHARED_ARCH; @@ -1563,11 +1559,9 @@ class MacroAssembler : public MacroAssemblerSpecific { inline void branchTestStringTruthy(bool truthy, const ValueOperand& value, Label* label) DEFINED_ON(arm, arm64, mips32, mips64, x86_shared); -#ifdef ENABLE_BIGINT inline void branchTestBigIntTruthy(bool truthy, const ValueOperand& value, Label* label) DEFINED_ON(arm, arm64, mips32, mips64, x86_shared); -#endif // Create an unconditional branch to the address given as argument. inline void branchToComputedAddress(const BaseIndex& address) PER_ARCH; @@ -1605,11 +1599,9 @@ class MacroAssembler : public MacroAssemblerSpecific { template inline void branchTestSymbolImpl(Condition cond, const T& t, Label* label) DEFINED_ON(arm, arm64, x86_shared); -#ifdef ENABLE_BIGINT template inline void branchTestBigIntImpl(Condition cond, const T& t, Label* label) DEFINED_ON(arm, arm64, x86_shared); -#endif template inline void branchTestNullImpl(Condition cond, const T& t, Label* label) DEFINED_ON(arm, arm64, x86_shared); diff --git a/js/src/jit/Snapshots.cpp b/js/src/jit/Snapshots.cpp index aa05e4aa0533d..afd2a49c317ba 100644 --- a/js/src/jit/Snapshots.cpp +++ b/js/src/jit/Snapshots.cpp @@ -343,10 +343,8 @@ static const char* ValTypeToString(JSValueType type) { return "string"; case JSVAL_TYPE_SYMBOL: return "symbol"; -#ifdef ENABLE_BIGINT case JSVAL_TYPE_BIGINT: return "BigInt"; -#endif case JSVAL_TYPE_BOOLEAN: return "boolean"; case JSVAL_TYPE_OBJECT: diff --git a/js/src/jit/TypePolicy.cpp b/js/src/jit/TypePolicy.cpp index b4704962d0ab3..f69a0ac0ff865 100644 --- a/js/src/jit/TypePolicy.cpp +++ b/js/src/jit/TypePolicy.cpp @@ -775,9 +775,7 @@ bool ToDoublePolicy::staticAdjustInputs(TempAllocator& alloc, case MIRType::Object: case MIRType::String: case MIRType::Symbol: -#ifdef ENABLE_BIGINT case MIRType::BigInt: -#endif // Objects might be effectful. Symbols and BigInts give TypeError. break; default: @@ -830,9 +828,7 @@ bool ToInt32Policy::staticAdjustInputs(TempAllocator& alloc, case MIRType::Object: case MIRType::String: case MIRType::Symbol: -#ifdef ENABLE_BIGINT case MIRType::BigInt: -#endif // Objects might be effectful. Symbols and BigInts give TypeError. break; default: @@ -850,7 +846,7 @@ bool ToStringPolicy::staticAdjustInputs(TempAllocator& alloc, MIRType type = ins->getOperand(0)->type(); if (type == MIRType::Object || type == MIRType::Symbol || - IF_BIGINT(type == MIRType::BigInt, false)) { + type == MIRType::BigInt) { ins->replaceOperand(0, BoxAt(alloc, ins, ins->getOperand(0))); return true; } @@ -969,9 +965,7 @@ bool StoreUnboxedScalarPolicy::adjustValueInput(TempAllocator& alloc, case MIRType::Object: case MIRType::String: case MIRType::Symbol: -#ifdef ENABLE_BIGINT case MIRType::BigInt: -#endif value = BoxAt(alloc, ins, value); break; default: diff --git a/js/src/jit/VMFunctions.cpp b/js/src/jit/VMFunctions.cpp index d141f553447c6..b1a4510dea96b 100644 --- a/js/src/jit/VMFunctions.cpp +++ b/js/src/jit/VMFunctions.cpp @@ -1263,7 +1263,6 @@ void AssertValidSymbolPtr(JSContext* cx, JS::Symbol* sym) { MOZ_ASSERT(sym->getAllocKind() == gc::AllocKind::SYMBOL); } -#ifdef ENABLE_BIGINT void AssertValidBigIntPtr(JSContext* cx, JS::BigInt* bi) { AutoUnsafeCallWithABI unsafe; // FIXME: check runtime? @@ -1272,7 +1271,6 @@ void AssertValidBigIntPtr(JSContext* cx, JS::BigInt* bi) { MOZ_ASSERT(bi->isTenured()); MOZ_ASSERT(bi->getAllocKind() == gc::AllocKind::BIGINT); } -#endif void AssertValidValue(JSContext* cx, Value* v) { AutoUnsafeCallWithABI unsafe; @@ -1283,11 +1281,9 @@ void AssertValidValue(JSContext* cx, Value* v) { } else if (v->isSymbol()) { AssertValidSymbolPtr(cx, v->toSymbol()); } -#ifdef ENABLE_BIGINT else if (v->isBigInt()) { AssertValidBigIntPtr(cx, v->toBigInt()); } -#endif } bool ObjectIsCallable(JSObject* obj) { @@ -1873,27 +1869,23 @@ const VMFunction GetSparseElementHelperInfo = FunctionInfo(GetSparseElementHelper, "getSparseElementHelper"); -#ifdef ENABLE_BIGINT -template -#endif +static bool DoToNumber(JSContext* cx, HandleValue arg, + MutableHandleValue ret) { + ret.set(arg); + return ToNumber(cx, ret); +} + static bool DoToNumeric(JSContext* cx, HandleValue arg, MutableHandleValue ret) { ret.set(arg); -#ifdef ENABLE_BIGINT - if (allowBigInt) { - return ToNumeric(cx, ret); - } -#endif - return ToNumber(cx, ret); + return ToNumeric(cx, ret); } typedef bool (*ToNumericFn)(JSContext*, HandleValue, MutableHandleValue); const VMFunction ToNumberInfo = - FunctionInfo(DoToNumeric, "ToNumber"); -#ifdef ENABLE_BIGINT + FunctionInfo(DoToNumber, "ToNumber"); const VMFunction ToNumericInfo = - FunctionInfo(DoToNumeric, "ToNumeric"); -#endif + FunctionInfo(DoToNumeric, "ToNumeric"); } // namespace jit } // namespace js diff --git a/js/src/jit/VMFunctions.h b/js/src/jit/VMFunctions.h index 08efa45845899..9c66d023fa795 100644 --- a/js/src/jit/VMFunctions.h +++ b/js/src/jit/VMFunctions.h @@ -1092,9 +1092,7 @@ void AssertValidObjectPtr(JSContext* cx, JSObject* obj); void AssertValidObjectOrNullPtr(JSContext* cx, JSObject* obj); void AssertValidStringPtr(JSContext* cx, JSString* str); void AssertValidSymbolPtr(JSContext* cx, JS::Symbol* sym); -#ifdef ENABLE_BIGINT void AssertValidBigIntPtr(JSContext* cx, JS::BigInt* bi); -#endif void AssertValidValue(JSContext* cx, Value* v); void MarkValueFromJit(JSRuntime* rt, Value* vp); @@ -1207,9 +1205,7 @@ extern const VMFunction AddOrUpdateSparseElementHelperInfo; extern const VMFunction GetSparseElementHelperInfo; extern const VMFunction ToNumberInfo; -#ifdef ENABLE_BIGINT extern const VMFunction ToNumericInfo; -#endif // TailCall VMFunctions extern const VMFunction DoConcatStringObjectInfo; diff --git a/js/src/jit/arm/MacroAssembler-arm-inl.h b/js/src/jit/arm/MacroAssembler-arm-inl.h index 01aa689efaa18..dbafa632b2a0b 100644 --- a/js/src/jit/arm/MacroAssembler-arm-inl.h +++ b/js/src/jit/arm/MacroAssembler-arm-inl.h @@ -1701,7 +1701,6 @@ void MacroAssembler::branchTestSymbolImpl(Condition cond, const T& t, ma_b(label, c); } -#ifdef ENABLE_BIGINT void MacroAssembler::branchTestBigInt(Condition cond, Register tag, Label* label) { branchTestBigIntImpl(cond, tag, label); @@ -1730,7 +1729,6 @@ void MacroAssembler::branchTestBigIntTruthy(bool truthy, Condition c = testBigIntTruthy(truthy, value); ma_b(label, c); } -#endif void MacroAssembler::branchTestNull(Condition cond, Register tag, Label* label) { diff --git a/js/src/jit/arm/MacroAssembler-arm.cpp b/js/src/jit/arm/MacroAssembler-arm.cpp index 3969b7d561be6..f0586208099fe 100644 --- a/js/src/jit/arm/MacroAssembler-arm.cpp +++ b/js/src/jit/arm/MacroAssembler-arm.cpp @@ -2419,12 +2419,10 @@ Assembler::Condition MacroAssemblerARMCompat::testSymbol( return testSymbol(cond, value.typeReg()); } -#ifdef ENABLE_BIGINT Assembler::Condition MacroAssemblerARMCompat::testBigInt( Assembler::Condition cond, const ValueOperand& value) { return testBigInt(cond, value.typeReg()); } -#endif Assembler::Condition MacroAssemblerARMCompat::testObject( Assembler::Condition cond, const ValueOperand& value) { @@ -2489,14 +2487,12 @@ Assembler::Condition MacroAssemblerARMCompat::testSymbol( return cond; } -#ifdef ENABLE_BIGINT Assembler::Condition MacroAssemblerARMCompat::testBigInt( Assembler::Condition cond, Register tag) { MOZ_ASSERT(cond == Equal || cond == NotEqual); ma_cmp(tag, ImmTag(JSVAL_TAG_BIGINT)); return cond; } -#endif Assembler::Condition MacroAssemblerARMCompat::testObject( Assembler::Condition cond, Register tag) { @@ -2594,7 +2590,6 @@ Assembler::Condition MacroAssemblerARMCompat::testSymbol( return testSymbol(cond, tag); } -#ifdef ENABLE_BIGINT Assembler::Condition MacroAssemblerARMCompat::testBigInt( Condition cond, const Address& address) { MOZ_ASSERT(cond == Equal || cond == NotEqual); @@ -2602,7 +2597,6 @@ Assembler::Condition MacroAssemblerARMCompat::testBigInt( Register tag = extractTag(address, scratch); return testBigInt(cond, tag); } -#endif Assembler::Condition MacroAssemblerARMCompat::testObject( Condition cond, const Address& address) { @@ -2680,7 +2674,6 @@ Assembler::Condition MacroAssemblerARMCompat::testSymbol(Condition cond, return cond; } -#ifdef ENABLE_BIGINT Assembler::Condition MacroAssemblerARMCompat::testBigInt(Condition cond, const BaseIndex& src) { MOZ_ASSERT(cond == Equal || cond == NotEqual); @@ -2689,7 +2682,6 @@ Assembler::Condition MacroAssemblerARMCompat::testBigInt(Condition cond, ma_cmp(tag, ImmTag(JSVAL_TAG_BIGINT)); return cond; } -#endif Assembler::Condition MacroAssemblerARMCompat::testInt32(Condition cond, const BaseIndex& src) { @@ -3441,7 +3433,6 @@ Assembler::Condition MacroAssemblerARMCompat::testStringTruthy( return truthy ? Assembler::NotEqual : Assembler::Equal; } -#ifdef ENABLE_BIGINT Assembler::Condition MacroAssemblerARMCompat::testBigIntTruthy( bool truthy, const ValueOperand& value) { Register bi = value.payloadReg(); @@ -3453,7 +3444,6 @@ Assembler::Condition MacroAssemblerARMCompat::testBigIntTruthy( as_cmp(scratch, Imm8(0)); return truthy ? Assembler::NotEqual : Assembler::Equal; } -#endif void MacroAssemblerARMCompat::floor(FloatRegister input, Register output, Label* bail) { diff --git a/js/src/jit/arm/MacroAssembler-arm.h b/js/src/jit/arm/MacroAssembler-arm.h index 56b52ab430106..2143ae1f67e12 100644 --- a/js/src/jit/arm/MacroAssembler-arm.h +++ b/js/src/jit/arm/MacroAssembler-arm.h @@ -766,9 +766,7 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM { Condition testUndefined(Condition cond, const ValueOperand& value); Condition testString(Condition cond, const ValueOperand& value); Condition testSymbol(Condition cond, const ValueOperand& value); -#ifdef ENABLE_BIGINT Condition testBigInt(Condition cond, const ValueOperand& value); -#endif Condition testObject(Condition cond, const ValueOperand& value); Condition testNumber(Condition cond, const ValueOperand& value); Condition testMagic(Condition cond, const ValueOperand& value); @@ -782,9 +780,7 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM { Condition testUndefined(Condition cond, Register tag); Condition testString(Condition cond, Register tag); Condition testSymbol(Condition cond, Register tag); -#ifdef ENABLE_BIGINT Condition testBigInt(Condition cond, Register tag); -#endif Condition testObject(Condition cond, Register tag); Condition testDouble(Condition cond, Register tag); Condition testNumber(Condition cond, Register tag); @@ -800,9 +796,7 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM { Condition testUndefined(Condition cond, const Address& address); Condition testString(Condition cond, const Address& address); Condition testSymbol(Condition cond, const Address& address); -#ifdef ENABLE_BIGINT Condition testBigInt(Condition cond, const Address& address); -#endif Condition testObject(Condition cond, const Address& address); Condition testNumber(Condition cond, const Address& address); @@ -811,9 +805,7 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM { Condition testBoolean(Condition cond, const BaseIndex& src); Condition testString(Condition cond, const BaseIndex& src); Condition testSymbol(Condition cond, const BaseIndex& src); -#ifdef ENABLE_BIGINT Condition testBigInt(Condition cond, const BaseIndex& src); -#endif Condition testInt32(Condition cond, const BaseIndex& src); Condition testObject(Condition cond, const BaseIndex& src); Condition testDouble(Condition cond, const BaseIndex& src); @@ -849,14 +841,12 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM { void unboxSymbol(const Address& src, Register dest) { unboxNonDouble(src, dest, JSVAL_TYPE_SYMBOL); } -#ifdef ENABLE_BIGINT void unboxBigInt(const ValueOperand& src, Register dest) { unboxNonDouble(src, dest, JSVAL_TYPE_BIGINT); } void unboxBigInt(const Address& src, Register dest) { unboxNonDouble(src, dest, JSVAL_TYPE_BIGINT); } -#endif void unboxObject(const ValueOperand& src, Register dest) { unboxNonDouble(src, dest, JSVAL_TYPE_OBJECT); } @@ -925,9 +915,7 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM { Condition testBooleanTruthy(bool truthy, const ValueOperand& operand); Condition testDoubleTruthy(bool truthy, FloatRegister reg); Condition testStringTruthy(bool truthy, const ValueOperand& value); -#ifdef ENABLE_BIGINT Condition testBigIntTruthy(bool truthy, const ValueOperand& value); -#endif void boolValueToFloat32(const ValueOperand& operand, FloatRegister dest); void int32ValueToFloat32(const ValueOperand& operand, FloatRegister dest); diff --git a/js/src/jit/arm64/CodeGenerator-arm64.cpp b/js/src/jit/arm64/CodeGenerator-arm64.cpp index 0ca3aa45be6bc..bf152db7cb205 100644 --- a/js/src/jit/arm64/CodeGenerator-arm64.cpp +++ b/js/src/jit/arm64/CodeGenerator-arm64.cpp @@ -1252,11 +1252,9 @@ void CodeGenerator::visitUnbox(LUnbox* unbox) { case MIRType::Symbol: cond = masm.testSymbol(Assembler::NotEqual, value); break; -#ifdef ENABLE_BIGINT case MIRType::BigInt: cond = masm.testBigInt(Assembler::NotEqual, value); break; -#endif default: MOZ_CRASH("Given MIRType cannot be unboxed."); } @@ -1294,11 +1292,9 @@ void CodeGenerator::visitUnbox(LUnbox* unbox) { case MIRType::Symbol: masm.unboxSymbol(input, result); break; -#ifdef ENABLE_BIGINT case MIRType::BigInt: masm.unboxBigInt(input, result); break; -#endif default: MOZ_CRASH("Given MIRType cannot be unboxed."); } diff --git a/js/src/jit/arm64/MacroAssembler-arm64-inl.h b/js/src/jit/arm64/MacroAssembler-arm64-inl.h index 61cde27b4c699..462c2ec8e0a4c 100644 --- a/js/src/jit/arm64/MacroAssembler-arm64-inl.h +++ b/js/src/jit/arm64/MacroAssembler-arm64-inl.h @@ -1410,7 +1410,6 @@ void MacroAssembler::branchTestSymbolImpl(Condition cond, const T& t, B(label, c); } -#ifdef ENABLE_BIGINT void MacroAssembler::branchTestBigInt(Condition cond, Register tag, Label* label) { branchTestBigIntImpl(cond, tag, label); @@ -1439,7 +1438,6 @@ void MacroAssembler::branchTestBigIntTruthy(bool truthy, Condition c = testBigIntTruthy(truthy, value); B(label, c); } -#endif void MacroAssembler::branchTestNull(Condition cond, Register tag, Label* label) { diff --git a/js/src/jit/arm64/MacroAssembler-arm64.h b/js/src/jit/arm64/MacroAssembler-arm64.h index 5cfa4d40b9cc6..0e812b0b6843d 100644 --- a/js/src/jit/arm64/MacroAssembler-arm64.h +++ b/js/src/jit/arm64/MacroAssembler-arm64.h @@ -1394,14 +1394,12 @@ class MacroAssemblerCompat : public vixl::MacroAssembler { void unboxSymbol(const Address& src, Register dest) { unboxNonDouble(src, dest, JSVAL_TYPE_SYMBOL); } -#ifdef ENABLE_BIGINT void unboxBigInt(const ValueOperand& operand, Register dest) { unboxNonDouble(operand, dest, JSVAL_TYPE_BIGINT); } void unboxBigInt(const Address& src, Register dest) { unboxNonDouble(src, dest, JSVAL_TYPE_BIGINT); } -#endif // These two functions use the low 32-bits of the full value register. void boolValueToDouble(const ValueOperand& operand, FloatRegister dest) { convertInt32ToDouble(operand.valueReg(), dest); @@ -1487,13 +1485,11 @@ class MacroAssemblerCompat : public vixl::MacroAssembler { cmpTag(tag, ImmTag(JSVAL_TAG_SYMBOL)); return cond; } -#ifdef ENABLE_BIGINT Condition testBigInt(Condition cond, Register tag) { MOZ_ASSERT(cond == Equal || cond == NotEqual); cmpTag(tag, ImmTag(JSVAL_TAG_BIGINT)); return cond; } -#endif Condition testObject(Condition cond, Register tag) { MOZ_ASSERT(cond == Equal || cond == NotEqual); cmpTag(tag, ImmTag(JSVAL_TAG_OBJECT)); @@ -1584,7 +1580,6 @@ class MacroAssemblerCompat : public vixl::MacroAssembler { splitSignExtTag(value, scratch); return testSymbol(cond, scratch); } -#ifdef ENABLE_BIGINT Condition testBigInt(Condition cond, const ValueOperand& value) { vixl::UseScratchRegisterScope temps(this); const Register scratch = temps.AcquireX().asUnsized(); @@ -1592,7 +1587,6 @@ class MacroAssemblerCompat : public vixl::MacroAssembler { splitSignExtTag(value, scratch); return testBigInt(cond, scratch); } -#endif Condition testObject(Condition cond, const ValueOperand& value) { vixl::UseScratchRegisterScope temps(this); const Register scratch = temps.AcquireX().asUnsized(); @@ -1689,7 +1683,6 @@ class MacroAssemblerCompat : public vixl::MacroAssembler { splitSignExtTag(address, scratch); return testSymbol(cond, scratch); } -#ifdef ENABLE_BIGINT Condition testBigInt(Condition cond, const Address& address) { vixl::UseScratchRegisterScope temps(this); const Register scratch = temps.AcquireX().asUnsized(); @@ -1697,7 +1690,6 @@ class MacroAssemblerCompat : public vixl::MacroAssembler { splitSignExtTag(address, scratch); return testBigInt(cond, scratch); } -#endif Condition testObject(Condition cond, const Address& address) { vixl::UseScratchRegisterScope temps(this); const Register scratch = temps.AcquireX().asUnsized(); @@ -1754,7 +1746,6 @@ class MacroAssemblerCompat : public vixl::MacroAssembler { splitSignExtTag(src, scratch); return testSymbol(cond, scratch); } -#ifdef ENABLE_BIGINT Condition testBigInt(Condition cond, const BaseIndex& src) { vixl::UseScratchRegisterScope temps(this); const Register scratch = temps.AcquireX().asUnsized(); @@ -1776,7 +1767,6 @@ class MacroAssemblerCompat : public vixl::MacroAssembler { Cmp(scratch64, Operand(0)); return truthy ? Condition::NonZero : Condition::Zero; } -#endif Condition testInt32(Condition cond, const BaseIndex& src) { vixl::UseScratchRegisterScope temps(this); const Register scratch = temps.AcquireX().asUnsized(); diff --git a/js/src/jit/mips32/MacroAssembler-mips32-inl.h b/js/src/jit/mips32/MacroAssembler-mips32-inl.h index ab9a94d828bb6..abc6b91872923 100644 --- a/js/src/jit/mips32/MacroAssembler-mips32-inl.h +++ b/js/src/jit/mips32/MacroAssembler-mips32-inl.h @@ -814,7 +814,6 @@ void MacroAssembler::branchTestSymbol(Condition cond, const ValueOperand& value, branchTestSymbol(cond, value.typeReg(), label); } -#ifdef ENABLE_BIGINT void MacroAssembler::branchTestBigInt(Condition cond, const ValueOperand& value, Label* label) { branchTestBigInt(cond, value.typeReg(), label); @@ -827,7 +826,6 @@ void MacroAssembler::branchTestBigIntTruthy(bool b, const ValueOperand& value, ma_lw(scratch2, Address(bi, BigInt::offsetOfLengthSignAndReservedBits())); ma_b(scratch2, Imm32(0), label, b ? NotEqual : Equal); } -#endif void MacroAssembler::branchTestNull(Condition cond, const ValueOperand& value, Label* label) { diff --git a/js/src/jit/mips64/CodeGenerator-mips64.cpp b/js/src/jit/mips64/CodeGenerator-mips64.cpp index a5ad7b8a3b241..2f102a37b1949 100644 --- a/js/src/jit/mips64/CodeGenerator-mips64.cpp +++ b/js/src/jit/mips64/CodeGenerator-mips64.cpp @@ -78,10 +78,8 @@ void CodeGenerator::visitUnbox(LUnbox* unbox) { case MIRType::Symbol: masm.unboxSymbol(inputReg, result); break; -#ifdef ENABLE_BIGINT case MIRType::BigInt: masm.unboxBigInt(inputReg, result); -#endif default: MOZ_CRASH("Given MIRType cannot be unboxed."); } @@ -105,10 +103,8 @@ void CodeGenerator::visitUnbox(LUnbox* unbox) { case MIRType::Symbol: masm.unboxSymbol(inputAddr, result); break; -#ifdef ENABLE_BIGINT case MIRType::BigInt: masm.unboxBigInt(inputAddr, result); -#endif default: MOZ_CRASH("Given MIRType cannot be unboxed."); } diff --git a/js/src/jit/mips64/MacroAssembler-mips64-inl.h b/js/src/jit/mips64/MacroAssembler-mips64-inl.h index 30441d07e88c2..4b77595365abe 100644 --- a/js/src/jit/mips64/MacroAssembler-mips64-inl.h +++ b/js/src/jit/mips64/MacroAssembler-mips64-inl.h @@ -546,7 +546,6 @@ void MacroAssembler::branchTestSymbol(Condition cond, const ValueOperand& value, branchTestSymbol(cond, scratch2, label); } -#ifdef ENABLE_BIGINT void MacroAssembler::branchTestBigInt(Condition cond, const ValueOperand& value, Label* label) { SecondScratchRegisterScope scratch2(*this); @@ -562,7 +561,6 @@ void MacroAssembler::branchTestBigIntTruthy(bool b, const ValueOperand& value, scratch2); ma_b(scratch2, ImmWord(0), label, b ? NotEqual : Equal); } -#endif void MacroAssembler::branchTestNull(Condition cond, const ValueOperand& value, Label* label) { diff --git a/js/src/jit/mips64/MacroAssembler-mips64.cpp b/js/src/jit/mips64/MacroAssembler-mips64.cpp index a78d196f0cdd1..3236573e17ad5 100644 --- a/js/src/jit/mips64/MacroAssembler-mips64.cpp +++ b/js/src/jit/mips64/MacroAssembler-mips64.cpp @@ -1266,7 +1266,6 @@ void MacroAssemblerMIPS64Compat::unboxSymbol(const Address& src, unboxNonDouble(src, dest, JSVAL_TYPE_SYMBOL); } -#ifdef ENABLE_BIGINT void MacroAssemblerMIPS64Compat::unboxBigInt(const ValueOperand& operand, Register dest) { unboxNonDouble(operand, dest, JSVAL_TYPE_BIGINT); @@ -1280,7 +1279,6 @@ void MacroAssemblerMIPS64Compat::unboxBigInt(const Address& src, Register dest) { unboxNonDouble(src, dest, JSVAL_TYPE_BIGINT); } -#endif void MacroAssemblerMIPS64Compat::unboxObject(const ValueOperand& src, Register dest) { diff --git a/js/src/jit/mips64/MacroAssembler-mips64.h b/js/src/jit/mips64/MacroAssembler-mips64.h index 97efb8477e60d..a4108883d1955 100644 --- a/js/src/jit/mips64/MacroAssembler-mips64.h +++ b/js/src/jit/mips64/MacroAssembler-mips64.h @@ -398,11 +398,9 @@ class MacroAssemblerMIPS64Compat : public MacroAssemblerMIPS64 { void unboxSymbol(const ValueOperand& src, Register dest); void unboxSymbol(Register src, Register dest); void unboxSymbol(const Address& src, Register dest); -#ifdef ENABLE_BIGINT void unboxBigInt(const ValueOperand& operand, Register dest); void unboxBigInt(Register src, Register dest); void unboxBigInt(const Address& src, Register dest); -#endif void unboxObject(const ValueOperand& src, Register dest); void unboxObject(Register src, Register dest); void unboxObject(const Address& src, Register dest); diff --git a/js/src/jit/none/MacroAssembler-none.h b/js/src/jit/none/MacroAssembler-none.h index 3713b14c2fed8..1bee3a789c0dd 100644 --- a/js/src/jit/none/MacroAssembler-none.h +++ b/js/src/jit/none/MacroAssembler-none.h @@ -463,12 +463,10 @@ class MacroAssemblerNone : public Assembler { void unboxSymbol(T, Register) { MOZ_CRASH(); } -#ifdef ENABLE_BIGINT template void unboxBigInt(T, Register) { MOZ_CRASH(); } -#endif template void unboxObject(T, Register) { MOZ_CRASH(); @@ -528,9 +526,7 @@ class MacroAssemblerNone : public Assembler { void loadConstantFloat32(float, FloatRegister) { MOZ_CRASH(); } Condition testInt32Truthy(bool, ValueOperand) { MOZ_CRASH(); } Condition testStringTruthy(bool, ValueOperand) { MOZ_CRASH(); } -#ifdef ENABLE_BIGINT Condition testBigIntTruthy(bool, ValueOperand) { MOZ_CRASH(); } -#endif template void loadUnboxedValue(T, MIRType, AnyRegister) { diff --git a/js/src/jit/shared/CodeGenerator-shared.cpp b/js/src/jit/shared/CodeGenerator-shared.cpp index 54941a96d832b..43b9877537128 100644 --- a/js/src/jit/shared/CodeGenerator-shared.cpp +++ b/js/src/jit/shared/CodeGenerator-shared.cpp @@ -434,9 +434,7 @@ void CodeGeneratorShared::encodeAllocation(LSnapshot* snapshot, case MIRType::Int32: case MIRType::String: case MIRType::Symbol: -#ifdef ENABLE_BIGINT case MIRType::BigInt: -#endif case MIRType::Object: case MIRType::ObjectOrNull: case MIRType::Boolean: diff --git a/js/src/jit/shared/Lowering-shared-inl.h b/js/src/jit/shared/Lowering-shared-inl.h index 4e33519dca029..ca862eb884637 100644 --- a/js/src/jit/shared/Lowering-shared-inl.h +++ b/js/src/jit/shared/Lowering-shared-inl.h @@ -430,10 +430,7 @@ void LIRGeneratorShared::redefine(MDefinition* def, MDefinition* as) { case MIRType::ObjectOrNull: case MIRType::String: case MIRType::Symbol: -# ifdef ENABLE_BIGINT - case MIRType::BigInt: -# endif - { + case MIRType::BigInt: { LAssertResultT* check = new (alloc()) LAssertResultT(useRegister(def)); add(check, def->toInstruction()); diff --git a/js/src/jit/x64/CodeGenerator-x64.cpp b/js/src/jit/x64/CodeGenerator-x64.cpp index 313aee5437f21..a42cda54c36da 100644 --- a/js/src/jit/x64/CodeGenerator-x64.cpp +++ b/js/src/jit/x64/CodeGenerator-x64.cpp @@ -85,11 +85,9 @@ void CodeGenerator::visitUnbox(LUnbox* unbox) { case MIRType::Symbol: cond = masm.testSymbol(Assembler::NotEqual, value); break; -#ifdef ENABLE_BIGINT case MIRType::BigInt: cond = masm.testBigInt(Assembler::NotEqual, value); break; -#endif default: MOZ_CRASH("Given MIRType cannot be unboxed."); } @@ -124,11 +122,9 @@ void CodeGenerator::visitUnbox(LUnbox* unbox) { case MIRType::Symbol: masm.unboxSymbol(input, result); break; -#ifdef ENABLE_BIGINT case MIRType::BigInt: masm.unboxBigInt(input, result); break; -#endif default: MOZ_CRASH("Given MIRType cannot be unboxed."); } diff --git a/js/src/jit/x64/MacroAssembler-x64.h b/js/src/jit/x64/MacroAssembler-x64.h index e5ea85cb7cde9..7ee00df4b2a8e 100644 --- a/js/src/jit/x64/MacroAssembler-x64.h +++ b/js/src/jit/x64/MacroAssembler-x64.h @@ -255,13 +255,11 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared { cmp32(tag, ImmTag(JSVAL_TAG_SYMBOL)); return cond; } -#ifdef ENABLE_BIGINT Condition testBigInt(Condition cond, Register tag) { MOZ_ASSERT(cond == Equal || cond == NotEqual); cmp32(tag, ImmTag(JSVAL_TAG_BIGINT)); return cond; } -#endif Condition testObject(Condition cond, Register tag) { MOZ_ASSERT(cond == Equal || cond == NotEqual); cmp32(tag, ImmTag(JSVAL_TAG_OBJECT)); @@ -337,13 +335,11 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared { splitTag(src, scratch); return testSymbol(cond, scratch); } -#ifdef ENABLE_BIGINT Condition testBigInt(Condition cond, const ValueOperand& src) { ScratchRegisterScope scratch(asMasm()); splitTag(src, scratch); return testBigInt(cond, scratch); } -#endif Condition testObject(Condition cond, const ValueOperand& src) { ScratchRegisterScope scratch(asMasm()); splitTag(src, scratch); @@ -397,13 +393,11 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared { splitTag(src, scratch); return testSymbol(cond, scratch); } -#ifdef ENABLE_BIGINT Condition testBigInt(Condition cond, const Address& src) { ScratchRegisterScope scratch(asMasm()); splitTag(src, scratch); return testBigInt(cond, scratch); } -#endif Condition testObject(Condition cond, const Address& src) { ScratchRegisterScope scratch(asMasm()); splitTag(src, scratch); @@ -450,13 +444,11 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared { splitTag(src, scratch); return testSymbol(cond, scratch); } -#ifdef ENABLE_BIGINT Condition testBigInt(Condition cond, const BaseIndex& src) { ScratchRegisterScope scratch(asMasm()); splitTag(src, scratch); return testBigInt(cond, scratch); } -#endif Condition testInt32(Condition cond, const BaseIndex& src) { ScratchRegisterScope scratch(asMasm()); splitTag(src, scratch); @@ -828,14 +820,12 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared { unboxNonDouble(src, dest, JSVAL_TYPE_SYMBOL); } -#ifdef ENABLE_BIGINT void unboxBigInt(const ValueOperand& src, Register dest) { unboxNonDouble(src, dest, JSVAL_TYPE_BIGINT); } void unboxBigInt(const Operand& src, Register dest) { unboxNonDouble(src, dest, JSVAL_TYPE_BIGINT); } -#endif void unboxObject(const ValueOperand& src, Register dest) { unboxNonDouble(src, dest, JSVAL_TYPE_OBJECT); @@ -957,7 +947,6 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared { cmp32(Operand(scratch, JSString::offsetOfLength()), Imm32(0)); return truthy ? Assembler::NotEqual : Assembler::Equal; } -#ifdef ENABLE_BIGINT Condition testBigIntTruthy(bool truthy, const ValueOperand& value) { ScratchRegisterScope scratch(asMasm()); unboxBigInt(value, scratch); @@ -965,7 +954,6 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared { ImmWord(0)); return truthy ? Assembler::NotEqual : Assembler::Equal; } -#endif template inline void loadInt32OrDouble(const T& src, FloatRegister dest); diff --git a/js/src/jit/x86-shared/MacroAssembler-x86-shared-inl.h b/js/src/jit/x86-shared/MacroAssembler-x86-shared-inl.h index 63dc1163469b9..51df81f1f7879 100644 --- a/js/src/jit/x86-shared/MacroAssembler-x86-shared-inl.h +++ b/js/src/jit/x86-shared/MacroAssembler-x86-shared-inl.h @@ -801,7 +801,6 @@ void MacroAssembler::branchTestSymbolImpl(Condition cond, const T& t, j(cond, label); } -#ifdef ENABLE_BIGINT void MacroAssembler::branchTestBigInt(Condition cond, Register tag, Label* label) { branchTestBigIntImpl(cond, tag, label); @@ -830,7 +829,6 @@ void MacroAssembler::branchTestBigIntTruthy(bool truthy, Condition cond = testBigIntTruthy(truthy, value); j(cond, label); } -#endif void MacroAssembler::branchTestNull(Condition cond, Register tag, Label* label) { diff --git a/js/src/jit/x86/MacroAssembler-x86.h b/js/src/jit/x86/MacroAssembler-x86.h index 3aa9309e4e665..79668043c47fb 100644 --- a/js/src/jit/x86/MacroAssembler-x86.h +++ b/js/src/jit/x86/MacroAssembler-x86.h @@ -309,13 +309,11 @@ class MacroAssemblerX86 : public MacroAssemblerX86Shared { cmp32(tag, ImmTag(JSVAL_TAG_SYMBOL)); return cond; } -#ifdef ENABLE_BIGINT Condition testBigInt(Condition cond, Register tag) { MOZ_ASSERT(cond == Equal || cond == NotEqual); cmp32(tag, ImmTag(JSVAL_TAG_BIGINT)); return cond; } -#endif Condition testObject(Condition cond, Register tag) { MOZ_ASSERT(cond == Equal || cond == NotEqual); cmp32(tag, ImmTag(JSVAL_TAG_OBJECT)); @@ -431,11 +429,9 @@ class MacroAssemblerX86 : public MacroAssemblerX86Shared { Condition testSymbol(Condition cond, const ValueOperand& value) { return testSymbol(cond, value.typeReg()); } -#ifdef ENABLE_BIGINT Condition testBigInt(Condition cond, const ValueOperand& value) { return testBigInt(cond, value.typeReg()); } -#endif Condition testObject(Condition cond, const ValueOperand& value) { return testObject(cond, value.typeReg()); } @@ -485,13 +481,11 @@ class MacroAssemblerX86 : public MacroAssemblerX86Shared { cmp32(tagOf(address), ImmTag(JSVAL_TAG_SYMBOL)); return cond; } -#ifdef ENABLE_BIGINT Condition testBigInt(Condition cond, const BaseIndex& address) { MOZ_ASSERT(cond == Equal || cond == NotEqual); cmp32(tagOf(address), ImmTag(JSVAL_TAG_BIGINT)); return cond; } -#endif Condition testInt32(Condition cond, const BaseIndex& address) { MOZ_ASSERT(cond == Equal || cond == NotEqual); cmp32(tagOf(address), ImmTag(JSVAL_TAG_INT32)); @@ -766,14 +760,12 @@ class MacroAssemblerX86 : public MacroAssemblerX86Shared { void unboxSymbol(const Address& src, Register dest) { unboxNonDouble(src, dest, JSVAL_TYPE_SYMBOL); } -#ifdef ENABLE_BIGINT void unboxBigInt(const ValueOperand& src, Register dest) { unboxNonDouble(src, dest, JSVAL_TYPE_BIGINT); } void unboxBigInt(const Address& src, Register dest) { unboxNonDouble(src, dest, JSVAL_TYPE_BIGINT); } -#endif void unboxObject(const ValueOperand& src, Register dest) { unboxNonDouble(src, dest, JSVAL_TYPE_OBJECT); } @@ -890,14 +882,12 @@ class MacroAssemblerX86 : public MacroAssemblerX86Shared { cmp32(Operand(string, JSString::offsetOfLength()), Imm32(0)); return truthy ? Assembler::NotEqual : Assembler::Equal; } -#ifdef ENABLE_BIGINT Condition testBigIntTruthy(bool truthy, const ValueOperand& value) { Register bi = value.payloadReg(); cmpPtr(Operand(bi, BigInt::offsetOfLengthSignAndReservedBits()), ImmWord(0)); return truthy ? Assembler::NotEqual : Assembler::Equal; } -#endif template inline void loadInt32OrDouble(const T& src, FloatRegister dest); diff --git a/js/src/jsapi-tests/testJitRValueAlloc.cpp b/js/src/jsapi-tests/testJitRValueAlloc.cpp index eb3ccba9e39b0..69b3063dfe11e 100644 --- a/js/src/jsapi-tests/testJitRValueAlloc.cpp +++ b/js/src/jsapi-tests/testJitRValueAlloc.cpp @@ -68,7 +68,7 @@ BEGIN_TEST(testJitRValueAlloc_TypedReg) { /* _(JSVAL_TYPE_MAGIC) */ \ _(JSVAL_TYPE_STRING) \ _(JSVAL_TYPE_SYMBOL) \ - IF_BIGINT(_(JSVAL_TYPE_BIGINT),) \ + _(JSVAL_TYPE_BIGINT) \ /* _(JSVAL_TYPE_NULL) */ \ _(JSVAL_TYPE_OBJECT) @@ -96,7 +96,7 @@ BEGIN_TEST(testJitRValueAlloc_TypedStack) { /* _(JSVAL_TYPE_MAGIC) */ \ _(JSVAL_TYPE_STRING) \ _(JSVAL_TYPE_SYMBOL) \ - IF_BIGINT(_(JSVAL_TYPE_BIGINT),) \ + _(JSVAL_TYPE_BIGINT) \ /* _(JSVAL_TYPE_NULL) */ \ _(JSVAL_TYPE_OBJECT) diff --git a/js/src/jsapi-tests/tests.cpp b/js/src/jsapi-tests/tests.cpp index 70a691f307d55..96d1cd991c697 100644 --- a/js/src/jsapi-tests/tests.cpp +++ b/js/src/jsapi-tests/tests.cpp @@ -80,9 +80,7 @@ JSObject* JSAPITest::createGlobal(JSPrincipals* principals) { JS::RootedObject newGlobal(cx); JS::RealmOptions options; options.creationOptions().setStreamsEnabled(true); -#ifdef ENABLE_BIGINT options.creationOptions().setBigIntEnabled(true); -#endif newGlobal = JS_NewGlobalObject(cx, getGlobalClass(), principals, JS::FireOnNewGlobalHook, options); if (!newGlobal) { diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp index f5a9df123679b..dbf35192f6b54 100644 --- a/js/src/jsapi.cpp +++ b/js/src/jsapi.cpp @@ -3424,9 +3424,7 @@ void JS::TransitiveCompileOptions::copyPODTransitiveOptions( hasIntroductionInfo = rhs.hasIntroductionInfo; isProbablySystemCode = rhs.isProbablySystemCode; hideScriptFromDebugger = rhs.hideScriptFromDebugger; -#ifdef ENABLE_BIGINT bigIntEnabledOption = rhs.bigIntEnabledOption; -#endif }; void JS::ReadOnlyCompileOptions::copyPODOptions( @@ -3553,9 +3551,7 @@ JS::CompileOptions::CompileOptions(JSContext* cx) } throwOnAsmJSValidationFailureOption = cx->options().throwOnAsmJSValidationFailure(); -#ifdef ENABLE_BIGINT bigIntEnabledOption = cx->realm()->creationOptions().getBigIntEnabled(); -#endif } CompileOptions& CompileOptions::setIntroductionInfoToCaller( diff --git a/js/src/jsapi.h b/js/src/jsapi.h index f0afffd5e4269..773b1963e0fc0 100644 --- a/js/src/jsapi.h +++ b/js/src/jsapi.h @@ -963,9 +963,7 @@ class JS_PUBLIC_API RealmCreationOptions { cloneSingletons_(false), sharedMemoryAndAtomics_(false), streams_(false), -#ifdef ENABLE_BIGINT bigint_(false), -#endif secureContext_(false), clampAndJitterTime_(true) { } @@ -1042,13 +1040,11 @@ class JS_PUBLIC_API RealmCreationOptions { return *this; } -#ifdef ENABLE_BIGINT bool getBigIntEnabled() const { return bigint_; } RealmCreationOptions& setBigIntEnabled(bool flag) { bigint_ = flag; return *this; } -#endif // This flag doesn't affect JS engine behavior. It is used by Gecko to // mark whether content windows and workers are "Secure Context"s. See @@ -1079,9 +1075,7 @@ class JS_PUBLIC_API RealmCreationOptions { bool cloneSingletons_; bool sharedMemoryAndAtomics_; bool streams_; -#ifdef ENABLE_BIGINT bool bigint_; -#endif bool secureContext_; bool clampAndJitterTime_; }; diff --git a/js/src/jsexn.cpp b/js/src/jsexn.cpp index e8b7fb9cce5e3..89d96bb41a3e6 100644 --- a/js/src/jsexn.cpp +++ b/js/src/jsexn.cpp @@ -1068,15 +1068,11 @@ const char* js::ValueToSourceForError(JSContext* cx, HandleValue val, if (!sb.append("the string ")) { return "<>"; } - } -#ifdef ENABLE_BIGINT - else if (val.isBigInt()) { + } else if (val.isBigInt()) { if (!sb.append("the BigInt ")) { return "<>"; } - } -#endif - else { + } else { MOZ_ASSERT(val.isBoolean() || val.isSymbol()); bytes = StringToNewUTF8CharsZ(cx, *str); return bytes.get(); diff --git a/js/src/jsfriendapi.cpp b/js/src/jsfriendapi.cpp index 90efb60a808a8..d5e201b3bdcd0 100644 --- a/js/src/jsfriendapi.cpp +++ b/js/src/jsfriendapi.cpp @@ -13,9 +13,7 @@ #include -#ifdef ENABLE_BIGINT -# include "builtin/BigInt.h" -#endif +#include "builtin/BigInt.h" #include "builtin/Promise.h" #include "builtin/TestingFunctions.h" #include "gc/GCInternals.h" @@ -306,10 +304,8 @@ JS_FRIEND_API bool js::GetBuiltinClass(JSContext* cx, HandleObject obj, *cls = ESClass::Arguments; } else if (obj->is()) { *cls = ESClass::Error; -#ifdef ENABLE_BIGINT } else if (obj->is()) { *cls = ESClass::BigInt; -#endif } else { *cls = ESClass::Other; } diff --git a/js/src/jsnum.cpp b/js/src/jsnum.cpp index 6d761f4f76ef5..d7c30b10a28aa 100644 --- a/js/src/jsnum.cpp +++ b/js/src/jsnum.cpp @@ -35,9 +35,7 @@ #include "js/PropertySpec.h" #include "util/DoubleToString.h" #include "util/StringBuffer.h" -#ifdef ENABLE_BIGINT -# include "vm/BigIntType.h" -#endif +#include "vm/BigIntType.h" #include "vm/GlobalObject.h" #include "vm/JSAtom.h" #include "vm/JSContext.h" @@ -545,11 +543,9 @@ static bool Number(JSContext* cx, unsigned argc, Value* vp) { if (!ToNumeric(cx, args[0])) { return false; } -#ifdef ENABLE_BIGINT if (args[0].isBigInt()) { args[0].setNumber(BigInt::numberValue(args[0].toBigInt())); } -#endif MOZ_ASSERT(args[0].isNumber()); } @@ -1688,14 +1684,12 @@ JS_PUBLIC_API bool js::ToNumberSlow(JSContext* cx, HandleValue v_, return true; } - MOZ_ASSERT(v.isSymbol() || IF_BIGINT(v.isBigInt(), false)); + MOZ_ASSERT(v.isSymbol() || v.isBigInt()); if (!cx->helperThread()) { unsigned errnum = JSMSG_SYMBOL_TO_NUMBER; -#ifdef ENABLE_BIGINT if (v.isBigInt()) { errnum = JSMSG_BIGINT_TO_NUMBER; } -#endif JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, errnum); } return false; @@ -1704,9 +1698,7 @@ JS_PUBLIC_API bool js::ToNumberSlow(JSContext* cx, HandleValue v_, // BigInt proposal section 3.1.6 bool js::ToNumericSlow(JSContext* cx, MutableHandleValue vp) { MOZ_ASSERT(!vp.isNumber()); -#ifdef ENABLE_BIGINT MOZ_ASSERT(!vp.isBigInt()); -#endif // Step 1. if (!vp.isPrimitive()) { @@ -1719,11 +1711,9 @@ bool js::ToNumericSlow(JSContext* cx, MutableHandleValue vp) { } // Step 2. -#ifdef ENABLE_BIGINT if (vp.isBigInt()) { return true; } -#endif // Step 3. return ToNumber(cx, vp); @@ -1852,11 +1842,9 @@ bool js::ToInt32OrBigIntSlow(JSContext* cx, MutableHandleValue vp) { return false; } -#ifdef ENABLE_BIGINT if (vp.isBigInt()) { return true; } -#endif vp.setInt32(ToInt32(vp.toNumber())); return true; diff --git a/js/src/jsnum.h b/js/src/jsnum.h index 593dae5187290..2e5f3bc435987 100644 --- a/js/src/jsnum.h +++ b/js/src/jsnum.h @@ -205,11 +205,9 @@ MOZ_ALWAYS_INLINE MOZ_MUST_USE bool ToNumeric(JSContext* cx, if (vp.isNumber()) { return true; } -#ifdef ENABLE_BIGINT if (vp.isBigInt()) { return true; } -#endif return ToNumericSlow(cx, vp); } diff --git a/js/src/jspubtd.h b/js/src/jspubtd.h index 7df06d090e0a7..53ec6433fd25e 100644 --- a/js/src/jspubtd.h +++ b/js/src/jspubtd.h @@ -46,9 +46,7 @@ enum JSType { JSTYPE_BOOLEAN, /* boolean */ JSTYPE_NULL, /* null */ JSTYPE_SYMBOL, /* symbol */ -#ifdef ENABLE_BIGINT JSTYPE_BIGINT, /* BigInt */ -#endif JSTYPE_LIMIT }; diff --git a/js/src/moz.build b/js/src/moz.build index 265275d1e36b0..1ab4a0380fa49 100755 --- a/js/src/moz.build +++ b/js/src/moz.build @@ -191,6 +191,7 @@ EXPORTS.js += [ UNIFIED_SOURCES += [ 'builtin/Array.cpp', 'builtin/AtomicsObject.cpp', + 'builtin/BigInt.cpp', 'builtin/Boolean.cpp', 'builtin/DataViewObject.cpp', 'builtin/Eval.cpp', @@ -258,6 +259,7 @@ UNIFIED_SOURCES += [ 'vm/ArrayBufferViewObject.cpp', 'vm/AsyncFunction.cpp', 'vm/AsyncIteration.cpp', + 'vm/BigIntType.cpp', 'vm/BuildId.cpp', 'vm/BytecodeUtil.cpp', 'vm/Caches.cpp', @@ -346,12 +348,6 @@ SOURCES += [ 'vm/ProfilingStack.cpp', ] -if CONFIG['ENABLE_BIGINT']: - SOURCES += [ - 'builtin/BigInt.cpp', - 'vm/BigIntType.cpp', - ] - if CONFIG['JS_POSIX_NSPR']: UNIFIED_SOURCES += [ 'vm/PosixNSPR.cpp', diff --git a/js/src/shell/js.cpp b/js/src/shell/js.cpp index 07c441120816d..3fa401f61c6b6 100644 --- a/js/src/shell/js.cpp +++ b/js/src/shell/js.cpp @@ -500,9 +500,7 @@ static bool enableWasmVerbose = false; static bool enableTestWasmAwaitTier2 = false; static bool enableAsyncStacks = false; static bool enableStreams = false; -#ifdef ENABLE_BIGINT static bool enableBigInt = false; -#endif #ifdef JS_GC_ZEAL static uint32_t gZealBits = 0; static uint32_t gZealFrequency = 0; @@ -3773,9 +3771,7 @@ static const JSClass sandbox_class = {"sandbox", JSCLASS_GLOBAL_FLAGS, static void SetStandardRealmOptions(JS::RealmOptions& options) { options.creationOptions() .setSharedMemoryAndAtomicsEnabled(enableSharedMemory) -#ifdef ENABLE_BIGINT .setBigIntEnabled(enableBigInt) -#endif .setStreamsEnabled(enableStreams); } @@ -9895,9 +9891,7 @@ static bool SetContextOptions(JSContext* cx, const OptionParser& op) { enableTestWasmAwaitTier2 = op.getBoolOption("test-wasm-await-tier2"); enableAsyncStacks = !op.getBoolOption("no-async-stacks"); enableStreams = !op.getBoolOption("no-streams"); -#ifdef ENABLE_BIGINT enableBigInt = !op.getBoolOption("no-bigint"); -#endif JS::ContextOptionsRef(cx) .setBaseline(enableBaseline) @@ -10603,19 +10597,17 @@ int main(int argc, char** argv, char** envp) { "Disable creating unboxed plain objects") || !op.addBoolOption('\0', "enable-streams", "Enable WHATWG Streams (default)") || - !op.addBoolOption('\0', "no-streams", "Disable WHATWG Streams") -#ifdef ENABLE_BIGINT - || !op.addBoolOption('\0', "no-bigint", - "Disable experimental BigInt support") -#endif - || !op.addStringOption('\0', "shared-memory", "on/off", - "SharedArrayBuffer and Atomics " + !op.addBoolOption('\0', "no-streams", "Disable WHATWG Streams") || + !op.addBoolOption('\0', "no-bigint", + "Disable experimental BigInt support") || + !op.addStringOption('\0', "shared-memory", "on/off", + "SharedArrayBuffer and Atomics " #if SHARED_MEMORY_DEFAULT - "(default: on, off to disable)" + "(default: on, off to disable)" #else - "(default: off, on to enable)" + "(default: off, on to enable)" #endif - ) || + ) || !op.addStringOption('\0', "spectre-mitigations", "on/off", "Whether Spectre mitigations are enabled (default: " "off, on to enable)") || diff --git a/js/src/util/StringBuffer.cpp b/js/src/util/StringBuffer.cpp index 03fb562488603..50b23f9e3d597 100644 --- a/js/src/util/StringBuffer.cpp +++ b/js/src/util/StringBuffer.cpp @@ -167,7 +167,6 @@ bool js::ValueToStringBufferSlow(JSContext* cx, const Value& arg, JSMSG_SYMBOL_TO_STRING); return false; } -#ifdef ENABLE_BIGINT if (v.isBigInt()) { RootedBigInt i(cx, v.toBigInt()); JSLinearString* str = BigInt::toString(cx, i, 10); @@ -176,7 +175,6 @@ bool js::ValueToStringBufferSlow(JSContext* cx, const Value& arg, } return sb.append(str); } -#endif MOZ_ASSERT(v.isUndefined()); return sb.append(cx->names().undefined); } diff --git a/js/src/vm/BytecodeUtil.cpp b/js/src/vm/BytecodeUtil.cpp index aa6ea7b5a2552..307d0b92f2d8b 100644 --- a/js/src/vm/BytecodeUtil.cpp +++ b/js/src/vm/BytecodeUtil.cpp @@ -1478,10 +1478,7 @@ static unsigned Disassemble1(JSContext* cx, HandleScript script, jsbytecode* pc, break; } -# ifdef ENABLE_BIGINT case JOF_BIGINT: - // Fallthrough. -# endif case JOF_DOUBLE: { RootedValue v(cx, script->getConst(GET_UINT32_INDEX(pc))); UniqueChars bytes = ToDisassemblySource(cx, v); diff --git a/js/src/vm/BytecodeUtil.h b/js/src/vm/BytecodeUtil.h index bdab60f8a8861..7ffd13e6137ef 100644 --- a/js/src/vm/BytecodeUtil.h +++ b/js/src/vm/BytecodeUtil.h @@ -62,9 +62,7 @@ enum { JOF_CODE_OFFSET = 19, /* int32_t bytecode offset */ JOF_ICINDEX = 20, /* uint32_t IC index */ JOF_LOOPENTRY = 21, /* JSOP_LOOPENTRY, combines JOF_ICINDEX and JOF_UINT8 */ -#ifdef ENABLE_BIGINT - JOF_BIGINT = 22, /* uint32_t index for BigInt value */ -#endif + JOF_BIGINT = 22, /* uint32_t index for BigInt value */ JOF_TYPEMASK = 0x001f, /* mask for above immediate types */ JOF_NAME = 1 << 5, /* name operation */ diff --git a/js/src/vm/Compartment-inl.h b/js/src/vm/Compartment-inl.h index 92a534cf710d7..1e80897e62ac7 100644 --- a/js/src/vm/Compartment-inl.h +++ b/js/src/vm/Compartment-inl.h @@ -49,7 +49,6 @@ inline bool JS::Compartment::wrap(JSContext* cx, JS::MutableHandleValue vp) { return true; } -#ifdef ENABLE_BIGINT if (vp.isBigInt()) { JS::RootedBigInt bi(cx, vp.toBigInt()); if (!wrap(cx, &bi)) { @@ -58,7 +57,6 @@ inline bool JS::Compartment::wrap(JSContext* cx, JS::MutableHandleValue vp) { vp.setBigInt(bi); return true; } -#endif MOZ_ASSERT(vp.isObject()); diff --git a/js/src/vm/Compartment.cpp b/js/src/vm/Compartment.cpp index 519b37abcb78d..f11f525787991 100644 --- a/js/src/vm/Compartment.cpp +++ b/js/src/vm/Compartment.cpp @@ -168,7 +168,6 @@ bool Compartment::wrap(JSContext* cx, MutableHandleString strp) { return true; } -#ifdef ENABLE_BIGINT bool Compartment::wrap(JSContext* cx, MutableHandleBigInt bi) { MOZ_ASSERT(cx->compartment() == this); @@ -183,7 +182,6 @@ bool Compartment::wrap(JSContext* cx, MutableHandleBigInt bi) { bi.set(copy); return true; } -#endif bool Compartment::getNonWrapperObjectForCurrentCompartment( JSContext* cx, MutableHandleObject obj) { diff --git a/js/src/vm/Compartment.h b/js/src/vm/Compartment.h index c4cf2be5f6304..103f5f7abc752 100644 --- a/js/src/vm/Compartment.h +++ b/js/src/vm/Compartment.h @@ -483,9 +483,7 @@ class JS::Compartment { MOZ_MUST_USE inline bool wrap(JSContext* cx, JS::MutableHandleValue vp); MOZ_MUST_USE bool wrap(JSContext* cx, js::MutableHandleString strp); -#ifdef ENABLE_BIGINT MOZ_MUST_USE bool wrap(JSContext* cx, js::MutableHandle bi); -#endif MOZ_MUST_USE bool wrap(JSContext* cx, JS::MutableHandleObject obj); MOZ_MUST_USE bool wrap(JSContext* cx, JS::MutableHandle desc); diff --git a/js/src/vm/EqualityOperations.cpp b/js/src/vm/EqualityOperations.cpp index 7a4e595d8d408..2910a7f02088b 100644 --- a/js/src/vm/EqualityOperations.cpp +++ b/js/src/vm/EqualityOperations.cpp @@ -16,9 +16,7 @@ #include "js/Result.h" // JS_TRY_VAR_OR_RETURN_FALSE #include "js/RootingAPI.h" // JS::Rooted #include "js/Value.h" // JS::Int32Value, JS::SameType, JS::Value -#ifdef ENABLE_BIGINT -# include "vm/BigIntType.h" // JS::BigInt -#endif // ENABLE_BIGINT +#include "vm/BigIntType.h" // JS::BigInt #include "vm/JSContext.h" // CHECK_THREAD #include "vm/JSObject.h" // js::ToPrimitive #include "vm/StringType.h" // js::EqualStrings @@ -39,12 +37,10 @@ static bool EqualGivenSameType(JSContext* cx, JS::Handle lval, return true; } -#ifdef ENABLE_BIGINT if (lval.isBigInt()) { *equal = JS::BigInt::equal(lval.toBigInt(), rval.toBigInt()); return true; } -#endif if (lval.isGCThing()) { // objects or symbols *equal = (lval.toGCThing() == rval.toGCThing()); @@ -162,7 +158,6 @@ bool js::LooselyEqual(JSContext* cx, JS::Handle lval, return js::LooselyEqual(cx, lvalue, rval, result); } -#ifdef ENABLE_BIGINT if (lval.isBigInt()) { JS::Rooted lbi(cx, lval.toBigInt()); bool tmpResult; @@ -180,7 +175,6 @@ bool js::LooselyEqual(JSContext* cx, JS::Handle lval, *result = tmpResult; return true; } -#endif // Step 12. *result = false; diff --git a/js/src/vm/GlobalObject.cpp b/js/src/vm/GlobalObject.cpp index 2581b084e4e15..27e1f5006e34b 100644 --- a/js/src/vm/GlobalObject.cpp +++ b/js/src/vm/GlobalObject.cpp @@ -11,9 +11,7 @@ #include "jsfriendapi.h" #include "builtin/AtomicsObject.h" -#ifdef ENABLE_BIGINT -# include "builtin/BigInt.h" -#endif +#include "builtin/BigInt.h" #include "builtin/DataViewObject.h" #include "builtin/Eval.h" #include "builtin/MapObject.h" @@ -104,10 +102,8 @@ TypedObjectModuleObject& js::GlobalObject::getTypedObjectModule() const { case JSProto_CountQueuingStrategy: return !cx->realm()->creationOptions().getStreamsEnabled(); -#ifdef ENABLE_BIGINT case JSProto_BigInt: return !cx->realm()->creationOptions().getBigIntEnabled(); -#endif // Return true if the given constructor has been disabled at run-time. case JSProto_Atomics: diff --git a/js/src/vm/Initialization.cpp b/js/src/vm/Initialization.cpp index a178c3db55dc2..e360924b56297 100644 --- a/js/src/vm/Initialization.cpp +++ b/js/src/vm/Initialization.cpp @@ -26,9 +26,7 @@ # include "unicode/uclean.h" # include "unicode/utypes.h" #endif // ENABLE_INTL_API -#ifdef ENABLE_BIGINT -# include "vm/BigIntType.h" -#endif +#include "vm/BigIntType.h" #include "vm/DateTime.h" #include "vm/HelperThreads.h" #include "vm/Runtime.h" diff --git a/js/src/vm/Interpreter-inl.h b/js/src/vm/Interpreter-inl.h index 0c3d0d77ea380..3f291aa8e118f 100644 --- a/js/src/vm/Interpreter-inl.h +++ b/js/src/vm/Interpreter-inl.h @@ -390,11 +390,9 @@ static MOZ_ALWAYS_INLINE bool NegOperation(JSContext* cx, return false; } -#ifdef ENABLE_BIGINT if (val.isBigInt()) { return BigInt::neg(cx, val, res); } -#endif res.setNumber(-val.toNumber()); return true; @@ -723,7 +721,6 @@ static MOZ_ALWAYS_INLINE bool LessThanImpl(JSContext* cx, return true; } -#ifdef ENABLE_BIGINT // Step 4a. if (lhs.isBigInt() && rhs.isString()) { return BigInt::lessThan(cx, lhs, rhs, res); @@ -733,19 +730,16 @@ static MOZ_ALWAYS_INLINE bool LessThanImpl(JSContext* cx, if (lhs.isString() && rhs.isBigInt()) { return BigInt::lessThan(cx, lhs, rhs, res); } -#endif // Steps 4c and 4d. if (!ToNumeric(cx, lhs) || !ToNumeric(cx, rhs)) { return false; } -#ifdef ENABLE_BIGINT // Steps 4e-j. if (lhs.isBigInt() || rhs.isBigInt()) { return BigInt::lessThan(cx, lhs, rhs, res); } -#endif // Step 4e for Number operands. MOZ_ASSERT(lhs.isNumber() && rhs.isNumber()); @@ -865,11 +859,9 @@ static MOZ_ALWAYS_INLINE bool BitNot(JSContext* cx, MutableHandleValue in, return false; } -#ifdef ENABLE_BIGINT if (in.isBigInt()) { return BigInt::bitNot(cx, in, out); } -#endif out.setInt32(~in.toInt32()); return true; @@ -882,11 +874,9 @@ static MOZ_ALWAYS_INLINE bool BitXor(JSContext* cx, MutableHandleValue lhs, return false; } -#ifdef ENABLE_BIGINT if (lhs.isBigInt() || rhs.isBigInt()) { return BigInt::bitXor(cx, lhs, rhs, out); } -#endif out.setInt32(lhs.toInt32() ^ rhs.toInt32()); return true; @@ -899,11 +889,9 @@ static MOZ_ALWAYS_INLINE bool BitOr(JSContext* cx, MutableHandleValue lhs, return false; } -#ifdef ENABLE_BIGINT if (lhs.isBigInt() || rhs.isBigInt()) { return BigInt::bitOr(cx, lhs, rhs, out); } -#endif out.setInt32(lhs.toInt32() | rhs.toInt32()); return true; @@ -916,11 +904,9 @@ static MOZ_ALWAYS_INLINE bool BitAnd(JSContext* cx, MutableHandleValue lhs, return false; } -#ifdef ENABLE_BIGINT if (lhs.isBigInt() || rhs.isBigInt()) { return BigInt::bitAnd(cx, lhs, rhs, out); } -#endif out.setInt32(lhs.toInt32() & rhs.toInt32()); return true; @@ -933,11 +919,9 @@ static MOZ_ALWAYS_INLINE bool BitLsh(JSContext* cx, MutableHandleValue lhs, return false; } -#ifdef ENABLE_BIGINT if (lhs.isBigInt() || rhs.isBigInt()) { return BigInt::lsh(cx, lhs, rhs, out); } -#endif out.setInt32(lhs.toInt32() << (rhs.toInt32() & 31)); return true; @@ -950,11 +934,9 @@ static MOZ_ALWAYS_INLINE bool BitRsh(JSContext* cx, MutableHandleValue lhs, return false; } -#ifdef ENABLE_BIGINT if (lhs.isBigInt() || rhs.isBigInt()) { return BigInt::rsh(cx, lhs, rhs, out); } -#endif out.setInt32(lhs.toInt32() >> (rhs.toInt32() & 31)); return true; @@ -964,7 +946,6 @@ static MOZ_ALWAYS_INLINE bool UrshOperation(JSContext* cx, MutableHandleValue lhs, MutableHandleValue rhs, MutableHandleValue out) { -#ifdef ENABLE_BIGINT if (!ToNumeric(cx, lhs) || !ToNumeric(cx, rhs)) { return false; } @@ -974,7 +955,6 @@ static MOZ_ALWAYS_INLINE bool UrshOperation(JSContext* cx, JSMSG_BIGINT_TO_NUMBER); return false; } -#endif uint32_t left; int32_t right; diff --git a/js/src/vm/Interpreter.cpp b/js/src/vm/Interpreter.cpp index dcab01c6678fb..1382de3c9ed08 100644 --- a/js/src/vm/Interpreter.cpp +++ b/js/src/vm/Interpreter.cpp @@ -35,9 +35,7 @@ #include "util/StringBuffer.h" #include "vm/AsyncFunction.h" #include "vm/AsyncIteration.h" -#ifdef ENABLE_BIGINT -# include "vm/BigIntType.h" -#endif +#include "vm/BigIntType.h" #include "vm/BytecodeUtil.h" #include "vm/Debugger.h" #include "vm/EqualityOperations.h" // js::StrictlyEqual @@ -891,11 +889,9 @@ JSType js::TypeOfValue(const Value& v) { if (v.isBoolean()) { return JSTYPE_BOOLEAN; } -#ifdef ENABLE_BIGINT if (v.isBigInt()) { return JSTYPE_BIGINT; } -#endif MOZ_ASSERT(v.isSymbol()); return JSTYPE_SYMBOL; } @@ -1440,11 +1436,9 @@ static MOZ_ALWAYS_INLINE bool AddOperation(JSContext* cx, return false; } -#ifdef ENABLE_BIGINT if (lhs.isBigInt() || rhs.isBigInt()) { return BigInt::add(cx, lhs, rhs, res); } -#endif res.setNumber(lhs.toNumber() + rhs.toNumber()); return true; @@ -1458,11 +1452,9 @@ static MOZ_ALWAYS_INLINE bool SubOperation(JSContext* cx, return false; } -#ifdef ENABLE_BIGINT if (lhs.isBigInt() || rhs.isBigInt()) { return BigInt::sub(cx, lhs, rhs, res); } -#endif res.setNumber(lhs.toNumber() - rhs.toNumber()); return true; @@ -1476,11 +1468,9 @@ static MOZ_ALWAYS_INLINE bool MulOperation(JSContext* cx, return false; } -#ifdef ENABLE_BIGINT if (lhs.isBigInt() || rhs.isBigInt()) { return BigInt::mul(cx, lhs, rhs, res); } -#endif res.setNumber(lhs.toNumber() * rhs.toNumber()); return true; @@ -1494,11 +1484,9 @@ static MOZ_ALWAYS_INLINE bool DivOperation(JSContext* cx, return false; } -#ifdef ENABLE_BIGINT if (lhs.isBigInt() || rhs.isBigInt()) { return BigInt::div(cx, lhs, rhs, res); } -#endif res.setNumber(NumberDiv(lhs.toNumber(), rhs.toNumber())); return true; @@ -1520,11 +1508,9 @@ static MOZ_ALWAYS_INLINE bool ModOperation(JSContext* cx, return false; } -#ifdef ENABLE_BIGINT if (lhs.isBigInt() || rhs.isBigInt()) { return BigInt::mod(cx, lhs, rhs, res); } -#endif res.setNumber(NumberMod(lhs.toNumber(), rhs.toNumber())); return true; @@ -1538,11 +1524,9 @@ static MOZ_ALWAYS_INLINE bool PowOperation(JSContext* cx, return false; } -#ifdef ENABLE_BIGINT if (lhs.isBigInt() || rhs.isBigInt()) { return BigInt::pow(cx, lhs, rhs, res); } -#endif res.setNumber(ecmaPow(lhs.toNumber(), rhs.toNumber())); return true; @@ -4326,13 +4310,11 @@ static MOZ_NEVER_INLINE JS_HAZ_JSNATIVE_CALLER bool Interpret(JSContext* cx, } END_CASE(JSOP_TONUMERIC) -#ifdef ENABLE_BIGINT CASE(JSOP_BIGINT) { PUSH_COPY(script->getConst(GET_UINT32_INDEX(REGS.pc))); MOZ_ASSERT(REGS.sp[-1].isBigInt()); } END_CASE(JSOP_BIGINT) -#endif DEFAULT() { char numBuf[12]; @@ -4425,8 +4407,7 @@ bool js::GetProperty(JSContext* cx, HandleValue v, HandlePropertyName name, // Optimize common cases like (2).toString() or "foo".valueOf() to not // create a wrapper object. - if (v.isPrimitive() && !v.isNullOrUndefined() && - IF_BIGINT(!v.isBigInt(), true)) { + if (v.isPrimitive() && !v.isNullOrUndefined() && !v.isBigInt()) { NativeObject* proto; if (v.isNumber()) { proto = GlobalObject::getOrCreateNumberPrototype(cx, cx->global()); diff --git a/js/src/vm/JSAtom.cpp b/js/src/vm/JSAtom.cpp index 84f9b8f3ccdd4..295a9f0f1bcc1 100644 --- a/js/src/vm/JSAtom.cpp +++ b/js/src/vm/JSAtom.cpp @@ -1090,7 +1090,6 @@ static JSAtom* ToAtomSlow( } return nullptr; } -#ifdef ENABLE_BIGINT if (v.isBigInt()) { RootedBigInt i(cx, v.toBigInt()); JSAtom* atom = BigIntToAtom(cx, i); @@ -1099,7 +1098,6 @@ static JSAtom* ToAtomSlow( } return atom; } -#endif MOZ_ASSERT(v.isUndefined()); return cx->names().undefined; } diff --git a/js/src/vm/JSContext-inl.h b/js/src/vm/JSContext-inl.h index c960b5405335a..10b0916855764 100644 --- a/js/src/vm/JSContext-inl.h +++ b/js/src/vm/JSContext-inl.h @@ -12,9 +12,7 @@ #include "builtin/Object.h" #include "jit/JitFrames.h" #include "proxy/Proxy.h" -#ifdef ENABLE_BIGINT -# include "vm/BigIntType.h" -#endif +#include "vm/BigIntType.h" #include "vm/HelperThreads.h" #include "vm/Interpreter.h" #include "vm/Iteration.h" @@ -105,9 +103,7 @@ class ContextChecks { void check(JS::Symbol* symbol, int argIndex) { checkAtom(symbol, argIndex); } -#ifdef ENABLE_BIGINT void check(JS::BigInt* bi, int argIndex) { check(bi->zone(), argIndex); } -#endif void check(const js::Value& v, int argIndex) { if (v.isObject()) { @@ -116,12 +112,9 @@ class ContextChecks { check(v.toString(), argIndex); } else if (v.isSymbol()) { check(v.toSymbol(), argIndex); - } -#ifdef ENABLE_BIGINT - else if (v.isBigInt()) { + } else if (v.isBigInt()) { check(v.toBigInt(), argIndex); } -#endif } // Check the contents of any container class that supports the C++ diff --git a/js/src/vm/JSObject.cpp b/js/src/vm/JSObject.cpp index 9a0810829e72e..ece680001f213 100644 --- a/js/src/vm/JSObject.cpp +++ b/js/src/vm/JSObject.cpp @@ -25,9 +25,7 @@ #include "jsutil.h" #include "builtin/Array.h" -#ifdef ENABLE_BIGINT -# include "builtin/BigInt.h" -#endif +#include "builtin/BigInt.h" #include "builtin/Eval.h" #include "builtin/Object.h" #include "builtin/String.h" @@ -3310,7 +3308,6 @@ JSObject* js::PrimitiveToObject(JSContext* cx, const Value& v) { if (v.isBoolean()) { return BooleanObject::create(cx, v.toBoolean()); } -#ifdef ENABLE_BIGINT if (v.isSymbol()) { RootedSymbol symbol(cx, v.toSymbol()); return SymbolObject::create(cx, symbol); @@ -3318,11 +3315,6 @@ JSObject* js::PrimitiveToObject(JSContext* cx, const Value& v) { MOZ_ASSERT(v.isBigInt()); RootedBigInt bigInt(cx, v.toBigInt()); return BigIntObject::create(cx, bigInt); -#else - MOZ_ASSERT(v.isSymbol()); - RootedSymbol symbol(cx, v.toSymbol()); - return SymbolObject::create(cx, symbol); -#endif } /* @@ -4215,10 +4207,8 @@ bool js::Unbox(JSContext* cx, HandleObject obj, MutableHandleValue vp) { vp.set(obj->as().UTCTime()); } else if (obj->is()) { vp.setSymbol(obj->as().unbox()); -#ifdef ENABLE_BIGINT } else if (obj->is()) { vp.setBigInt(obj->as().unbox()); -#endif } else { vp.setUndefined(); } diff --git a/js/src/vm/JSScript.cpp b/js/src/vm/JSScript.cpp index 80515a226e4fa..56f70954880b1 100644 --- a/js/src/vm/JSScript.cpp +++ b/js/src/vm/JSScript.cpp @@ -100,9 +100,7 @@ XDRResult js::XDRScriptConst(XDRState* xdr, MutableHandleValue vp) { SCRIPT_OBJECT, SCRIPT_VOID, SCRIPT_HOLE, -#ifdef ENABLE_BIGINT SCRIPT_BIGINT -#endif }; ConstTag tag; @@ -123,13 +121,9 @@ XDRResult js::XDRScriptConst(XDRState* xdr, MutableHandleValue vp) { tag = SCRIPT_OBJECT; } else if (vp.isMagic(JS_ELEMENTS_HOLE)) { tag = SCRIPT_HOLE; - } -#ifdef ENABLE_BIGINT - else if (vp.isBigInt()) { + } else if (vp.isBigInt()) { tag = SCRIPT_BIGINT; - } -#endif - else { + } else { MOZ_ASSERT(vp.isUndefined()); tag = SCRIPT_VOID; } @@ -209,7 +203,6 @@ XDRResult js::XDRScriptConst(XDRState* xdr, MutableHandleValue vp) { vp.setMagic(JS_ELEMENTS_HOLE); } break; -#ifdef ENABLE_BIGINT case SCRIPT_BIGINT: { RootedBigInt bi(cx); if (mode == XDR_ENCODE) { @@ -223,7 +216,6 @@ XDRResult js::XDRScriptConst(XDRState* xdr, MutableHandleValue vp) { } break; } -#endif default: // Fail in debug, but only soft-fail in release MOZ_ASSERT(false, "Bad XDR value kind"); @@ -4064,9 +4056,7 @@ bool js::detail::CopyScript(JSContext* cx, HandleScript src, HandleScript dst, val = elem.get(); if (val.isDouble()) { clone = val; - } -#ifdef ENABLE_BIGINT - else if (val.isBigInt()) { + } else if (val.isBigInt()) { if (cx->zone() == val.toBigInt()->zone()) { clone.setBigInt(val.toBigInt()); } else { @@ -4077,9 +4067,7 @@ bool js::detail::CopyScript(JSContext* cx, HandleScript src, HandleScript dst, } clone.setBigInt(copy); } - } -#endif - else { + } else { MOZ_ASSERT_UNREACHABLE("bad script consts() element"); } diff --git a/js/src/vm/MemoryMetrics.cpp b/js/src/vm/MemoryMetrics.cpp index 8b9226fcc4c28..39a7be785d8ea 100644 --- a/js/src/vm/MemoryMetrics.cpp +++ b/js/src/vm/MemoryMetrics.cpp @@ -13,9 +13,7 @@ #include "jit/BaselineJIT.h" #include "jit/Ion.h" #include "vm/ArrayObject.h" -#ifdef ENABLE_BIGINT -# include "vm/BigIntType.h" -#endif +#include "vm/BigIntType.h" #include "vm/HelperThreads.h" #include "vm/JSObject.h" #include "vm/JSScript.h" @@ -495,7 +493,6 @@ static void StatsCellCallback(JSRuntime* rt, void* data, void* thing, zStats->symbolsGCHeap += thingSize; break; -#ifdef ENABLE_BIGINT case JS::TraceKind::BigInt: { JS::BigInt* bi = static_cast(thing); zStats->bigIntsGCHeap += thingSize; @@ -503,7 +500,6 @@ static void StatsCellCallback(JSRuntime* rt, void* data, void* thing, bi->sizeOfExcludingThis(rtStats->mallocSizeOf_); break; } -#endif case JS::TraceKind::BaseShape: { JS::ShapeInfo info; // This zeroes all the sizes. diff --git a/js/src/vm/Opcodes.h b/js/src/vm/Opcodes.h index 6b0625e4497e9..3613a66bf8097 100644 --- a/js/src/vm/Opcodes.h +++ b/js/src/vm/Opcodes.h @@ -2537,7 +2537,7 @@ * Operands: uint32_t constIndex * Stack: => val */ \ - IF_BIGINT(MACRO(JSOP_BIGINT, 237, "bigint", NULL, 5, 0, 1, JOF_BIGINT),) + MACRO(JSOP_BIGINT, 237, "bigint", NULL, 5, 0, 1, JOF_BIGINT) // clang-format on /* @@ -2545,7 +2545,6 @@ * a power of two. Use this macro to do so. */ #define FOR_EACH_TRAILING_UNUSED_OPCODE(MACRO) \ - IF_BIGINT(, MACRO(237)) \ MACRO(238) \ MACRO(239) \ MACRO(240) \ diff --git a/js/src/vm/StringType.cpp b/js/src/vm/StringType.cpp index 86e9f73728737..05d6e369b562b 100644 --- a/js/src/vm/StringType.cpp +++ b/js/src/vm/StringType.cpp @@ -2163,17 +2163,13 @@ JSString* js::ToStringSlow( JSMSG_SYMBOL_TO_STRING); } return nullptr; - } -#ifdef ENABLE_BIGINT - else if (v.isBigInt()) { + } else if (v.isBigInt()) { if (!allowGC) { return nullptr; } RootedBigInt i(cx, v.toBigInt()); str = BigInt::toString(cx, i, 10); - } -#endif - else { + } else { MOZ_ASSERT(v.isUndefined()); str = cx->names().undefined; } diff --git a/js/src/vm/StructuredClone.cpp b/js/src/vm/StructuredClone.cpp index ec0c8769c0f4b..562f5b0fdb69b 100644 --- a/js/src/vm/StructuredClone.cpp +++ b/js/src/vm/StructuredClone.cpp @@ -46,9 +46,7 @@ #include "js/Date.h" #include "js/GCHashTable.h" #include "js/Wrapper.h" -#ifdef ENABLE_BIGINT -# include "vm/BigIntType.h" -#endif +#include "vm/BigIntType.h" #include "vm/JSContext.h" #include "vm/RegExpObject.h" #include "vm/SavedFrame.h" @@ -402,9 +400,7 @@ struct JSStructuredCloneReader { JSString* readStringImpl(uint32_t nchars); JSString* readString(uint32_t data); -#ifdef ENABLE_BIGINT BigInt* readBigInt(uint32_t data); -#endif bool checkDouble(double d); MOZ_MUST_USE bool readTypedArray(uint32_t arrayType, uint32_t nelems, @@ -496,6 +492,7 @@ struct JSStructuredCloneWriter { bool writeTransferMap(); bool writeString(uint32_t tag, JSString* str); + bool writeBigInt(uint32_t tag, BigInt* bi); bool writeArrayBuffer(HandleObject obj); bool writeTypedArray(HandleObject obj); bool writeDataView(HandleObject obj); @@ -508,10 +505,6 @@ struct JSStructuredCloneWriter { bool traverseSet(HandleObject obj); bool traverseSavedFrame(HandleObject obj); -#ifdef ENABLE_BIGINT - bool writeBigInt(uint32_t tag, BigInt* bi); -#endif - bool reportDataCloneError(uint32_t errorId); bool parseTransferable(); @@ -1145,7 +1138,6 @@ bool JSStructuredCloneWriter::writeString(uint32_t tag, JSString* str) { : out.writeChars(linear->twoByteChars(nogc), length); } -#ifdef ENABLE_BIGINT bool JSStructuredCloneWriter::writeBigInt(uint32_t tag, BigInt* bi) { bool signBit = bi->isNegative(); size_t length = bi->digitLength(); @@ -1160,7 +1152,6 @@ bool JSStructuredCloneWriter::writeBigInt(uint32_t tag, BigInt* bi) { } return out.writeArray(bi->digits().data(), length); } -#endif inline void JSStructuredCloneWriter::checkStack() { #ifdef DEBUG @@ -1626,13 +1617,9 @@ bool JSStructuredCloneWriter::startWrite(HandleValue v) { return out.writePair(SCTAG_NULL, 0); } else if (v.isUndefined()) { return out.writePair(SCTAG_UNDEFINED, 0); - } -#ifdef ENABLE_BIGINT - else if (v.isBigInt()) { + } else if (v.isBigInt()) { return writeBigInt(SCTAG_BIGINT, v.toBigInt()); - } -#endif - else if (v.isObject()) { + } else if (v.isObject()) { RootedObject obj(context(), &v.toObject()); bool backref; @@ -1705,7 +1692,6 @@ bool JSStructuredCloneWriter::startWrite(HandleValue v) { return traverseSet(obj); case ESClass::Map: return traverseMap(obj); -#ifdef ENABLE_BIGINT case ESClass::BigInt: { RootedValue unboxed(context()); if (!Unbox(context(), obj, &unboxed)) { @@ -1713,7 +1699,6 @@ bool JSStructuredCloneWriter::startWrite(HandleValue v) { } return writeBigInt(SCTAG_BIGINT_OBJECT, unboxed.toBigInt()); } -#endif case ESClass::Promise: case ESClass::MapIterator: case ESClass::SetIterator: @@ -2062,7 +2047,6 @@ JSString* JSStructuredCloneReader::readString(uint32_t data) { : readStringImpl(nchars); } -#ifdef ENABLE_BIGINT BigInt* JSStructuredCloneReader::readBigInt(uint32_t data) { size_t length = data & JS_BITMASK(31); bool isNegative = data & (1 << 31); @@ -2079,7 +2063,6 @@ BigInt* JSStructuredCloneReader::readBigInt(uint32_t data) { } return result; } -#endif static uint32_t TagToV1ArrayType(uint32_t tag) { MOZ_ASSERT(tag >= SCTAG_TYPED_ARRAY_V1_MIN && @@ -2429,7 +2412,6 @@ bool JSStructuredCloneReader::startRead(MutableHandleValue vp) { case SCTAG_BIGINT: case SCTAG_BIGINT_OBJECT: { -#ifdef ENABLE_BIGINT RootedBigInt bi(context(), readBigInt(data)); if (!bi) { return false; @@ -2439,12 +2421,6 @@ bool JSStructuredCloneReader::startRead(MutableHandleValue vp) { return false; } break; -#else - JS_ReportErrorNumberASCII(context(), GetErrorMessage, nullptr, - JSMSG_SC_BAD_SERIALIZED_DATA, - "BigInt unsupported"); - return false; -#endif } case SCTAG_DATE_OBJECT: { diff --git a/js/src/vm/TypeInference-inl.h b/js/src/vm/TypeInference-inl.h index d786a77c7c0b7..2a5587aed1ce7 100644 --- a/js/src/vm/TypeInference-inl.h +++ b/js/src/vm/TypeInference-inl.h @@ -180,10 +180,8 @@ inline TypeFlags PrimitiveTypeFlag(JSValueType type) { return TYPE_FLAG_STRING; case JSVAL_TYPE_SYMBOL: return TYPE_FLAG_SYMBOL; -#ifdef ENABLE_BIGINT case JSVAL_TYPE_BIGINT: return TYPE_FLAG_BIGINT; -#endif case JSVAL_TYPE_MAGIC: return TYPE_FLAG_LAZYARGS; default: @@ -207,10 +205,8 @@ inline JSValueType TypeFlagPrimitive(TypeFlags flags) { return JSVAL_TYPE_STRING; case TYPE_FLAG_SYMBOL: return JSVAL_TYPE_SYMBOL; -#ifdef ENABLE_BIGINT case TYPE_FLAG_BIGINT: return JSVAL_TYPE_BIGINT; -#endif case TYPE_FLAG_LAZYARGS: return JSVAL_TYPE_MAGIC; default: diff --git a/js/src/vm/TypeInference.cpp b/js/src/vm/TypeInference.cpp index a42eea8f7a002..ee127a6850b40 100644 --- a/js/src/vm/TypeInference.cpp +++ b/js/src/vm/TypeInference.cpp @@ -107,10 +107,8 @@ const char* js::TypeIdStringImpl(jsid id) { return "string"; case JSVAL_TYPE_SYMBOL: return "symbol"; -#ifdef ENABLE_BIGINT case JSVAL_TYPE_BIGINT: return "BigInt"; -#endif case JSVAL_TYPE_MAGIC: return "lazyargs"; default: @@ -391,10 +389,8 @@ bool TypeSet::mightBeMIRType(jit::MIRType type) const { return baseFlags() & TYPE_FLAG_STRING; case jit::MIRType::Symbol: return baseFlags() & TYPE_FLAG_SYMBOL; -#ifdef ENABLE_BIGINT case jit::MIRType::BigInt: return baseFlags() & TYPE_FLAG_BIGINT; -#endif case jit::MIRType::MagicOptimizedArguments: return baseFlags() & TYPE_FLAG_LAZYARGS; case jit::MIRType::MagicHole: @@ -826,11 +822,9 @@ void TypeSet::print(FILE* fp) { if (flags & TYPE_FLAG_SYMBOL) { fprintf(fp, " symbol"); } -#ifdef ENABLE_BIGINT if (flags & TYPE_FLAG_BIGINT) { fprintf(fp, " BigInt"); } -#endif if (flags & TYPE_FLAG_LAZYARGS) { fprintf(fp, " lazyargs"); } @@ -1713,10 +1707,8 @@ static inline jit::MIRType GetMIRTypeFromTypeFlags(TypeFlags flags) { return jit::MIRType::String; case TYPE_FLAG_SYMBOL: return jit::MIRType::Symbol; -#ifdef ENABLE_BIGINT case TYPE_FLAG_BIGINT: return jit::MIRType::BigInt; -#endif case TYPE_FLAG_LAZYARGS: return jit::MIRType::MagicOptimizedArguments; case TYPE_FLAG_ANYOBJECT: diff --git a/js/src/vm/TypeSet.h b/js/src/vm/TypeSet.h index ff6b2bb602cb3..4216267cdac6d 100644 --- a/js/src/vm/TypeSet.h +++ b/js/src/vm/TypeSet.h @@ -83,29 +83,19 @@ enum : uint32_t { TYPE_FLAG_DOUBLE = 0x10, TYPE_FLAG_STRING = 0x20, TYPE_FLAG_SYMBOL = 0x40, -#ifdef ENABLE_BIGINT TYPE_FLAG_BIGINT = 0x80, TYPE_FLAG_LAZYARGS = 0x100, TYPE_FLAG_ANYOBJECT = 0x200, -#else - TYPE_FLAG_LAZYARGS = 0x80, - TYPE_FLAG_ANYOBJECT = 0x100, -#endif /* Mask containing all primitives */ TYPE_FLAG_PRIMITIVE = TYPE_FLAG_UNDEFINED | TYPE_FLAG_NULL | TYPE_FLAG_BOOLEAN | TYPE_FLAG_INT32 | TYPE_FLAG_DOUBLE | TYPE_FLAG_STRING | TYPE_FLAG_SYMBOL | - IF_BIGINT(TYPE_FLAG_BIGINT, 0), + TYPE_FLAG_BIGINT, /* Mask/shift for the number of objects in objectSet */ -#ifdef ENABLE_BIGINT TYPE_FLAG_OBJECT_COUNT_MASK = 0x3c00, TYPE_FLAG_OBJECT_COUNT_SHIFT = 10, -#else - TYPE_FLAG_OBJECT_COUNT_MASK = 0x3e00, - TYPE_FLAG_OBJECT_COUNT_SHIFT = 9, -#endif TYPE_FLAG_OBJECT_COUNT_LIMIT = 7, TYPE_FLAG_DOMOBJECT_COUNT_LIMIT = TYPE_FLAG_OBJECT_COUNT_MASK >> TYPE_FLAG_OBJECT_COUNT_SHIFT, @@ -396,9 +386,7 @@ class TypeSet { static inline Type DoubleType() { return Type(JSVAL_TYPE_DOUBLE); } static inline Type StringType() { return Type(JSVAL_TYPE_STRING); } static inline Type SymbolType() { return Type(JSVAL_TYPE_SYMBOL); } -#ifdef ENABLE_BIGINT static inline Type BigIntType() { return Type(JSVAL_TYPE_BIGINT); } -#endif static inline Type MagicArgType() { return Type(JSVAL_TYPE_MAGIC); } static inline Type AnyObjectType() { return Type(JSVAL_TYPE_OBJECT); } static inline Type UnknownType() { return Type(JSVAL_TYPE_UNKNOWN); } diff --git a/js/src/vm/TypedArrayObject-inl.h b/js/src/vm/TypedArrayObject-inl.h index 24197c176ca80..476298d6b70ae 100644 --- a/js/src/vm/TypedArrayObject-inl.h +++ b/js/src/vm/TypedArrayObject-inl.h @@ -614,7 +614,7 @@ class ElementSpecific { } double d; - MOZ_ASSERT(v.isString() || v.isObject() || v.isSymbol() || IF_BIGINT(v.isBigInt(), false)); + MOZ_ASSERT(v.isString() || v.isObject() || v.isSymbol() || v.isBigInt()); if (!(v.isString() ? StringToNumber(cx, v.toString(), &d) : ToNumber(cx, v, &d))) { return false; diff --git a/js/src/vm/UbiNode.cpp b/js/src/vm/UbiNode.cpp index 5b8befeae0284..8bab8c0f4b013 100644 --- a/js/src/vm/UbiNode.cpp +++ b/js/src/vm/UbiNode.cpp @@ -23,9 +23,7 @@ #include "js/Utility.h" #include "js/Vector.h" #include "util/Text.h" -#ifdef ENABLE_BIGINT -# include "vm/BigIntType.h" -#endif +#include "vm/BigIntType.h" #include "vm/Debugger.h" #include "vm/EnvironmentObject.h" #include "vm/GlobalObject.h" @@ -179,13 +177,9 @@ Value Node::exposeToJS() const { v.setString(as()); } else if (is()) { v.setSymbol(as()); - } -#ifdef ENABLE_BIGINT - else if (is()) { + } else if (is()) { v.setBigInt(as()); - } -#endif - else { + } else { v.setUndefined(); } @@ -269,9 +263,7 @@ template JS::Zone* TracerConcrete::zone() const; template JS::Zone* TracerConcrete::zone() const; template JS::Zone* TracerConcrete::zone() const; template JS::Zone* TracerConcrete::zone() const; -#ifdef ENABLE_BIGINT template JS::Zone* TracerConcrete::zone() const; -#endif template JS::Zone* TracerConcrete::zone() const; template @@ -310,10 +302,8 @@ template UniquePtr TracerConcrete::edges( JSContext* cx, bool wantNames) const; template UniquePtr TracerConcrete::edges( JSContext* cx, bool wantNames) const; -#ifdef ENABLE_BIGINT template UniquePtr TracerConcrete::edges( JSContext* cx, bool wantNames) const; -#endif template UniquePtr TracerConcrete::edges( JSContext* cx, bool wantNames) const; @@ -380,9 +370,7 @@ Realm* Concrete::realm() const { } const char16_t Concrete::concreteTypeName[] = u"JS::Symbol"; -#ifdef ENABLE_BIGINT const char16_t Concrete::concreteTypeName[] = u"JS::BigInt"; -#endif const char16_t Concrete::concreteTypeName[] = u"JSScript"; const char16_t Concrete::concreteTypeName[] = u"js::LazyScript"; const char16_t Concrete::concreteTypeName[] = diff --git a/js/xpconnect/src/XPCJSContext.cpp b/js/xpconnect/src/XPCJSContext.cpp index 13118b6322c48..ed683153a31fb 100644 --- a/js/xpconnect/src/XPCJSContext.cpp +++ b/js/xpconnect/src/XPCJSContext.cpp @@ -749,16 +749,12 @@ bool xpc::ExtraWarningsForSystemJS() { return false; } static mozilla::Atomic sSharedMemoryEnabled(false); static mozilla::Atomic sStreamsEnabled(false); -#ifdef ENABLE_BIGINT static mozilla::Atomic sBigIntEnabled(false); -#endif void xpc::SetPrefableRealmOptions(JS::RealmOptions& options) { options.creationOptions() .setSharedMemoryAndAtomicsEnabled(sSharedMemoryEnabled) -#ifdef ENABLE_BIGINT .setBigIntEnabled(sBigIntEnabled) -#endif .setStreamsEnabled(sStreamsEnabled); } @@ -810,9 +806,7 @@ static void ReloadPrefsCallback(const char* pref, XPCJSContext* xpccx) { bool useAsyncStack = Preferences::GetBool(JS_OPTIONS_DOT_STR "asyncstack"); -#ifdef ENABLE_BIGINT sBigIntEnabled = Preferences::GetBool(JS_OPTIONS_DOT_STR "bigint"); -#endif bool throwOnDebuggeeWouldRun = Preferences::GetBool(JS_OPTIONS_DOT_STR "throw_on_debuggee_would_run"); diff --git a/modules/libpref/init/StaticPrefList.h b/modules/libpref/init/StaticPrefList.h index ca3cc3f17850b..9ee7cc1e46d1e 100644 --- a/modules/libpref/init/StaticPrefList.h +++ b/modules/libpref/init/StaticPrefList.h @@ -1018,14 +1018,12 @@ VARCACHE_PREF( RelaxedAtomicBool, false ) -#ifdef ENABLE_BIGINT // BigInt API VARCACHE_PREF( "javascript.options.bigint", javascript_options_bigint, RelaxedAtomicBool, false ) -#endif //---------------------------------------------------------------------------