Backed out 11 changesets (bug 1457560, bug 1366287) for causing Linux build bustages CLOSED TREE

Backed out changeset e71da1f3c048
Backed out changeset 971159738904 (bug 1366287)
Backed out changeset 68fae6784ebe (bug 1366287)
Backed out changeset a18120245eb7 (bug 1366287)
Backed out changeset 3bbd03d726e5 (bug 1366287)
Backed out changeset f80aac2c702a (bug 1366287)
Backed out changeset c834c0c12a7f (bug 1366287)
Backed out changeset dd19d38a2b1c (bug 1366287)
Backed out changeset 76fdbe405fbd (bug 1366287)
Backed out changeset b424782cd5d1 (bug 1366287)
Backed out changeset e4fd5393d398 (bug 1457560)
This commit is contained in:
Ciure Andrei 2018-05-12 08:00:13 +03:00
Родитель 35847e1a96
Коммит a7fbf22348
68 изменённых файлов: 34 добавлений и 1348 удалений

Просмотреть файл

@ -1339,8 +1339,3 @@ if CONFIG['MOZ_SYSTEM_ICU']:
'unicode/ustring.h',
'unicode/utypes.h',
]
if CONFIG['ENABLE_BIGINT']:
system_headers += [
'gmp.h'
]

Просмотреть файл

@ -102,29 +102,13 @@ def disable_export_js(value):
die('Setting %s is deprecated, use %s instead.',
value.format('DISABLE_EXPORT_JS'), suggestion)
# Experimental BigInt support
# =======================================================
js_option('--enable-bigint',
default=False,
help='Enable BigInt')
@depends('--enable-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, '--enable-bigint')
def ion_default(target, enable_bigint):
if enable_bigint:
return False
@depends(target)
def ion_default(target):
if target.cpu in ('x86', 'x86_64', 'arm', 'aarch64', 'mips32', 'mips64'):
return True
return False
js_option('--enable-ion',
default=ion_default,

Просмотреть файл

@ -1024,9 +1024,6 @@ enum class ESClass {
SetIterator,
Arguments,
Error,
#ifdef ENABLE_BIGINT
BigInt,
#endif
/** None of the above. */
Other

Просмотреть файл

@ -122,7 +122,7 @@ ToBoolean(HandleValue v)
if (v.isSymbol())
return true;
/* The slow path handles strings, BigInts and objects. */
/* The slow path handles strings and objects. */
return js::ToBooleanSlow(v);
}

Просмотреть файл

@ -50,7 +50,6 @@
// 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(JSAtom*) \
D(JSFunction*) \
D(JSObject*) \
@ -128,9 +127,6 @@ struct GCPointerPolicy
}
};
template <> struct GCPolicy<JS::Symbol*> : public GCPointerPolicy<JS::Symbol*> {};
#ifdef ENABLE_BIGINT
template <> struct GCPolicy<JS::BigInt*> : public GCPointerPolicy<JS::BigInt*> {};
#endif
template <> struct GCPolicy<JSAtom*> : public GCPointerPolicy<JSAtom*> {};
template <> struct GCPolicy<JSFunction*> : public GCPointerPolicy<JSFunction*> {};
template <> struct GCPolicy<JSObject*> : public GCPointerPolicy<JSObject*> {};

Просмотреть файл

@ -53,26 +53,6 @@ JS_SetICUMemoryFunctions(JS_ICUAllocFn allocFn,
JS_ICUReallocFn reallocFn,
JS_ICUFreeFn freeFn);
#ifdef ENABLE_BIGINT
namespace JS {
// These types are documented as allocate_function, reallocate_function,
// and free_function in the Info node `(gmp)Custom Allocation`.
using GMPAllocFn = void* (*)(size_t allocSize);
using GMPReallocFn = void* (*)(void* p, size_t oldSize, size_t newSize);
using GMPFreeFn = void (*)(void* p, size_t size);
// This function can be used to track memory used by GMP. If it is
// called, it *must* be called before JS_Init so that same functions are
// used for all allocations.
extern JS_PUBLIC_API(void)
SetGMPMemoryFunctions(GMPAllocFn allocFn,
GMPReallocFn reallocFn,
GMPFreeFn freeFn);
}; // namespace JS
#endif
/**
* Initialize SpiderMonkey, returning true only if initialization succeeded.
* Once this method has succeeded, it is safe to call JS_NewContext and other

Просмотреть файл

@ -630,7 +630,6 @@ struct UnusedGCThingSizes
macro(Other, GCHeapUnused, objectGroup) \
macro(Other, GCHeapUnused, string) \
macro(Other, GCHeapUnused, symbol) \
IF_BIGINT(macro(Other, GCHeapUnused, bigInt),) \
macro(Other, GCHeapUnused, jitcode) \
macro(Other, GCHeapUnused, scope) \
macro(Other, GCHeapUnused, regExpShared)
@ -650,9 +649,6 @@ struct UnusedGCThingSizes
case JS::TraceKind::Object: object += n; break;
case JS::TraceKind::String: string += n; break;
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;
case JS::TraceKind::Shape: shape += n; break;
case JS::TraceKind::BaseShape: baseShape += n; break;
@ -694,8 +690,6 @@ 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, GCHeapAdmin, gcHeapArenaAdmin) \
macro(Other, GCHeapUsed, lazyScriptsGCHeap) \
macro(Other, MallocHeap, lazyScriptsMallocHeap) \

Просмотреть файл

@ -95,7 +95,6 @@
real(Float32Array, InitViaClassSpec, TYPED_ARRAY_CLASP(Float32)) \
real(Float64Array, InitViaClassSpec, TYPED_ARRAY_CLASP(Float64)) \
real(Uint8ClampedArray, InitViaClassSpec, TYPED_ARRAY_CLASP(Uint8Clamped)) \
IF_BIGINT(real,imaginary)(BigInt, InitViaClassSpec, OCLASP(BigInt)) \
real(Proxy, InitProxyClass, &js::ProxyClass) \
real(WeakMap, InitWeakMapClass, OCLASP(WeakMap)) \
real(Map, InitViaClassSpec, OCLASP(Map)) \

Просмотреть файл

@ -41,23 +41,20 @@ enum class TraceKind
// Note: The order here is determined by our Value packing. Other users
// should sort alphabetically, for consistency.
Object = 0x00,
#ifdef ENABLE_BIGINT
BigInt = 0x01,
#endif
String = 0x02,
Symbol = 0x03,
// 0x4 is not used for any GCThing Value tag, so we use it for Script.
Script = 0x04,
// 0x1 is not used for any GCThing Value tag, so we use it for Script.
Script = 0x01,
// Shape details are exposed through JS_TraceShapeCycleCollectorChildren.
Shape = 0x05,
Shape = 0x04,
// ObjectGroup details are exposed through JS_TraceObjectGroupCycleCollectorChildren.
ObjectGroup = 0x06,
ObjectGroup = 0x05,
// The kind associated with a nullptr.
Null = 0x07,
Null = 0x06,
// The following kinds do not have an exposed C++ idiom.
BaseShape = 0x0F,
@ -100,7 +97,6 @@ struct MapTypeToTraceKind {
D(Shape, js::Shape, true) \
D(String, JSString, false) \
D(Symbol, JS::Symbol, false) \
IF_BIGINT(D(BigInt, JS::BigInt, false),) \
D(RegExpShared, js::RegExpShared, true)
// Map from all public types to their trace kind.

Просмотреть файл

@ -148,9 +148,6 @@ class JS_PUBLIC_API(CallbackTracer) : public JSTracer
virtual void onObjectEdge(JSObject** objp) { onChild(JS::GCCellPtr(*objp)); }
virtual void onStringEdge(JSString** strp) { onChild(JS::GCCellPtr(*strp)); }
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)); }
virtual void onShapeEdge(js::Shape** shapep) {
onChild(JS::GCCellPtr(*shapep, JS::TraceKind::Shape));
@ -243,9 +240,6 @@ 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); }

Просмотреть файл

@ -41,9 +41,6 @@ namespace JS {
typedef unsigned char Latin1Char;
class Symbol;
#ifdef ENABLE_BIGINT
class BigInt;
#endif
union Value;
class Realm;
struct Runtime;
@ -60,9 +57,6 @@ typedef Handle<JSObject*> HandleObject;
typedef Handle<JSScript*> HandleScript;
typedef Handle<JSString*> HandleString;
typedef Handle<JS::Symbol*> HandleSymbol;
#ifdef ENABLE_BIGINT
typedef Handle<JS::BigInt*> HandleBigInt;
#endif
typedef Handle<Value> HandleValue;
typedef MutableHandle<JSFunction*> MutableHandleFunction;
@ -71,9 +65,6 @@ typedef MutableHandle<JSObject*> MutableHandleObject;
typedef MutableHandle<JSScript*> MutableHandleScript;
typedef MutableHandle<JSString*> MutableHandleString;
typedef MutableHandle<JS::Symbol*> MutableHandleSymbol;
#ifdef ENABLE_BIGINT
typedef MutableHandle<JS::BigInt*> MutableHandleBigInt;
#endif
typedef MutableHandle<Value> MutableHandleValue;
typedef Rooted<JSObject*> RootedObject;
@ -81,9 +72,6 @@ typedef Rooted<JSFunction*> RootedFunction;
typedef Rooted<JSScript*> RootedScript;
typedef Rooted<JSString*> RootedString;
typedef Rooted<JS::Symbol*> RootedSymbol;
#ifdef ENABLE_BIGINT
typedef Rooted<JS::BigInt*> RootedBigInt;
#endif
typedef Rooted<jsid> RootedId;
typedef Rooted<JS::Value> RootedValue;
@ -93,17 +81,8 @@ typedef PersistentRooted<JSObject*> PersistentRootedObject;
typedef PersistentRooted<JSScript*> PersistentRootedScript;
typedef PersistentRooted<JSString*> PersistentRootedString;
typedef PersistentRooted<JS::Symbol*> PersistentRootedSymbol;
#ifdef ENABLE_BIGINT
typedef PersistentRooted<JS::BigInt*> PersistentRootedBigInt;
#endif
typedef PersistentRooted<Value> PersistentRootedValue;
} // namespace JS
#ifdef ENABLE_BIGINT
#define IF_BIGINT(x, y) x
#else
#define IF_BIGINT(x, y) y
#endif
#endif /* js_TypeDecls_h */

