mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-03 10:33:33 +00:00
Bug 1903329 - Ship Float16Array; r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D214259
This commit is contained in:
parent
d5b4f53786
commit
5b77b7ea55
@ -105,7 +105,7 @@
|
||||
REAL(Uint8ClampedArray, TYPED_ARRAY_CLASP(Uint8Clamped)) \
|
||||
REAL(BigInt64Array, TYPED_ARRAY_CLASP(BigInt64)) \
|
||||
REAL(BigUint64Array, TYPED_ARRAY_CLASP(BigUint64)) \
|
||||
REAL_IF_NIGHTLY(Float16Array, TYPED_ARRAY_CLASP(Float16)) \
|
||||
REAL(Float16Array, TYPED_ARRAY_CLASP(Float16)) \
|
||||
REAL(BigInt, OCLASP(BigInt)) \
|
||||
REAL(Proxy, CLASP(Proxy)) \
|
||||
REAL(WeakMap, OCLASP(WeakMap)) \
|
||||
|
@ -417,7 +417,6 @@ NativeType DataViewObject::read(uint64_t offset, size_t length,
|
||||
return val;
|
||||
}
|
||||
|
||||
#ifdef NIGHTLY_BUILD
|
||||
template <>
|
||||
float16 DataViewObject::read(uint64_t offset, size_t length,
|
||||
bool isLittleEndian) {
|
||||
@ -425,7 +424,6 @@ float16 DataViewObject::read(uint64_t offset, size_t length,
|
||||
val.val = read<uint16_t>(offset, length, isLittleEndian);
|
||||
return val;
|
||||
}
|
||||
#endif
|
||||
|
||||
template uint32_t DataViewObject::read(uint64_t offset, size_t length,
|
||||
bool isLittleEndian);
|
||||
@ -510,7 +508,6 @@ inline bool WebIDLCast<uint64_t>(JSContext* cx, HandleValue value,
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef NIGHTLY_BUILD
|
||||
template <>
|
||||
inline bool WebIDLCast<float16>(JSContext* cx, HandleValue value,
|
||||
float16* out) {
|
||||
@ -521,7 +518,6 @@ inline bool WebIDLCast<float16>(JSContext* cx, HandleValue value,
|
||||
*out = float16(temp);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
template <>
|
||||
inline bool WebIDLCast<float>(JSContext* cx, HandleValue value, float* out) {
|
||||
@ -767,7 +763,6 @@ bool DataViewObject::fun_getBigUint64(JSContext* cx, unsigned argc, Value* vp) {
|
||||
return CallNonGenericMethod<IsDataView, getBigUint64Impl>(cx, args);
|
||||
}
|
||||
|
||||
#ifdef NIGHTLY_BUILD
|
||||
bool DataViewObject::getFloat16Impl(JSContext* cx, const CallArgs& args) {
|
||||
MOZ_ASSERT(IsDataView(args.thisv()));
|
||||
|
||||
@ -787,7 +782,6 @@ bool DataViewObject::fun_getFloat16(JSContext* cx, unsigned argc, Value* vp) {
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
return CallNonGenericMethod<IsDataView, getFloat16Impl>(cx, args);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool DataViewObject::getFloat32Impl(JSContext* cx, const CallArgs& args) {
|
||||
MOZ_ASSERT(IsDataView(args.thisv()));
|
||||
@ -977,7 +971,6 @@ bool DataViewObject::fun_setBigUint64(JSContext* cx, unsigned argc, Value* vp) {
|
||||
return CallNonGenericMethod<IsDataView, setBigUint64Impl>(cx, args);
|
||||
}
|
||||
|
||||
#ifdef NIGHTLY_BUILD
|
||||
bool DataViewObject::setFloat16Impl(JSContext* cx, const CallArgs& args) {
|
||||
MOZ_ASSERT(IsDataView(args.thisv()));
|
||||
|
||||
@ -995,7 +988,6 @@ bool DataViewObject::fun_setFloat16(JSContext* cx, unsigned argc, Value* vp) {
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
return CallNonGenericMethod<IsDataView, setFloat16Impl>(cx, args);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool DataViewObject::setFloat32Impl(JSContext* cx, const CallArgs& args) {
|
||||
MOZ_ASSERT(IsDataView(args.thisv()));
|
||||
@ -1153,10 +1145,8 @@ const JSFunctionSpec DataViewObject::methods[] = {
|
||||
DataViewGetInt32),
|
||||
JS_INLINABLE_FN("getUint32", DataViewObject::fun_getUint32, 1, 0,
|
||||
DataViewGetUint32),
|
||||
#ifdef NIGHTLY_BUILD
|
||||
// TODO: See Bug 1835034 for JIT support for Float16Array
|
||||
JS_FN("getFloat16", DataViewObject::fun_getFloat16, 1, 0),
|
||||
#endif
|
||||
JS_INLINABLE_FN("getFloat32", DataViewObject::fun_getFloat32, 1, 0,
|
||||
DataViewGetFloat32),
|
||||
JS_INLINABLE_FN("getFloat64", DataViewObject::fun_getFloat64, 1, 0,
|
||||
@ -1177,10 +1167,8 @@ const JSFunctionSpec DataViewObject::methods[] = {
|
||||
DataViewSetInt32),
|
||||
JS_INLINABLE_FN("setUint32", DataViewObject::fun_setUint32, 2, 0,
|
||||
DataViewSetUint32),
|
||||
#ifdef NIGHTLY_BUILD
|
||||
// TODO: See Bug 1835034 for JIT support for Float16Array
|
||||
JS_FN("setFloat16", DataViewObject::fun_setFloat16, 2, 0),
|
||||
#endif
|
||||
JS_INLINABLE_FN("setFloat32", DataViewObject::fun_setFloat32, 2, 0,
|
||||
DataViewSetFloat32),
|
||||
JS_INLINABLE_FN("setFloat64", DataViewObject::fun_setFloat64, 2, 0,
|
||||
|
@ -300,7 +300,6 @@ static bool math_fround(JSContext* cx, unsigned argc, Value* vp) {
|
||||
return RoundFloat32(cx, args[0], args.rval());
|
||||
}
|
||||
|
||||
#ifdef NIGHTLY_BUILD
|
||||
static bool math_f16round(JSContext* cx, unsigned argc, Value* vp) {
|
||||
// http://tc39.es/proposal-float16array/#sec-function-properties-of-the-math-object
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
@ -326,7 +325,6 @@ static bool math_f16round(JSContext* cx, unsigned argc, Value* vp) {
|
||||
args.rval().setDouble(f16.toDouble());
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
double js::math_log_impl(double x) {
|
||||
AutoUnsafeCallWithABI unsafe;
|
||||
@ -1059,10 +1057,8 @@ static const JSFunctionSpec math_static_methods[] = {
|
||||
JS_INLINABLE_FN("floor", math_floor, 1, 0, MathFloor),
|
||||
JS_INLINABLE_FN("imul", math_imul, 2, 0, MathImul),
|
||||
JS_INLINABLE_FN("fround", math_fround, 1, 0, MathFRound),
|
||||
#ifdef NIGHTLY_BUILD
|
||||
// TODO: See Bug 1835034 for JIT support
|
||||
JS_FN("f16round", math_f16round, 1, 0),
|
||||
#endif
|
||||
JS_INLINABLE_FN("log", math_log, 1, 0, MathLog),
|
||||
JS_INLINABLE_FN("max", math_max, 2, 0, MathMax),
|
||||
JS_INLINABLE_FN("min", math_min, 2, 0, MathMin),
|
||||
|
@ -12556,6 +12556,9 @@ bool SetGlobalOptionsPreJSInit(const OptionParser& op) {
|
||||
if (op.getBoolOption("enable-regexp-duplicate-named-groups")) {
|
||||
JS::Prefs::setAtStartup_experimental_regexp_duplicate_named_groups(true);
|
||||
}
|
||||
if (op.getBoolOption("enable-float16array")) {
|
||||
JS::Prefs::setAtStartup_experimental_float16array(true);
|
||||
}
|
||||
#ifdef NIGHTLY_BUILD
|
||||
if (op.getBoolOption("enable-iterator-helpers")) {
|
||||
JS::Prefs::setAtStartup_experimental_iterator_helpers(true);
|
||||
@ -12572,9 +12575,6 @@ bool SetGlobalOptionsPreJSInit(const OptionParser& op) {
|
||||
if (op.getBoolOption("enable-uint8array-base64")) {
|
||||
JS::Prefs::setAtStartup_experimental_uint8array_base64(true);
|
||||
}
|
||||
if (op.getBoolOption("enable-float16array")) {
|
||||
JS::Prefs::setAtStartup_experimental_float16array(true);
|
||||
}
|
||||
#endif
|
||||
#ifdef ENABLE_JSON_PARSE_WITH_SOURCE
|
||||
JS::Prefs::setAtStartup_experimental_json_parse_with_source(
|
||||
|
@ -254,10 +254,8 @@ bool GlobalObject::skipDeselectedConstructor(JSContext* cx, JSProtoKey key) {
|
||||
case JSProto_ShadowRealm:
|
||||
return !JS::Prefs::experimental_shadow_realms();
|
||||
|
||||
#ifdef NIGHTLY_BUILD
|
||||
case JSProto_Float16Array:
|
||||
return !JS::Prefs::experimental_float16array();
|
||||
#endif
|
||||
|
||||
default:
|
||||
MOZ_CRASH("unexpected JSProtoKey");
|
||||
|
@ -2268,7 +2268,6 @@ JS_PUBLIC_API bool js::ShouldIgnorePropertyDefinition(JSContext* cx,
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef NIGHTLY_BUILD
|
||||
if (key == JSProto_Math && !JS::Prefs::experimental_float16array() &&
|
||||
(id == NameToId(cx->names().f16round))) {
|
||||
return true;
|
||||
@ -2278,7 +2277,6 @@ JS_PUBLIC_API bool js::ShouldIgnorePropertyDefinition(JSContext* cx,
|
||||
id == NameToId(cx->names().setFloat16))) {
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -7743,6 +7743,13 @@
|
||||
mirror: always
|
||||
set_spidermonkey_pref: startup
|
||||
|
||||
# Experimental support for Float16Array in JavaScript.
|
||||
- name: javascript.options.experimental.float16array
|
||||
type: bool
|
||||
value: true
|
||||
mirror: always
|
||||
set_spidermonkey_pref: startup
|
||||
|
||||
#ifdef NIGHTLY_BUILD
|
||||
# Experimental support for Iterator Helpers in JavaScript.
|
||||
- name: javascript.options.experimental.iterator_helpers
|
||||
@ -7772,13 +7779,6 @@
|
||||
mirror: always
|
||||
set_spidermonkey_pref: startup
|
||||
|
||||
# Experimental support for Float16Array in JavaScript.
|
||||
- name: javascript.options.experimental.float16array
|
||||
type: bool
|
||||
value: false
|
||||
mirror: always
|
||||
set_spidermonkey_pref: startup
|
||||
|
||||
# Experimental support for Import Assertions in JavaScript.
|
||||
- name: javascript.options.experimental.import_attributes
|
||||
type: bool
|
||||
|
Loading…
Reference in New Issue
Block a user