Просмотреть файл

@ -1056,24 +1056,6 @@ class JS_PUBLIC_API(Concrete<JS::Symbol>) : TracerConcrete<JS::Symbol> {
static const char16_t concreteTypeName[];
};
#ifdef ENABLE_BIGINT
template<>
class JS_PUBLIC_API(Concrete<JS::BigInt>) : TracerConcrete<JS::BigInt> {
protected:
explicit Concrete(JS::BigInt* ptr) : TracerConcrete(ptr) {}
public:
static void construct(void* storage, JS::BigInt* ptr) {
new (storage) Concrete(ptr);
}
Size size(mozilla::MallocSizeOf mallocSizeOf) const override;
const char16_t* typeName() const override { return concreteTypeName; }
static const char16_t concreteTypeName[];
};
#endif
template<>
class JS_PUBLIC_API(Concrete<JSScript>) : TracerConcreteWithCompartment<JSScript> {
protected:

Просмотреть файл

@ -59,9 +59,6 @@ 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 value. */
@ -85,9 +82,6 @@ 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);
@ -107,9 +101,6 @@ JS_ENUM_HEADER(JSValueTag, uint32_t)
JSVAL_TAG_STRING = JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_STRING,
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);
@ -127,9 +118,6 @@ enum JSValueShiftedTag : uint64_t
JSVAL_SHIFTED_TAG_STRING = (((uint64_t)JSVAL_TAG_STRING) << JSVAL_TAG_SHIFT),
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)
};
@ -273,7 +261,7 @@ CanonicalizeNaN(double d)
*
* - JS::Value has setX() and isX() members for X in
*
* { Int32, Double, String, Symbol, BigInt, Boolean, Undefined, Null, Object, Magic }
* { Int32, Double, String, Symbol, Boolean, Undefined, Null, Object, Magic }
*
* JS::Value also contains toX() for each of the non-singleton types.
*
@ -355,9 +343,6 @@ union MOZ_NON_PARAM 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_;
@ -469,13 +454,6 @@ union MOZ_NON_PARAM 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));
@ -642,12 +620,6 @@ union MOZ_NON_PARAM alignas(8) Value
return toTag() == JSVAL_TAG_SYMBOL;
}
#ifdef ENABLE_BIGINT
bool isBigInt() const {
return toTag() == JSVAL_TAG_BIGINT;
}
#endif
bool isObject() const {
#if defined(JS_NUNBOX32)
return toTag() == JSVAL_TAG_OBJECT;
@ -705,10 +677,6 @@ union MOZ_NON_PARAM alignas(8) Value
"Value type tags must correspond with JS::TraceKinds.");
static_assert((JSVAL_TAG_SYMBOL & 0x03) == size_t(JS::TraceKind::Symbol),
"Value type tags must correspond with JS::TraceKinds.");
#ifdef ENABLE_BIGINT
static_assert((JSVAL_TAG_BIGINT & 0x03) == size_t(JS::TraceKind::BigInt),
"Value type tags must correspond with JS::TraceKinds.");
#endif
static_assert((JSVAL_TAG_OBJECT & 0x03) == size_t(JS::TraceKind::Object),
"Value type tags must correspond with JS::TraceKinds.");
if (MOZ_UNLIKELY(isPrivateGCThing()))
@ -777,17 +745,6 @@ union MOZ_NON_PARAM alignas(8) Value
#endif
}
#ifdef ENABLE_BIGINT
JS::BigInt* toBigInt() const {
MOZ_ASSERT(isBigInt());
#if defined(JS_NUNBOX32)
return s_.payload_.bi_;
#elif defined(JS_PUNBOX64)
return reinterpret_cast<JS::BigInt*>(asBits_ ^ JSVAL_SHIFTED_TAG_BIGINT);
#endif
}
#endif
JSObject& toObject() const {
MOZ_ASSERT(isObject());
#if defined(JS_NUNBOX32)
@ -905,10 +862,6 @@ union MOZ_NON_PARAM alignas(8) Value
"Private GC thing Values must not be strings. Make a StringValue instead.");
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.");
@ -1034,16 +987,6 @@ 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)
{
@ -1299,9 +1242,6 @@ class WrappedPtrOperations<JS::Value, Wrapper>
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); }
@ -1317,9 +1257,6 @@ class WrappedPtrOperations<JS::Value, Wrapper>
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(); }
@ -1357,9 +1294,6 @@ class MutableWrappedPtrOperations<JS::Value, Wrapper> : public WrappedPtrOperati
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); }
@ -1388,9 +1322,6 @@ class HeapBase<JS::Value, Wrapper> : public WrappedPtrOperations<JS::Value, Wrap
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)); }
@ -1447,13 +1378,6 @@ DispatchTyped(F f, const JS::Value& val, Args&&... args)
MOZ_ASSERT(gc::IsCellPointerValid(sym));
return f(sym, mozilla::Forward<Args>(args)...);
}
#ifdef ENABLE_BIGINT
if (val.isBigInt()) {
JS::BigInt* bi = val.toBigInt();
MOZ_ASSERT(gc::IsCellPointerValid(bi));
return f(bi, mozilla::Forward<Args>(args)...);
}
#endif
if (MOZ_UNLIKELY(val.isPrivateGCThing())) {
MOZ_ASSERT(gc::IsCellPointerValid(val.toGCThing()));
return DispatchTyped(f, val.toGCCellPtr(), mozilla::Forward<Args>(args)...);

Просмотреть файл

@ -11,9 +11,6 @@ bindgen = {version = "0.33.1", default-features = false} # disable `logging` to
cmake = "0.1"
glob = "0.2.11"
[[test]]
name = "bigint"
required-features = ["bigint"]
[[test]]
name = "callback"
[[test]]
@ -42,7 +39,6 @@ doctest = false
debugmozjs = ['mozjs_sys/debugmozjs']
promises = ['mozjs_sys/promises']
nonzero = []
bigint = ['mozjs_sys/bigint']
[dependencies.mozjs_sys]
path = "../src"

Просмотреть файл

@ -73,10 +73,6 @@ fn build_jsapi_bindings() {
.clang_arg("-DJS_DEBUG");
}
if cfg!(feature = "bigint") {
builder = builder.clang_arg("-DENABLE_BIGINT");
}
let include_dir = get_mozjs_include_dir();
let include_dir = include_dir.to_str()
.expect("Path to mozjs include dir should be utf-8");
@ -103,10 +99,6 @@ fn build_jsapi_bindings() {
builder = builder.whitelist_function(func);
}
if cfg!(feature = "bigint") {
builder = builder.whitelist_type("JS::BigInt");
}
for ty in OPAQUE_TYPES {
builder = builder.opaque_type(ty);
}

Просмотреть файл

@ -25,8 +25,6 @@ enum ValueTag {
UNDEFINED = JSVAL_TAG_MAX_DOUBLE | (JSValueType::JSVAL_TYPE_UNDEFINED as u32),
STRING = JSVAL_TAG_MAX_DOUBLE | (JSValueType::JSVAL_TYPE_STRING as u32),
SYMBOL = JSVAL_TAG_MAX_DOUBLE | (JSValueType::JSVAL_TYPE_SYMBOL as u32),
#[cfg(feature = "bigint")]
BIGINT = JSVAL_TAG_MAX_DOUBLE | (JSValueType::JSVAL_TYPE_BIGINT as u32),
BOOLEAN = JSVAL_TAG_MAX_DOUBLE | (JSValueType::JSVAL_TYPE_BOOLEAN as u32),
MAGIC = JSVAL_TAG_MAX_DOUBLE | (JSValueType::JSVAL_TYPE_MAGIC as u32),
NULL = JSVAL_TAG_MAX_DOUBLE | (JSValueType::JSVAL_TYPE_NULL as u32),
@ -43,8 +41,6 @@ enum ValueTag {
UNDEFINED = JSVAL_TAG_CLEAR as u32 | (JSValueType::JSVAL_TYPE_UNDEFINED as u32),
STRING = JSVAL_TAG_CLEAR as u32 | (JSValueType::JSVAL_TYPE_STRING as u32),
SYMBOL = JSVAL_TAG_CLEAR as u32 | (JSValueType::JSVAL_TYPE_SYMBOL as u32),
#[cfg(feature = "bigint")]
BIGINT = JSVAL_TAG_CLEAR as u32 | (JSValueType::JSVAL_TYPE_BIGINT as u32),
BOOLEAN = JSVAL_TAG_CLEAR as u32 | (JSValueType::JSVAL_TYPE_BOOLEAN as u32),
MAGIC = JSVAL_TAG_CLEAR as u32 | (JSValueType::JSVAL_TYPE_MAGIC as u32),
NULL = JSVAL_TAG_CLEAR as u32 | (JSValueType::JSVAL_TYPE_NULL as u32),
@ -61,8 +57,6 @@ enum ValueShiftedTag {
UNDEFINED = ((ValueTag::UNDEFINED as u64) << JSVAL_TAG_SHIFT),
STRING = ((ValueTag::STRING as u64) << JSVAL_TAG_SHIFT),
SYMBOL = ((ValueTag::SYMBOL as u64) << JSVAL_TAG_SHIFT),
#[cfg(feature = "bigint")]
BIGINT = ((ValueTag::BIGINT as u64) << JSVAL_TAG_SHIFT),
BOOLEAN = ((ValueTag::BOOLEAN as u64) << JSVAL_TAG_SHIFT),
MAGIC = ((ValueTag::MAGIC as u64) << JSVAL_TAG_SHIFT),
NULL = ((ValueTag::NULL as u64) << JSVAL_TAG_SHIFT),
@ -193,23 +187,6 @@ pub fn PrivateValue(o: *const c_void) -> JS::Value {
BuildJSVal(ValueTag::PRIVATE, ptrBits)
}
#[inline(always)]
#[cfg(feature = "bigint")]
#[cfg(target_pointer_width = "64")]
pub fn BigIntValue(b: &JS::BigInt) -> JS::Value {
let bits = b as *const JS::BigInt as usize as u64;
assert!((bits >> JSVAL_TAG_SHIFT) == 0);
BuildJSVal(ValueTag::BIGINT, bits)
}
#[inline(always)]
#[cfg(target_pointer_width = "32")]
#[inline(always)]
pub fn BigIntValue(s: &JS::BigInt) -> JS::Value {
let bits = s as *const JS::BigInt as usize as u64;
BuildJSVal(ValueTag::BIGINT, bits)
}
impl JS::Value {
#[inline(always)]
unsafe fn asBits(&self) -> u64 {
@ -386,24 +363,6 @@ impl JS::Value {
}
}
#[inline(always)]
#[cfg(feature = "bigint")]
#[cfg(target_pointer_width = "64")]
pub fn is_bigint(&self) -> bool {
unsafe {
(self.asBits() >> JSVAL_TAG_SHIFT) == ValueTag::BIGINT as u64
}
}
#[inline(always)]
#[cfg(feature = "bigint")]
#[cfg(target_pointer_width = "32")]
pub fn is_bigint(&self) -> bool {
unsafe {
(self.asBits() >> 32) == ValueTag::BIGINT as u64
}
}
#[inline(always)]
#[cfg(target_pointer_width = "64")]
pub fn to_boolean(&self) -> bool {

Просмотреть файл

@ -306,12 +306,6 @@ impl RootKind for *mut JS::Symbol {
fn rootKind() -> JS::RootKind { JS::RootKind::Symbol }
}
#[cfg(feature = "bigint")]
impl RootKind for *mut JS::BigInt {
#[inline(always)]
fn rootKind() -> JS::RootKind { JS::RootKind::BigInt }
}
impl RootKind for *mut JSScript {
#[inline(always)]
fn rootKind() -> JS::RootKind { JS::RootKind::Script }

Просмотреть файл

@ -1,48 +0,0 @@
#[macro_use]
extern crate js;
use js::jsapi::root::JS::CompartmentOptions;
use js::jsapi::root::JS_NewGlobalObject;
use js::jsapi::root::JS::OnNewGlobalHookOption;
use js::jsval::UndefinedValue;
use js::rust::{Runtime, SIMPLE_GLOBAL_CLASS};
use std::ptr;
#[test]
fn is_bigint() {
let rt = Runtime::new(false).unwrap();
let cx = rt.cx();
unsafe {
rooted!(in(cx) let global =
JS_NewGlobalObject(cx, &SIMPLE_GLOBAL_CLASS, ptr::null_mut(),
OnNewGlobalHookOption::FireOnNewGlobalHook,
&CompartmentOptions::default())
);
rooted!(in(cx) let mut rval = UndefinedValue());
assert!(rt.evaluate_script(global.handle(), "BigInt(0)",
"test", 1, rval.handle_mut()).is_ok());
assert!(rval.is_bigint());
}
}
#[test]
fn is_not_bigint() {
let rt = Runtime::new(false).unwrap();
let cx = rt.cx();
unsafe {
rooted!(in(cx) let global =
JS_NewGlobalObject(cx, &SIMPLE_GLOBAL_CLASS, ptr::null_mut(),
OnNewGlobalHookOption::FireOnNewGlobalHook,
&CompartmentOptions::default())
);
rooted!(in(cx) let mut rval = UndefinedValue());
assert!(rt.evaluate_script(global.handle(), "'not a BigInt'",
"test", 1, rval.handle_mut()).is_ok());
assert!(!rval.is_bigint());
}
}

Просмотреть файл

@ -8,7 +8,6 @@ build = "build.rs"
[features]
debugmozjs = []
promises = []
bigint = []
[lib]
name = "mozjs_sys"

Просмотреть файл

@ -50,9 +50,6 @@ class PropertyResult;
enum class SymbolCode: uint32_t;
#ifdef ENABLE_BIGINT
class BigInt;
#endif
} // namespace JS
// Do the importing.
@ -121,9 +118,6 @@ 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;
@ -133,9 +127,6 @@ 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;
@ -145,9 +136,6 @@ 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;
@ -157,9 +145,6 @@ using JS::MutableHandleObject;
using JS::MutableHandleScript;
using JS::MutableHandleString;
using JS::MutableHandleSymbol;
#ifdef ENABLE_BIGINT
using JS::MutableHandleBigInt;
#endif
using JS::MutableHandleValue;
using JS::NullHandleValue;
@ -177,9 +162,6 @@ using JS::Zone;
using JS::Symbol;
using JS::SymbolCode;
#ifdef ENABLE_BIGINT
using JS::BigInt;
#endif
} /* namespace js */
#endif /* NamespaceImports_h */

Просмотреть файл

@ -16,9 +16,11 @@ fn main() {
env::set_var("MAKEFLAGS", format!("-j{}", num_cpus::get()));
env::set_current_dir(&js_src).unwrap();
let variant = format!("{}{}",
if cfg!(feature = "bigint") { "bigint" } else { "plain" },
if cfg!(feature = "debugmozjs") { "debug" } else { "" });
let variant = if cfg!(feature = "debugmozjs") {
"plaindebug"
} else {
"plain"
};
let python = env::var("PYTHON").unwrap_or("python2.7".into());
let mut cmd = Command::new(&python);
@ -34,7 +36,7 @@ fn main() {
// already exists but wasn't created by autospider.
"--dep",
"--objdir", &out_dir,
&variant])
variant])
.env("SOURCE", &js_src)
.env("PWD", &js_src)
.stdout(Stdio::inherit())
@ -52,10 +54,6 @@ fn main() {
println!("cargo:rustc-link-search=native={}/dist/bin", out_dir);
println!("cargo:rustc-link-lib=nspr4");
if cfg!(feature = "bigint") {
println!("cargo:rustc-link-lib=gmp");
}
if target.contains("windows") {
println!("cargo:rustc-link-lib=winmm");
if target.contains("gnu") {

Просмотреть файл

@ -34,11 +34,6 @@ if CONFIG['ENABLE_INTL_API']:
'icu',
]
if CONFIG['ENABLE_BIGINT']:
OS_LIBS += [
'gmp',
]
USE_LIBS += [
'nspr',
'zlib',

Просмотреть файл

@ -1270,12 +1270,6 @@ ArrayJoinDenseKernel(JSContext* cx, SeparatorOp sepOp, HandleNativeObject obj, u
* with those as well.
*/
break;
} else if (IF_BIGINT(elem.isBigInt(), false)) {
// 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
// do so yet for reasons of initial-implementation economy.
break;
} else {
MOZ_ASSERT(elem.isMagic(JS_ELEMENTS_HOLE) || elem.isNullOrUndefined());
}

Просмотреть файл

@ -1,211 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* vim: set ts=8 sts=4 et sw=4 tw=99:
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "builtin/BigInt.h"
#include "jsapi.h"
#include "builtin/TypedObject.h"
#include "gc/Tracer.h"
#include "js/TracingAPI.h"
#include "vm/ArrayBufferObject.h"
#include "vm/BigIntType.h"
#include "vm/SelfHosting.h"
#include "vm/TaggedProto.h"
#include "vm/JSObject-inl.h"
using namespace js;
static MOZ_ALWAYS_INLINE bool
IsBigInt(HandleValue v)
{
return v.isBigInt() || (v.isObject() && v.toObject().is<BigIntObject>());
}
static JSObject*
CreateBigIntPrototype(JSContext* cx, JSProtoKey key)
{
return GlobalObject::createBlankPrototype<PlainObject>(cx, cx->global());
}
// BigInt proposal section 5.1.3
static bool
BigIntConstructor(JSContext* cx, unsigned argc, Value* vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
// Step 1.
if (args.isConstructing()) {
JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_NOT_CONSTRUCTOR, "BigInt");
return false;
}
// Step 2.
RootedValue v(cx, args.get(0));
if (!ToPrimitive(cx, JSTYPE_NUMBER, &v))
return false;
// Steps 3-4.
BigInt* bi = v.isNumber()
? NumberToBigInt(cx, v.toNumber())
: ToBigInt(cx, v);
if (!bi)
return false;
args.rval().setBigInt(bi);
return true;
}
JSObject*
BigIntObject::create(JSContext* cx, HandleBigInt bigInt)
{
RootedObject obj(cx, NewBuiltinClassInstance(cx, &class_));
if (!obj)
return nullptr;
BigIntObject& bn = obj->as<BigIntObject>();
bn.setFixedSlot(PRIMITIVE_VALUE_SLOT, BigIntValue(bigInt));
return &bn;
}
BigInt*
BigIntObject::unbox() const
{
return getFixedSlot(PRIMITIVE_VALUE_SLOT).toBigInt();
}
bool
js::intrinsic_ToBigInt(JSContext* cx, unsigned argc, Value* vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
MOZ_ASSERT(args.length() == 1);
BigInt* result = ToBigInt(cx, args[0]);
if (!result)
return false;
args.rval().setBigInt(result);
return true;
}
// BigInt proposal section 5.3.4
bool
BigIntObject::valueOf_impl(JSContext* cx, const CallArgs& args)
{
// Step 1.
HandleValue thisv = args.thisv();
MOZ_ASSERT(IsBigInt(thisv));
RootedBigInt bi(cx, thisv.isBigInt()
? thisv.toBigInt()
: thisv.toObject().as<BigIntObject>().unbox());
args.rval().setBigInt(bi);
return true;
}
bool
BigIntObject::valueOf(JSContext* cx, unsigned argc, Value* vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod<IsBigInt, valueOf_impl>(cx, args);
}
// BigInt proposal section 5.3.3
bool
BigIntObject::toString_impl(JSContext* cx, const CallArgs& args)
{
// Step 1.
HandleValue thisv = args.thisv();
MOZ_ASSERT(IsBigInt(thisv));
RootedBigInt bi(cx, thisv.isBigInt()
? thisv.toBigInt()
: thisv.toObject().as<BigIntObject>().unbox());
// Steps 2-3.
uint8_t radix = 10;
// Steps 4-5.
if (args.hasDefined(0)) {
double d;
if (!ToInteger(cx, args[0], &d))
return false;
if (d < 2 || d > 36) {
JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_BAD_RADIX);
return false;
}
radix = d;
}
// Steps 6-7.
JSLinearString* str = BigInt::toString(cx, bi, radix);
if (!str)
return false;
args.rval().setString(str);
return true;
}
bool
BigIntObject::toString(JSContext* cx, unsigned argc, Value* vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod<IsBigInt, toString_impl>(cx, args);
}
// BigInt proposal section 5.3.2. "This function is
// implementation-dependent, and it is permissible, but not encouraged,
// for it to return the same thing as toString."
bool
BigIntObject::toLocaleString_impl(JSContext* cx, const CallArgs& args)
{
HandleValue thisv = args.thisv();
MOZ_ASSERT(IsBigInt(thisv));
RootedBigInt bi(cx, thisv.isBigInt()
? thisv.toBigInt()
: thisv.toObject().as<BigIntObject>().unbox());
RootedString str(cx, BigInt::toString(cx, bi, 10));
if (!str)
return false;
args.rval().setString(str);
return true;
}
bool
BigIntObject::toLocaleString(JSContext* cx, unsigned argc, Value* vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod<IsBigInt, toLocaleString_impl>(cx, args);
}
const ClassSpec BigIntObject::classSpec_ = {
GenericCreateConstructor<BigIntConstructor, 1, gc::AllocKind::FUNCTION>,
CreateBigIntPrototype,
nullptr,
nullptr,
BigIntObject::methods,
BigIntObject::properties
};
const Class BigIntObject::class_ = {
"BigInt",
JSCLASS_HAS_CACHED_PROTO(JSProto_BigInt) |
JSCLASS_HAS_RESERVED_SLOTS(RESERVED_SLOTS),
JS_NULL_CLASS_OPS,
&BigIntObject::classSpec_
};
const JSPropertySpec BigIntObject::properties[] = {
// BigInt proposal section 5.3.5
JS_STRING_SYM_PS(toStringTag, "BigInt", JSPROP_READONLY),
JS_PS_END
};
const JSFunctionSpec BigIntObject::methods[] = {
JS_FN("valueOf", valueOf, 0, 0),
JS_FN("toString", toString, 0, 0),
JS_FN("toLocaleString", toLocaleString, 0, 0),
JS_FS_END
};

Просмотреть файл

@ -1,53 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* vim: set ts=8 sts=4 et sw=4 tw=99:
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef builtin_BigInt_h
#define builtin_BigInt_h
#include "js/Class.h"
#include "js/RootingAPI.h"
#include "vm/BigIntType.h"
#include "vm/NativeObject.h"
namespace js {
class GlobalObject;
class BigIntObject : public NativeObject
{
static const unsigned PRIMITIVE_VALUE_SLOT = 0;
static const unsigned RESERVED_SLOTS = 1;
public:
static const ClassSpec classSpec_;
static const Class class_;
static JSObject* create(JSContext* cx, JS::Handle<JS::BigInt*> bi);
// Methods defined on BigInt.prototype.
static bool valueOf_impl(JSContext* cx, const CallArgs& args);
static bool valueOf(JSContext* cx, unsigned argc, JS::Value* vp);
static bool toString_impl(JSContext* cx, const CallArgs& args);
static bool toString(JSContext* cx, unsigned argc, JS::Value* vp);
static bool toLocaleString_impl(JSContext* cx, const CallArgs& args);
static bool toLocaleString(JSContext* cx, unsigned argc, JS::Value* vp);
JS::BigInt* unbox() const;
private:
static const JSPropertySpec properties[];
static const JSFunctionSpec methods[];
};
extern JSObject*
InitBigIntClass(JSContext* cx, Handle<GlobalObject*> global);
extern bool
intrinsic_ToBigInt(JSContext* cx, unsigned argc, JS::Value* vp);
} // namespace js
#endif

Просмотреть файл

@ -15,9 +15,6 @@
#include "jit/InlinableNatives.h"
#include "util/StringBuffer.h"
#ifdef ENABLE_BIGINT
#include "vm/BigIntType.h"
#endif
#include "vm/GlobalObject.h"
#include "vm/JSAtom.h"
#include "vm/JSContext.h"
@ -167,10 +164,6 @@ js::ToBooleanSlow(HandleValue v)
{
if (v.isString())
return v.toString()->length() != 0;
#ifdef ENABLE_BIGINT
if (v.isBigInt())
return v.toBigInt()->toBoolean();
#endif
MOZ_ASSERT(v.isObject());
return !EmulatesUndefined(&v.toObject());

Просмотреть файл

@ -15,9 +15,6 @@
#include "jsutil.h"
#include "builtin/Array.h"
#ifdef ENABLE_BIGINT
#include "builtin/BigInt.h"
#endif
#include "builtin/String.h"
#include "util/StringBuffer.h"
#include "vm/Interpreter.h"
@ -294,11 +291,6 @@ PreprocessValue(JSContext* cx, HandleObject holder, KeyType key, MutableHandleVa
if (!Unbox(cx, obj, vp))
return false;
}
#ifdef ENABLE_BIGINT
else if (cls == ESClass::BigInt) {
vp.setBigInt(obj->as<BigIntObject>().unbox());
}
#endif
}
return true;
@ -595,14 +587,6 @@ 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());
RootedObject obj(cx, &v.toObject());

Просмотреть файл

@ -57,8 +57,7 @@ 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.isString() || value.isSymbol() || value.isObject());
return true;
}
@ -78,10 +77,6 @@ HashValue(const Value& v, const mozilla::HashCodeScrambler& hcs)
return v.toString()->asAtom().hash();
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,24 +96,12 @@ 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.
if (!b && (value.isBigInt() && other.value.isBigInt())) {
JSContext* cx = TlsContext.get();
RootedValue valueRoot(cx, value);
RootedValue otherRoot(cx, other.value);
SameValue(cx, valueRoot, otherRoot, &b);
}
#endif
#ifdef DEBUG
bool same;
JSContext* cx = TlsContext.get();
RootedValue valueRoot(cx, value);
RootedValue otherRoot(cx, other.value);
MOZ_ASSERT(SameValue(cx, valueRoot, otherRoot, &same));
MOZ_ASSERT(SameValue(nullptr, valueRoot, otherRoot, &same));
MOZ_ASSERT(same == b);
#endif
return b;

Просмотреть файл

@ -8,9 +8,6 @@
#include "mozilla/MaybeOneOf.h"
#ifdef ENABLE_BIGINT
#include "builtin/BigInt.h"
#endif
#include "builtin/Eval.h"
#include "builtin/SelfHostingDefines.h"
#include "builtin/String.h"
@ -474,11 +471,6 @@ GetBuiltinTagSlow(JSContext* cx, HandleObject obj, MutableHandleString builtinTa
case ESClass::RegExp:
builtinTag.set(cx->names().objectRegExp);
return true;
#ifdef ENABLE_BIGINT
case ESClass::BigInt:
builtinTag.set(cx->names().objectBigInt);
return true;
#endif
default:
if (obj->isCallable()) {
// Non-standard: Prevent <object> from showing up as Function.
@ -538,11 +530,6 @@ GetBuiltinTagFast(JSObject* obj, const Class* clasp, JSContext* cx)
return cx->names().objectFunction;
}
#ifdef ENABLE_BIGINT
if (obj->is<BigIntObject>())
return cx->names().objectBigInt;
#endif
return nullptr;
}

Просмотреть файл

@ -1,7 +0,0 @@
{
"configure-args": "--enable-bigint",
"optimize": true,
"env": {
"JSTESTS_EXTRA_ARGS": "--jitflags=all"
}
}

Просмотреть файл

@ -1,7 +0,0 @@
{
"configure-args": "--enable-bigint",
"debug": true,
"env": {
"JSTESTS_EXTRA_ARGS": "--jitflags=debug"
}
}

Просмотреть файл

@ -64,7 +64,6 @@ namespace gc {
D(FAT_INLINE_ATOM, String, js::FatInlineAtom, js::FatInlineAtom, true, false) \
D(ATOM, String, js::NormalAtom, js::NormalAtom, true, false) \
D(SYMBOL, Symbol, JS::Symbol, JS::Symbol, true, false) \
IF_BIGINT(D(BIGINT, BigInt, JS::BigInt, JS::BigInt, true, false),) \
D(JITCODE, JitCode, js::jit::JitCode, js::jit::JitCode, false, false) \
D(SCOPE, Scope, js::Scope, js::Scope, true, false) \
D(REGEXP_SHARED, RegExpShared, js::RegExpShared, js::RegExpShared, true, false)

Просмотреть файл

@ -190,10 +190,7 @@ 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());
}
void
@ -275,10 +272,7 @@ AtomMarkingRuntime::valueIsMarked(Zone* zone, const Value& value)
if (value.isSymbol())
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());
return true;
}

Просмотреть файл

@ -8,9 +8,6 @@
#define gc_DeletePolicy_h
#include "js/TracingAPI.h"
#ifdef ENABLE_BIGINT
#include "vm/BigIntType.h"
#endif
namespace js {
namespace gc {
@ -29,9 +26,6 @@ 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;

Просмотреть файл

@ -224,9 +224,6 @@
#include "js/SliceBudget.h"
#include "proxy/DeadObjectProxy.h"
#include "util/Windows.h"
#ifdef ENABLE_BIGINT
#include "vm/BigIntType.h"
#endif
#include "vm/Debugger.h"
#include "vm/GeckoProfiler.h"
#include "vm/JSAtom.h"
@ -498,10 +495,7 @@ static const FinalizePhase BackgroundFinalizePhases[] = {
AllocKind::EXTERNAL_STRING,
AllocKind::FAT_INLINE_ATOM,
AllocKind::ATOM,
AllocKind::SYMBOL,
#ifdef ENABLE_BIGINT
AllocKind::BIGINT
#endif
AllocKind::SYMBOL
}
},
{
@ -8436,10 +8430,6 @@ JS::GCCellPtr::GCCellPtr(const Value& v)
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
@ -9149,9 +9139,6 @@ js::gc::ClearEdgesTracer::clearEdge(S** thingp)
void js::gc::ClearEdgesTracer::onObjectEdge(JSObject** objp) { clearEdge(objp); }
void js::gc::ClearEdgesTracer::onStringEdge(JSString** strp) { clearEdge(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); }
void js::gc::ClearEdgesTracer::onShapeEdge(js::Shape** shapep) { clearEdge(shapep); }
void js::gc::ClearEdgesTracer::onObjectGroupEdge(js::ObjectGroup** groupp) { clearEdge(groupp); }

Просмотреть файл

@ -11,10 +11,6 @@
#include "gc/RelocationOverlay.h"
#ifdef ENABLE_BIGINT
#include "vm/BigIntType.h"
#endif
namespace js {
namespace gc {

Просмотреть файл

@ -21,9 +21,6 @@
#include "js/SliceBudget.h"
#include "vm/ArgumentsObject.h"
#include "vm/ArrayObject.h"
#ifdef ENABLE_BIGINT
#include "vm/BigIntType.h"
#endif
#include "vm/Debugger.h"
#include "vm/EnvironmentObject.h"
#include "vm/RegExpObject.h"
@ -897,9 +894,6 @@ js::GCMarker::markAndTraceChildren(T* thing)
namespace js {
template <> void GCMarker::traverse(BaseShape* thing) { markAndTraceChildren(thing); }
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); }
} // namespace js
@ -1553,14 +1547,6 @@ js::GCMarker::lazilyMarkChildren(ObjectGroup* group)
traverseEdge(group, static_cast<JSObject*>(fun));
}
#ifdef ENABLE_BIGINT
void
JS::BigInt::traceChildren(JSTracer* trc)
{
return;
}
#endif
struct TraverseObjectFunctor
{
template <typename T>
@ -1705,8 +1691,7 @@ ObjectDenseElementsMayBeMarkable(NativeObject* nobj)
return true;
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_STRING | TYPE_FLAG_SYMBOL | TYPE_FLAG_LAZYARGS | TYPE_FLAG_ANYOBJECT;
bool mayBeMarkable = typeSet->hasAnyFlag(flagMask) || typeSet->getObjectCount() != 0;
#ifdef DEBUG
@ -1820,13 +1805,7 @@ GCMarker::processMarkStackTop(SliceBudget& budget)
}
} else if (v.isSymbol()) {
traverseEdge(obj, v.toSymbol());
}
#ifdef ENABLE_BIGINT
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()));

Просмотреть файл

@ -109,9 +109,6 @@ struct RewrapTaggedPointer{};
DECLARE_REWRAP(JS::Value, JSObject, JS::ObjectOrNullValue, );
DECLARE_REWRAP(JS::Value, JSString, JS::StringValue, );
DECLARE_REWRAP(JS::Value, JS::Symbol, JS::SymbolValue, );
#ifdef ENABLE_BIGINT
DECLARE_REWRAP(JS::Value, JS::BigInt, JS::BigIntValue, );
#endif
DECLARE_REWRAP(jsid, JSString, NON_INTEGER_ATOM_TO_JSID, (JSAtom*));
DECLARE_REWRAP(jsid, JS::Symbol, SYMBOL_TO_JSID, );
DECLARE_REWRAP(js::TaggedProto, JSObject, js::TaggedProto, );
@ -122,11 +119,7 @@ struct IsPrivateGCThingInValue
: public mozilla::EnableIf<mozilla::IsBaseOf<Cell, T>::value &&
!mozilla::IsBaseOf<JSObject, T>::value &&
!mozilla::IsBaseOf<JSString, T>::value &&
!mozilla::IsBaseOf<JS::Symbol, T>::value
#ifdef ENABLE_BIGINT
&& !mozilla::IsBaseOf<JS::BigInt, T>::value
#endif
, T>
!mozilla::IsBaseOf<JS::Symbol, T>::value, T>
{
static_assert(!mozilla::IsSame<Cell, T>::value && !mozilla::IsSame<TenuredCell, T>::value,
"T must not be Cell or TenuredCell");

Просмотреть файл

@ -16,9 +16,6 @@
#include "gc/PublicIterators.h"
#include "gc/Zone.h"
#include "util/Text.h"
#ifdef ENABLE_BIGINT
#include "vm/BigIntType.h"
#endif
#include "vm/JSFunction.h"
#include "vm/JSScript.h"
#include "vm/Shape.h"
@ -399,12 +396,6 @@ JS_GetTraceThingInfo(char* buf, size_t bufsize, JSTracer* trc, void* thing,
name = "symbol";
break;
#ifdef ENABLE_BIGINT
case JS::TraceKind::BigInt:
name = "BigInt";
break;
#endif
default:
name = "INVALID";
break;

Просмотреть файл

@ -69,13 +69,6 @@ def assert_subprinter_registered(printer, subprinter):
"'info pretty-printer' says:\n"
"%s" % (printer, subprinter, output))
enable_bigint = False
try:
if gdb.lookup_type('JS::BigInt'):
enable_bigint = True
except:
pass
# Request full stack traces for Python errors.
gdb.execute('set python print-stack full')

Просмотреть файл

@ -146,15 +146,6 @@ class JSValueTypeCache(object):
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:
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'))
@ -207,8 +198,6 @@ class JSValue(object):
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:
return '$JS::BigIntValue()'
else:
value = 'unrecognized!'
return '$JS::Value(%s)' % (value,)

Просмотреть файл

@ -1,10 +1,6 @@
#include "gdb-tests.h"
#include "jsapi.h"
#ifdef ENABLE_BIGINT
#include "vm/BigIntType.h"
#endif
FRAGMENT(jsval, simple) {
using namespace JS;
@ -22,9 +18,6 @@ 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::create(cx)));
#endif
RootedValue global(cx);
global.setObject(*CurrentGlobalOrNull(cx));
@ -45,8 +38,5 @@ FRAGMENT(jsval, simple) {
use(empty_string);
use(friendly_string);
use(symbol);
#ifdef ENABLE_BIGINT
use(bi);
#endif
use(global);
}

Просмотреть файл

@ -15,7 +15,5 @@ assert_pretty('elements_hole', '$JS::MagicValue(JS_ELEMENTS_HOLE)')
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('global', '$JS::Value((JSObject *) [object global] delegate)')
assert_pretty('onehundredthirtysevenonehundredtwentyeighths', '$JS::DoubleValue(1.0703125)')

Просмотреть файл

@ -646,12 +646,3 @@ MSG_DEF(JSMSG_BAD_RESPONSE_MIME_TYPE, 0, JSEXN_TYPEERR, "Res
MSG_DEF(JSMSG_BAD_RESPONSE_CORS_SAME_ORIGIN, 0, JSEXN_TYPEERR, "Response.type must be 'basic', 'cors' or 'default'")
MSG_DEF(JSMSG_BAD_RESPONSE_STATUS, 0, JSEXN_TYPEERR, "Response does not have ok status")
MSG_DEF(JSMSG_RESPONSE_ALREADY_CONSUMED, 0, JSEXN_TYPEERR, "Response already consumed")
// BigInt
MSG_DEF(JSMSG_BIGINT_TO_NUMBER, 0, JSEXN_TYPEERR, "can't convert BigInt to number")
MSG_DEF(JSMSG_NUMBER_TO_BIGINT, 0, JSEXN_RANGEERR, "can't convert non-finite number to BigInt")
MSG_DEF(JSMSG_BIGINT_DIVISION_BY_ZERO, 0, JSEXN_RANGEERR, "BigInt division by zero")
MSG_DEF(JSMSG_BIGINT_NEGATIVE_EXPONENT, 0, JSEXN_RANGEERR, "BigInt negative exponent")
MSG_DEF(JSMSG_BIGINT_INVALID_SYNTAX, 0, JSEXN_SYNTAXERR, "invalid BigInt syntax")
MSG_DEF(JSMSG_NOT_BIGINT, 0, JSEXN_TYPEERR, "not a BigInt")
MSG_DEF(JSMSG_BIGINT_NOT_SERIALIZABLE, 0, JSEXN_TYPEERR, "BigInt value can't be serialized in JSON")

Просмотреть файл

@ -11,9 +11,6 @@
#include <stdint.h>
#ifdef ENABLE_BIGINT
#include "builtin/BigInt.h"
#endif
#include "builtin/Promise.h"
#include "builtin/TestingFunctions.h"
#include "gc/GCInternals.h"
@ -314,10 +311,6 @@ js::GetBuiltinClass(JSContext* cx, HandleObject obj, ESClass* cls)
*cls = ESClass::Arguments;
else if (obj->is<ErrorObject>())
*cls = ESClass::Error;
#ifdef ENABLE_BIGINT
else if (obj->is<BigIntObject>())
*cls = ESClass::BigInt;
#endif
else
*cls = ESClass::Other;

Просмотреть файл

@ -1591,21 +1591,9 @@ js::ToNumberSlow(JSContext* cx, HandleValue v_, double* out)
return false;
}
if (v.isUndefined()) {
*out = GenericNaN();
return true;
}
MOZ_ASSERT(v.isSymbol() || IF_BIGINT(v.isBigInt(), false));
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;
MOZ_ASSERT(v.isUndefined());
*out = GenericNaN();
return true;
}
/*

Просмотреть файл

@ -49,9 +49,6 @@ enum JSType {
JSTYPE_BOOLEAN, /* boolean */
JSTYPE_NULL, /* null */
JSTYPE_SYMBOL, /* symbol */
#ifdef ENABLE_BIGINT
JSTYPE_BIGINT, /* BigInt */
#endif
JSTYPE_LIMIT
};

Просмотреть файл

@ -458,12 +458,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',

Просмотреть файл

@ -164,14 +164,6 @@ js::ValueToStringBufferSlow(JSContext* cx, const Value& arg, StringBuffer& sb)
JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_SYMBOL_TO_STRING);
return false;
}
#ifdef ENABLE_BIGINT
if (v.isBigInt()) {
JSLinearString* str = BigInt::toString(cx, v.toBigInt(), 10);
if (!str)
return false;
return sb.append(str);
}
#endif
MOZ_ASSERT(v.isUndefined());
return sb.append(cx->names().undefined);
}

Просмотреть файл

@ -1,231 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* vim: set ts=8 sts=4 et sw=4 tw=99:
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "vm/BigIntType.h"
#include "mozilla/FloatingPoint.h"
#include "mozilla/HashFunctions.h"
#include <gmp.h>
#include <math.h>
#include "jsapi.h"
#include "builtin/BigInt.h"
#include "gc/Allocator.h"
#include "gc/Tracer.h"
#include "js/Initialization.h"
#include "js/Utility.h"
#include "vm/JSContext.h"
#include "vm/SelfHosting.h"
using namespace js;
// The following functions are wrappers for use with
// mp_set_memory_functions. GMP passes extra arguments to the realloc
// and free functions not needed by the JS allocation interface.
// js_malloc has the signature expected for GMP's malloc function, so no
// wrapper is required.
static void*
js_mp_realloc(void* ptr, size_t old_size, size_t new_size)
{
return js_realloc(ptr, new_size);
}
static void
js_mp_free(void* ptr, size_t size)
{
return js_free(ptr);
}
static bool memoryFunctionsInitialized = false;
JS_PUBLIC_API(void)
JS::SetGMPMemoryFunctions(JS::GMPAllocFn allocFn,
JS::GMPReallocFn reallocFn,
JS::GMPFreeFn freeFn)
{
MOZ_ASSERT(JS::detail::libraryInitState == JS::detail::InitState::Uninitialized);
memoryFunctionsInitialized = true;
mp_set_memory_functions(allocFn, reallocFn, freeFn);
}
void
BigInt::init()
{
// Don't override custom allocation functions if
// JS::SetGMPMemoryFunctions was called.
if (!memoryFunctionsInitialized) {
memoryFunctionsInitialized = true;
mp_set_memory_functions(js_malloc, js_mp_realloc, js_mp_free);
}
}
BigInt*
BigInt::create(JSContext* cx)
{
BigInt* x = Allocate<BigInt>(cx);
if (!x)
return nullptr;
mpz_init(x->num_); // to zero
return x;
}
BigInt*
BigInt::createFromDouble(JSContext* cx, double d)
{
BigInt* x = Allocate<BigInt>(cx);
if (!x)
return nullptr;
mpz_init_set_d(x->num_, d);
return x;
}
BigInt*
BigInt::createFromBoolean(JSContext* cx, bool b)
{
BigInt* x = Allocate<BigInt>(cx);
if (!x)
return nullptr;
mpz_init_set_ui(x->num_, b);
return x;
}
// BigInt proposal section 5.1.1
static bool
IsInteger(double d)
{
// Step 1 is an assertion checked by the caller.
// Step 2.
if (!mozilla::IsFinite(d))
return false;
// Step 3.
double i = JS::ToInteger(d);
// Step 4.
if (i != d)
return false;
// Step 5.
return true;
}
// BigInt proposal section 5.1.2
BigInt*
js::NumberToBigInt(JSContext* cx, double d)
{
// Step 1 is an assertion checked by the caller.
// Step 2.
if (!IsInteger(d)) {
JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr,
JSMSG_NUMBER_TO_BIGINT);
return nullptr;
}
// Step 3.
return BigInt::createFromDouble(cx, d);
}
BigInt*
BigInt::copy(JSContext* cx, HandleBigInt x)
{
BigInt* bi = Allocate<BigInt>(cx);
if (!bi)
return nullptr;
mpz_init_set(bi->num_, x->num_);
return bi;
}
// BigInt proposal section 7.3
BigInt*
js::ToBigInt(JSContext* cx, HandleValue val)
{
RootedValue v(cx, val);
// Step 1.
if (!ToPrimitive(cx, JSTYPE_NUMBER, &v))
return nullptr;
// Step 2.
// String conversions are not yet supported.
if (v.isBigInt())
return v.toBigInt();
if (v.isBoolean())
return BigInt::createFromBoolean(cx, v.toBoolean());
JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_NOT_BIGINT);
return nullptr;
}
JSLinearString*
BigInt::toString(JSContext* cx, BigInt* x, uint8_t radix)
{
MOZ_ASSERT(2 <= radix && radix <= 36);
// We need two extra chars for '\0' and potentially '-'.
size_t strSize = mpz_sizeinbase(x->num_, 10) + 2;
UniqueChars str(static_cast<char*>(js_malloc(strSize)));
if (!str) {
ReportOutOfMemory(cx);
return nullptr;
}
mpz_get_str(str.get(), radix, x->num_);
return NewStringCopyZ<CanGC>(cx, str.get());
}
void
BigInt::finalize(js::FreeOp* fop)
{
mpz_clear(num_);
}
JSAtom*
js::BigIntToAtom(JSContext* cx, BigInt* bi)
{
JSString* str = BigInt::toString(cx, bi, 10);
if (!str)
return nullptr;
return AtomizeString(cx, str);
}
bool
BigInt::toBoolean()
{
return mpz_sgn(num_) != 0;
}
js::HashNumber
BigInt::hash()
{
const mp_limb_t* limbs = mpz_limbs_read(num_);
size_t limbCount = mpz_size(num_);
uint32_t hash = mozilla::HashBytes(limbs, limbCount * sizeof(mp_limb_t));
hash = mozilla::AddToHash(hash, mpz_sgn(num_));
return hash;
}
size_t
BigInt::sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const
{
// Use the total number of limbs allocated when calculating the size
// (_mp_alloc), not the number of limbs currently in use (_mp_size).
// See the Info node `(gmp)Integer Internals` for details.
mpz_srcptr n = static_cast<mpz_srcptr>(num_);
return sizeof(*n) + sizeof(mp_limb_t) * n->_mp_alloc;
}
JS::ubi::Node::Size
JS::ubi::Concrete<BigInt>::size(mozilla::MallocSizeOf mallocSizeOf) const
{
BigInt& bi = get();
MOZ_ASSERT(bi.isTenured());
size_t size = js::gc::Arena::thingSize(bi.asTenured().getAllocKind());
size += bi.sizeOfExcludingThis(mallocSizeOf);
return size;
}

Просмотреть файл

@ -1,78 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* vim: set ts=8 sts=4 et sw=4 tw=99:
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef vm_BigIntType_h
#define vm_BigIntType_h
#include <gmp.h>
#include "gc/Barrier.h"
#include "gc/GC.h"
#include "gc/Heap.h"
#include "js/AllocPolicy.h"
#include "js/GCHashTable.h"
#include "js/RootingAPI.h"
#include "js/TypeDecls.h"
#include "vm/StringType.h"
namespace JS {
class BigInt final : public js::gc::TenuredCell
{
private:
// The minimum allocation size is currently 16 bytes (see
// SortedArenaList in gc/ArenaList.h).
union {
mpz_t num_;
uint8_t unused_[js::gc::MinCellSize];
};
public:
// Allocate and initialize a BigInt value
static BigInt* create(JSContext* cx);
static BigInt* createFromDouble(JSContext* cx, double d);
static BigInt* createFromBoolean(JSContext* cx, bool b);
static const JS::TraceKind TraceKind = JS::TraceKind::BigInt;
void traceChildren(JSTracer* trc);
void finalize(js::FreeOp* fop);
js::HashNumber hash();
size_t sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const;
bool toBoolean();
static void init();
static BigInt* copy(JSContext* cx, Handle<BigInt*> x);
static JSLinearString* toString(JSContext* cx, BigInt* x, uint8_t radix);
};
static_assert(sizeof(BigInt) >= js::gc::MinCellSize,
"sizeof(BigInt) must be greater than the minimum allocation size");
} // namespace JS
namespace js {
extern JSAtom*
BigIntToAtom(JSContext* cx, JS::BigInt* bi);
extern JS::BigInt*
NumberToBigInt(JSContext* cx, double d);
extern JS::BigInt*
ToBigInt(JSContext* cx, JS::Handle<JS::Value> v);
} // namespace js
#endif

Просмотреть файл

@ -260,7 +260,6 @@
macro(numeric, numeric, "numeric") \
macro(objectArguments, objectArguments, "[object Arguments]") \
macro(objectArray, objectArray, "[object Array]") \
macro(objectBigInt, objectBigInt, "[object BigInt]") \
macro(objectBoolean, objectBoolean, "[object Boolean]") \
macro(objectDate, objectDate, "[object Date]") \
macro(objectError, objectError, "[object Error]") \
@ -462,7 +461,6 @@
macro(boolean, boolean, "boolean") \
macro(null, null, "null") \
macro(symbol, symbol, "symbol") \
macro(bigint, bigint, "bigint") \
macro(defineDataPropertyIntrinsic, defineDataPropertyIntrinsic, "_DefineDataProperty")
macro(defineDataPropertyIntrinsic, defineDataPropertyIntrinsic, "_DefineDataProperty") \
#endif /* vm_CommonPropertyNames_h */

Просмотреть файл

@ -11,9 +11,6 @@
#include "jsfriendapi.h"
#include "builtin/AtomicsObject.h"
#ifdef ENABLE_BIGINT
#include "builtin/BigInt.h"
#endif
#include "builtin/DataViewObject.h"
#include "builtin/Eval.h"
#include "builtin/MapObject.h"

Просмотреть файл

@ -25,9 +25,6 @@
#include "unicode/uclean.h"
#include "unicode/utypes.h"
#endif // ENABLE_INTL_API
#ifdef ENABLE_BIGINT
#include "vm/BigIntType.h"
#endif
#include "vm/DateTime.h"
#include "vm/HelperThreads.h"
#include "vm/Runtime.h"
@ -80,7 +77,7 @@ JS::detail::InitWithFailureDiagnostic(bool isDebugBuild)
MOZ_ASSERT(libraryInitState == InitState::Uninitialized,
"must call JS_Init once before any JSAPI operation except "
"JS_SetICUMemoryFunctions or JS::SetGMPMemoryFunctions");
"JS_SetICUMemoryFunctions");
MOZ_ASSERT(!JSRuntime::hasLiveRuntimes(),
"how do we have live runtimes before JS_Init?");
@ -137,10 +134,6 @@ JS::detail::InitWithFailureDiagnostic(bool isDebugBuild)
RETURN_IF_FAIL(js::jit::SimulatorProcess::initialize());
#endif
#ifdef ENABLE_BIGINT
JS::BigInt::init();
#endif
libraryInitState = InitState::Running;
return nullptr;
}

Просмотреть файл

@ -31,9 +31,6 @@
#include "util/StringBuffer.h"
#include "vm/AsyncFunction.h"
#include "vm/AsyncIteration.h"
#ifdef ENABLE_BIGINT
#include "vm/BigIntType.h"
#endif
#include "vm/BytecodeUtil.h"
#include "vm/Debugger.h"
#include "vm/GeneratorObject.h"
@ -971,10 +968,6 @@ js::TypeOfValue(const Value& v)
return TypeOfObject(&v.toObject());
if (v.isBoolean())
return JSTYPE_BOOLEAN;
#ifdef ENABLE_BIGINT
if (v.isBigInt())
return JSTYPE_BIGINT;
#endif
MOZ_ASSERT(v.isSymbol());
return JSTYPE_SYMBOL;
}
@ -4377,10 +4370,7 @@ js::GetProperty(JSContext* cx, HandleValue v, HandlePropertyName name, MutableHa
// 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()) {
NativeObject* proto;
if (v.isNumber()) {
proto = GlobalObject::getOrCreateNumberPrototype(cx, cx->global());

Просмотреть файл

@ -636,14 +636,6 @@ ToAtomSlow(JSContext* cx, typename MaybeRooted<Value, allowGC>::HandleType arg)
}
return nullptr;
}
#ifdef ENABLE_BIGINT
if (v.isBigInt()) {
JSAtom* atom = BigIntToAtom(cx, v.toBigInt());
if (!allowGC && !atom)
cx->recoverFromOutOfMemory();
return atom;
}
#endif
MOZ_ASSERT(v.isUndefined());
return cx->names().undefined;
}

Просмотреть файл

@ -115,16 +115,6 @@ JSCompartment::wrap(JSContext* cx, JS::MutableHandleValue vp)
return true;
}
#ifdef ENABLE_BIGINT
if (vp.isBigInt()) {
JS::RootedBigInt bi(cx, vp.toBigInt());
if (!wrap(cx, &bi))
return false;
vp.setBigInt(bi);
return true;
}
#endif
MOZ_ASSERT(vp.isObject());
/*

Просмотреть файл

@ -351,23 +351,6 @@ JSCompartment::wrap(JSContext* cx, MutableHandleString strp)
return true;
}
#ifdef ENABLE_BIGINT
bool
JSCompartment::wrap(JSContext* cx, MutableHandleBigInt bi)
{
MOZ_ASSERT(cx->compartment() == this);
if (bi->zone() == cx->zone())
return true;
BigInt* copy = BigInt::copy(cx, bi);
if (!copy)
return false;
bi.set(copy);
return true;
}
#endif
bool
JSCompartment::getNonWrapperObjectForCurrentCompartment(JSContext* cx, MutableHandleObject obj)
{

Просмотреть файл

@ -861,9 +861,6 @@ struct JSCompartment
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<JS::BigInt*> bi);
#endif
MOZ_MUST_USE bool wrap(JSContext* cx, JS::MutableHandleObject obj);
MOZ_MUST_USE bool wrap(JSContext* cx, JS::MutableHandle<js::PropertyDescriptor> desc);
MOZ_MUST_USE bool wrap(JSContext* cx, JS::MutableHandle<JS::GCVector<JS::Value>> vec);

Просмотреть файл

@ -25,9 +25,6 @@
#include "jsutil.h"
#include "builtin/Array.h"
#ifdef ENABLE_BIGINT
#include "builtin/BigInt.h"
#endif
#include "builtin/Eval.h"
#include "builtin/Object.h"
#include "builtin/String.h"
@ -3243,19 +3240,9 @@ js::PrimitiveToObject(JSContext* cx, const Value& v)
return NumberObject::create(cx, v.toNumber());
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);
}
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
}
/*

Просмотреть файл

@ -13,9 +13,6 @@
#include "jit/BaselineJIT.h"
#include "jit/Ion.h"
#include "vm/ArrayObject.h"
#ifdef ENABLE_BIGINT
#include "vm/BigIntType.h"
#endif
#include "vm/HelperThreads.h"
#include "vm/JSCompartment.h"
#include "vm/JSObject.h"
@ -558,15 +555,6 @@ StatsCellCallback(JSRuntime* rt, void* data, void* thing, JS::TraceKind traceKin
zStats->symbolsGCHeap += thingSize;
break;
#ifdef ENABLE_BIGINT
case JS::TraceKind::BigInt: {
JS::BigInt* bi = static_cast<BigInt*>(thing);
zStats->bigIntsGCHeap += thingSize;
zStats->bigIntsMallocHeap += bi->sizeOfExcludingThis(rtStats->mallocSizeOf_);
break;
}
#endif
case JS::TraceKind::BaseShape: {
JS::ShapeInfo info; // This zeroes all the sizes.
info.shapesGCHeapBase += thingSize;

Просмотреть файл

@ -2024,15 +2024,7 @@ js::ToStringSlow(JSContext* cx, typename MaybeRooted<Value, allowGC>::HandleType
JSMSG_SYMBOL_TO_STRING);
}
return nullptr;
}
#ifdef ENABLE_BIGINT
else if (v.isBigInt()) {
if (!allowGC)
return nullptr;
str = BigInt::toString(cx, v.toBigInt(), 10);
}
#endif
else {
} else {
MOZ_ASSERT(v.isUndefined());
str = cx->names().undefined;
}

Просмотреть файл

@ -190,10 +190,6 @@ 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:
@ -219,10 +215,6 @@ 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:

Просмотреть файл

@ -111,10 +111,6 @@ TypeSet::NonObjectTypeString(TypeSet::Type type)
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:
@ -787,10 +783,6 @@ TypeSet::print(FILE* fp)
fprintf(fp, " string");
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");

Просмотреть файл

@ -60,29 +60,17 @@ 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_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_SYMBOL,
/* 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,
@ -91,7 +79,7 @@ enum : uint32_t {
TYPE_FLAG_UNKNOWN = 0x00004000,
/* Mask of normal type flags on a type set. */
TYPE_FLAG_BASE_MASK = TYPE_FLAG_PRIMITIVE | TYPE_FLAG_LAZYARGS | TYPE_FLAG_ANYOBJECT | TYPE_FLAG_UNKNOWN,
TYPE_FLAG_BASE_MASK = 0x000041ff,
/* Additional flags for HeapTypeSet sets. */
@ -122,10 +110,6 @@ enum : uint32_t {
};
typedef uint32_t TypeFlags;
static_assert(TYPE_FLAG_PRIMITIVE < TYPE_FLAG_ANYOBJECT &&
TYPE_FLAG_LAZYARGS < TYPE_FLAG_ANYOBJECT,
"TYPE_FLAG_ANYOBJECT should be greater than primitive type flags");
/* Flags and other state stored in ObjectGroup::Flags */
enum : uint32_t {
/* Whether this group is associated with some allocation site. */
@ -382,9 +366,6 @@ 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); }

Просмотреть файл

@ -22,9 +22,6 @@
#include "js/Utility.h"
#include "js/Vector.h"
#include "util/Text.h"
#ifdef ENABLE_BIGINT
#include "vm/BigIntType.h"
#endif
#include "vm/Debugger.h"
#include "vm/EnvironmentObject.h"
#include "vm/GlobalObject.h"
@ -206,13 +203,7 @@ Node::exposeToJS() const
v.setString(as<JSString>());
} else if (is<JS::Symbol>()) {
v.setSymbol(as<JS::Symbol>());
}
#ifdef ENABLE_BIGINT
else if (is<BigInt>()) {
v.setBigInt(as<BigInt>());
}
#endif
else {
} else {
v.setUndefined();
}
@ -324,9 +315,6 @@ template JS::Zone* TracerConcrete<js::ObjectGroup>::zone() const;
template JS::Zone* TracerConcrete<js::RegExpShared>::zone() const;
template JS::Zone* TracerConcrete<js::Scope>::zone() const;
template JS::Zone* TracerConcrete<JS::Symbol>::zone() const;
#ifdef ENABLE_BIGINT
template JS::Zone* TracerConcrete<BigInt>::zone() const;
#endif
template JS::Zone* TracerConcrete<JSString>::zone() const;
template<typename Referent>
@ -350,9 +338,6 @@ template UniquePtr<EdgeRange> TracerConcrete<js::ObjectGroup>::edges(JSContext*
template UniquePtr<EdgeRange> TracerConcrete<js::RegExpShared>::edges(JSContext* cx, bool wantNames) const;
template UniquePtr<EdgeRange> TracerConcrete<js::Scope>::edges(JSContext* cx, bool wantNames) const;
template UniquePtr<EdgeRange> TracerConcrete<JS::Symbol>::edges(JSContext* cx, bool wantNames) const;
#ifdef ENABLE_BIGINT
template UniquePtr<EdgeRange> TracerConcrete<BigInt>::edges(JSContext* cx, bool wantNames) const;
#endif
template UniquePtr<EdgeRange> TracerConcrete<JSString>::edges(JSContext* cx, bool wantNames) const;
template<typename Referent>
@ -408,9 +393,6 @@ Concrete<JSObject>::jsObjectConstructorName(JSContext* cx, UniqueTwoByteChars& o
}
const char16_t Concrete<JS::Symbol>::concreteTypeName[] = u"JS::Symbol";
#ifdef ENABLE_BIGINT
const char16_t Concrete<BigInt>::concreteTypeName[] = u"JS::BigInt";
#endif
const char16_t Concrete<JSScript>::concreteTypeName[] = u"JSScript";
const char16_t Concrete<js::LazyScript>::concreteTypeName[] = u"js::LazyScript";
const char16_t Concrete<js::jit::JitCode>::concreteTypeName[] = u"js::jit::JitCode";

Просмотреть файл

@ -430,50 +430,6 @@ NS_IMPL_ISUPPORTS(VPXReporter, nsIMemoryReporter)
CountingAllocatorBase<VPXReporter>::sAmount(0);
#endif /* MOZ_VPX */
#ifdef ENABLE_BIGINT
class GMPReporter final
: public nsIMemoryReporter
, public CountingAllocatorBase<GMPReporter>
{
public:
NS_DECL_ISUPPORTS
static void* Alloc(size_t size)
{
return CountingMalloc(size);
}
static void* Realloc(void* ptr, size_t oldSize, size_t newSize)
{
return CountingRealloc(ptr, newSize);
}
static void Free(void* ptr, size_t size)
{
return CountingFree(ptr);
}
private:
NS_IMETHOD
CollectReports(nsIHandleReportCallback* aHandleReport, nsISupports* aData,
bool aAnonymize) override
{
MOZ_COLLECT_REPORT(
"explicit/gmp", KIND_HEAP, UNITS_BYTES, MemoryAllocated(),
"Memory allocated through libgmp for BigInt arithmetic.");
return NS_OK;
}
~GMPReporter() {}
};
NS_IMPL_ISUPPORTS(GMPReporter, nsIMemoryReporter)
/* static */ template<> Atomic<size_t>
CountingAllocatorBase<GMPReporter>::sAmount(0);
#endif // ENABLE_BIGINT
static bool sInitializedJS = false;
// Note that on OSX, aBinDirectory will point to .app/Contents/Resources/browser
@ -683,11 +639,6 @@ NS_InitXPCOM2(nsIServiceManager** aResult,
memmove);
#endif
#ifdef ENABLE_BIGINT
// And for libgmp.
mozilla::SetGMPMemoryFunctions();
#endif
// Initialize the JS engine.
const char* jsInitFailureReason = JS_InitWithFailureDiagnostic();
if (jsInitFailureReason) {
@ -848,20 +799,6 @@ SetICUMemoryFunctions()
}
}
#ifdef ENABLE_BIGINT
void
SetGMPMemoryFunctions()
{
static bool sGMPReporterInitialized = false;
if (!sGMPReporterInitialized) {
JS::SetGMPMemoryFunctions(GMPReporter::Alloc,
GMPReporter::Realloc,
GMPReporter::Free);
sGMPReporterInitialized = true;
}
}
#endif
nsresult
ShutdownXPCOM(nsIServiceManager* aServMgr)
{

Просмотреть файл

@ -42,10 +42,6 @@ ShutdownXPCOM(nsIServiceManager* aServMgr);
void SetICUMemoryFunctions();
#ifdef ENABLE_BIGINT
void SetGMPMemoryFunctions();
#endif
/**
* C++ namespaced version of NS_LogTerm.
*/