Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

# Reset this number to 0 on major V8 upgrades.
# Increment by one for each non-official patch applied to deps/v8.
'v8_embedder_string': '-node.28',
'v8_embedder_string': '-node.29',

##### V8 defaults for Node.js #####

Expand Down
56 changes: 0 additions & 56 deletions deps/v8/src/api/api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3741,14 +3741,6 @@ bool Value::IsTypedArray() const {
TYPED_ARRAYS_BASE(VALUE_IS_TYPED_ARRAY)
#undef VALUE_IS_TYPED_ARRAY

bool Value::IsFloat16Array() const {
auto obj = *Utils::OpenDirectHandle(this);
return i::IsJSTypedArray(obj) &&
i::Cast<i::JSTypedArray>(obj)->type() == i::kExternalFloat16Array &&
Utils::ApiCheck(i::v8_flags.js_float16array, "Value::IsFloat16Array",
"Float16Array is not supported");
}

bool Value::IsDataView() const {
auto obj = *Utils::OpenDirectHandle(this);
return IsJSDataView(obj) || IsJSRabGsabDataView(obj);
Expand Down Expand Up @@ -4292,16 +4284,6 @@ void v8::TypedArray::CheckCast(Value* that) {
TYPED_ARRAYS_BASE(CHECK_TYPED_ARRAY_CAST)
#undef CHECK_TYPED_ARRAY_CAST

void v8::Float16Array::CheckCast(Value* that) {
Utils::ApiCheck(i::v8_flags.js_float16array, "v8::Float16Array::Cast",
"Float16Array is not supported");
auto obj = *Utils::OpenDirectHandle(that);
Utils::ApiCheck(
i::IsJSTypedArray(obj) &&
i::Cast<i::JSTypedArray>(obj)->type() == i::kExternalFloat16Array,
"v8::Float16Array::Cast()", "Value is not a Float16Array");
}

void v8::DataView::CheckCast(Value* that) {
auto obj = *Utils::OpenDirectHandle(that);
Utils::ApiCheck(i::IsJSDataView(obj) || IsJSRabGsabDataView(obj),
Expand Down Expand Up @@ -9347,44 +9329,6 @@ static_assert(v8::TypedArray::kMaxByteLength == i::JSTypedArray::kMaxByteLength,
TYPED_ARRAYS_BASE(TYPED_ARRAY_NEW)
#undef TYPED_ARRAY_NEW

Local<Float16Array> Float16Array::New(Local<ArrayBuffer> array_buffer,
size_t byte_offset, size_t length) {
Utils::ApiCheck(i::v8_flags.js_float16array, "v8::Float16Array::New",
"Float16Array is not supported");
i::Isolate* i_isolate = i::Isolate::Current();
ApiRuntimeCallStatsScope rcs_scope(i_isolate, RCCId::kAPI_Float16Array_New);
EnterV8NoScriptNoExceptionScope api_scope(i_isolate);
if (!Utils::ApiCheck(
length <= kMaxLength,
"v8::Float16Array::New(Local<ArrayBuffer>, size_t, size_t)",
"length exceeds max allowed value")) {
return {};
}
auto buffer = Utils::OpenDirectHandle(*array_buffer);
i::DirectHandle<i::JSTypedArray> obj = i_isolate->factory()->NewJSTypedArray(
i::kExternalFloat16Array, buffer, byte_offset, length);
return Utils::ToLocalFloat16Array(obj);
}
Local<Float16Array> Float16Array::New(
Local<SharedArrayBuffer> shared_array_buffer, size_t byte_offset,
size_t length) {
Utils::ApiCheck(i::v8_flags.js_float16array, "v8::Float16Array::New",
"Float16Array is not supported");
i::Isolate* i_isolate = i::Isolate::Current();
ApiRuntimeCallStatsScope rcs_scope(i_isolate, RCCId::kAPI_Float16Array_New);
EnterV8NoScriptNoExceptionScope api_scope(i_isolate);
if (!Utils::ApiCheck(
length <= kMaxLength,
"v8::Float16Array::New(Local<SharedArrayBuffer>, size_t, size_t)",
"length exceeds max allowed value")) {
return {};
}
auto buffer = Utils::OpenDirectHandle(*shared_array_buffer);
i::DirectHandle<i::JSTypedArray> obj = i_isolate->factory()->NewJSTypedArray(
i::kExternalFloat16Array, buffer, byte_offset, length);
return Utils::ToLocalFloat16Array(obj);
}

// TODO(v8:11111): Support creating length tracking DataViews via the API.
Local<DataView> DataView::New(Local<ArrayBuffer> array_buffer,
size_t byte_offset, size_t byte_length) {
Expand Down
6 changes: 0 additions & 6 deletions deps/v8/src/builtins/builtins.cc
Original file line number Diff line number Diff line change
Expand Up @@ -863,12 +863,6 @@ Builtins::JSBuiltinStateFlags Builtins::GetJSBuiltinState(Builtin builtin) {
RETURN_FLAG_DEPENDENT_BUILTIN_STATE(
v8_flags.js_explicit_resource_management);

// --js-float16array
case Builtin::kMathF16round:
case Builtin::kDataViewPrototypeGetFloat16:
case Builtin::kDataViewPrototypeSetFloat16:
RETURN_FLAG_DEPENDENT_BUILTIN_STATE(v8_flags.js_float16array);

// --js-base-64
case Builtin::kUint8ArrayFromBase64:
case Builtin::kUint8ArrayFromHex:
Expand Down
2 changes: 0 additions & 2 deletions deps/v8/src/flags/flag-definitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,6 @@ DEFINE_BOOL(js_shipping, true, "enable all shipped JavaScript features")
V(js_error_iserror, "Error.isError") \
V(js_regexp_escape, "RegExp.escape") \
V(js_explicit_resource_management, "explicit resource management") \
V(js_float16array, \
"Float16Array, Math.f16round, DataView.getFloat16, DataView.setFloat16") \
V(js_base_64, "Uint8Array to/from base64 and hex") \
V(js_esm_ns_reexport, \
"Support diamond-importing re-expored namespaces " \
Expand Down
39 changes: 6 additions & 33 deletions deps/v8/src/init/bootstrapper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3483,6 +3483,8 @@ void Genesis::InitializeGlobal(DirectHandle<JSGlobalObject> global_object,
SimpleInstallFunction(isolate_, math, "exp", Builtin::kMathExp, 1, kAdapt);
SimpleInstallFunction(isolate_, math, "floor", Builtin::kMathFloor, 1,
kAdapt);
SimpleInstallFunction(isolate_, math, "f16round", Builtin::kMathF16round, 1,
kAdapt);
SimpleInstallFunction(isolate_, math, "fround", Builtin::kMathFround, 1,
kAdapt);
SimpleInstallFunction(isolate_, math, "hypot", Builtin::kMathHypot, 2,
Expand Down Expand Up @@ -4330,6 +4332,10 @@ void Genesis::InitializeGlobal(DirectHandle<JSGlobalObject> global_object,
Builtin::kDataViewPrototypeGetUint32, 1, kDontAdapt);
SimpleInstallFunction(isolate_, prototype, "setUint32",
Builtin::kDataViewPrototypeSetUint32, 2, kDontAdapt);
SimpleInstallFunction(isolate_, prototype, "getFloat16",
Builtin::kDataViewPrototypeGetFloat16, 1, kDontAdapt);
SimpleInstallFunction(isolate_, prototype, "setFloat16",
Builtin::kDataViewPrototypeSetFloat16, 2, kDontAdapt);
SimpleInstallFunction(isolate_, prototype, "getFloat32",
Builtin::kDataViewPrototypeGetFloat32, 1, kDontAdapt);
SimpleInstallFunction(isolate_, prototype, "setFloat32",
Expand Down Expand Up @@ -5084,11 +5090,6 @@ DirectHandle<JSFunction> Genesis::InstallTypedArray(
GetCorrespondingRabGsabElementsKind(elements_kind), 0);
rab_gsab_initial_map->SetConstructor(*result);

if (rab_gsab_initial_map_index == Context::RAB_GSAB_FLOAT16_ARRAY_MAP_INDEX &&
v8_flags.js_float16array) {
LOG(isolate(), MapDetails(*rab_gsab_initial_map));
}

native_context()->set(rab_gsab_initial_map_index, *rab_gsab_initial_map,
UPDATE_WRITE_BARRIER, kReleaseStore);
Map::SetPrototype(isolate(), rab_gsab_initial_map, prototype);
Expand Down Expand Up @@ -5869,34 +5870,6 @@ void Genesis::InitializeGlobal_js_explicit_resource_management() {
kAdapt);
}

void Genesis::InitializeGlobal_js_float16array() {
if (!v8_flags.js_float16array) return;

DirectHandle<JSGlobalObject> global(native_context()->global_object(),
isolate());
DirectHandle<JSObject> math = Cast<JSObject>(
JSReceiver::GetProperty(isolate(), global, "Math").ToHandleChecked());

SimpleInstallFunction(isolate_, math, "f16round", Builtin::kMathF16round, 1,
kAdapt);

DirectHandle<JSObject> dataview_prototype(
Cast<JSObject>(native_context()->data_view_fun()->instance_prototype()),
isolate());

SimpleInstallFunction(isolate_, dataview_prototype, "getFloat16",
Builtin::kDataViewPrototypeGetFloat16, 1, kDontAdapt);
SimpleInstallFunction(isolate_, dataview_prototype, "setFloat16",
Builtin::kDataViewPrototypeSetFloat16, 2, kDontAdapt);

DirectHandle<JSFunction> fun = InstallTypedArray(
"Float16Array", FLOAT16_ELEMENTS, FLOAT16_TYPED_ARRAY_CONSTRUCTOR_TYPE,
Context::RAB_GSAB_FLOAT16_ARRAY_MAP_INDEX);

InstallWithIntrinsicDefaultProto(isolate_, fun,
Context::FLOAT16_ARRAY_FUN_INDEX);
}

void Genesis::InitializeGlobal_js_regexp_escape() {
if (!v8_flags.js_regexp_escape) return;

Expand Down
31 changes: 9 additions & 22 deletions deps/v8/src/objects/elements-kind.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,10 @@ namespace internal {
V(BigInt64, bigint64, BIGINT64, int64_t) \
V(Uint8Clamped, uint8_clamped, UINT8_CLAMPED, uint8_t) \
V(Float32, float32, FLOAT32, float) \
V(Float64, float64, FLOAT64, double)
V(Float64, float64, FLOAT64, double) \
V(Float16, float16, FLOAT16, uint16_t)

#define TYPED_ARRAYS_FLOAT16(V) V(Float16, float16, FLOAT16, uint16_t)

#define TYPED_ARRAYS(V) \
TYPED_ARRAYS_BASE(V) \
TYPED_ARRAYS_FLOAT16(V)
#define TYPED_ARRAYS(V) TYPED_ARRAYS_BASE(V)

#define RAB_GSAB_TYPED_ARRAYS_BASE(V) \
V(RabGsabUint8, rab_gsab_uint8, RAB_GSAB_UINT8, uint8_t) \
Expand All @@ -46,14 +43,10 @@ namespace internal {
V(RabGsabUint8Clamped, rab_gsab_uint8_clamped, RAB_GSAB_UINT8_CLAMPED, \
uint8_t) \
V(RabGsabFloat32, rab_gsab_float32, RAB_GSAB_FLOAT32, float) \
V(RabGsabFloat64, rab_gsab_float64, RAB_GSAB_FLOAT64, double)

#define RAB_GSAB_TYPED_ARRAYS_FLOAT16(V) \
V(RabGsabFloat64, rab_gsab_float64, RAB_GSAB_FLOAT64, double) \
V(RabGsabFloat16, rab_gsab_float16, RAB_GSAB_FLOAT16, uint16_t)

#define RAB_GSAB_TYPED_ARRAYS(V) \
RAB_GSAB_TYPED_ARRAYS_BASE(V) \
RAB_GSAB_TYPED_ARRAYS_FLOAT16(V)
#define RAB_GSAB_TYPED_ARRAYS(V) RAB_GSAB_TYPED_ARRAYS_BASE(V)

// The TypedArrays backed by RAB / GSAB are called Uint8Array, Uint16Array etc,
// and not RabGsabUint8Array, RabGsabUint16Array etc. This macro is used for
Expand All @@ -69,14 +62,11 @@ namespace internal {
V(BigInt64, rab_gsab_bigint64, RAB_GSAB_BIGINT64, int64_t) \
V(Uint8Clamped, rab_gsab_uint8_clamped, RAB_GSAB_UINT8_CLAMPED, uint8_t) \
V(Float32, rab_gsab_float32, RAB_GSAB_FLOAT32, float) \
V(Float64, rab_gsab_float64, RAB_GSAB_FLOAT64, double)

#define RAB_GSAB_TYPED_ARRAYS_WITH_TYPED_ARRAY_TYPE_FLOAT16(V) \
V(Float64, rab_gsab_float64, RAB_GSAB_FLOAT64, double) \
V(Float16, rab_gsab_float16, RAB_GSAB_FLOAT16, uint16_t)

#define RAB_GSAB_TYPED_ARRAYS_WITH_TYPED_ARRAY_TYPE(V) \
RAB_GSAB_TYPED_ARRAYS_WITH_TYPED_ARRAY_TYPE_BASE(V) \
RAB_GSAB_TYPED_ARRAYS_WITH_TYPED_ARRAY_TYPE_FLOAT16(V)
RAB_GSAB_TYPED_ARRAYS_WITH_TYPED_ARRAY_TYPE_BASE(V)

// Like RAB_GSAB_TYPED_ARRAYS but has an additional parameter for
// for the corresponding non-RAB/GSAB ElementsKind.
Expand All @@ -93,14 +83,11 @@ namespace internal {
V(RabGsabUint8Clamped, rab_gsab_uint8_clamped, RAB_GSAB_UINT8_CLAMPED, \
uint8_t, UINT8_CLAMPED) \
V(RabGsabFloat32, rab_gsab_float32, RAB_GSAB_FLOAT32, float, FLOAT32) \
V(RabGsabFloat64, rab_gsab_float64, RAB_GSAB_FLOAT64, double, FLOAT64)

#define RAB_GSAB_TYPED_ARRAYS_WITH_NON_RAB_GSAB_ELEMENTS_KIND_FLOAT16(V) \
V(RabGsabFloat64, rab_gsab_float64, RAB_GSAB_FLOAT64, double, FLOAT64) \
V(RabGsabFloat16, rab_gsab_float16, RAB_GSAB_FLOAT16, uint16_t, FLOAT16)

#define RAB_GSAB_TYPED_ARRAYS_WITH_NON_RAB_GSAB_ELEMENTS_KIND(V) \
RAB_GSAB_TYPED_ARRAYS_WITH_NON_RAB_GSAB_ELEMENTS_KIND_BASE(V) \
RAB_GSAB_TYPED_ARRAYS_WITH_NON_RAB_GSAB_ELEMENTS_KIND_FLOAT16(V)
RAB_GSAB_TYPED_ARRAYS_WITH_NON_RAB_GSAB_ELEMENTS_KIND_BASE(V)

enum ElementsKind : uint8_t {
// The "fast" kind for elements that only contain SMI values. Must be first
Expand Down
7 changes: 0 additions & 7 deletions deps/v8/src/objects/value-serializer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2301,13 +2301,6 @@ MaybeDirectHandle<JSArrayBufferView> ValueDeserializer::ReadJSArrayBufferView(
break;
TYPED_ARRAYS_BASE(TYPED_ARRAY_CASE)
#undef TYPED_ARRAY_CASE
case ArrayBufferViewTag::kFloat16Array: {
if (i::v8_flags.js_float16array) {
external_array_type = kExternalFloat16Array;
element_size = sizeof(uint16_t);
}
break;
}
}
if (element_size == 0 || byte_offset % element_size != 0 ||
byte_length % element_size != 0) {
Expand Down
1 change: 0 additions & 1 deletion deps/v8/test/cctest/test-inobject-slack-tracking.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1100,7 +1100,6 @@ TEST(SubclassArrayBuiltinNoInlineNew) {


TEST(SubclassTypedArrayBuiltin) {
v8_flags.js_float16array = true;
CcTest::InitializeVM();
v8::HandleScope scope(CcTest::isolate());

Expand Down
4 changes: 0 additions & 4 deletions deps/v8/test/cctest/test-typedarrays.cc
Original file line number Diff line number Diff line change
Expand Up @@ -115,28 +115,24 @@ void TestSpeciesProtector(char* code,
}

UNINITIALIZED_TEST(SpeciesConstructor) {
v8_flags.js_float16array = true;
char code[] = "x.constructor = MyTypedArray";
TestSpeciesProtector(code);
}

UNINITIALIZED_TEST(SpeciesConstructorAccessor) {
v8_flags.js_float16array = true;
char code[] =
"Object.defineProperty(x, 'constructor',{get() {return MyTypedArray;}})";
TestSpeciesProtector(code);
}

UNINITIALIZED_TEST(SpeciesModified) {
v8_flags.js_float16array = true;
char code[] =
"Object.defineProperty(constructor, Symbol.species, "
"{value:MyTypedArray})";
TestSpeciesProtector(code);
}

UNINITIALIZED_TEST(SpeciesParentConstructor) {
v8_flags.js_float16array = true;
char code[] = "constructor.prototype.constructor = MyTypedArray";
TestSpeciesProtector(code);
}
Expand Down
1 change: 0 additions & 1 deletion deps/v8/test/test262/testcfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
'import-attributes': '--harmony-import-attributes',
'regexp-duplicate-named-groups': '--js-regexp-duplicate-named-groups',
'regexp-modifiers': '--js-regexp-modifiers',
'Float16Array': '--js-float16array',
'explicit-resource-management': '--js-explicit-resource-management',
'decorators': '--js-decorators',
'promise-try': '--js-promise-try',
Expand Down
3 changes: 0 additions & 3 deletions deps/v8/test/unittests/objects/object-unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -683,8 +683,6 @@ TEST_FUNCTION_KIND(IsStrictFunctionWithoutPrototype)
#undef TEST_FUNCTION_KIND

TEST_F(ObjectTest, ConstructorInstanceTypes) {
bool flag_was_enabled = i::v8_flags.js_float16array;
i::v8_flags.js_float16array = true;
v8::HandleScope scope(isolate());

DirectHandle<NativeContext> context = i_isolate()->native_context();
Expand Down Expand Up @@ -720,7 +718,6 @@ TEST_F(ObjectTest, ConstructorInstanceTypes) {
break;
}
}
i::v8_flags.js_float16array = flag_was_enabled;
}

TEST_F(ObjectTest, AddDataPropertyNameCollision) {
Expand Down
4 changes: 0 additions & 4 deletions deps/v8/test/unittests/objects/value-serializer-unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ class ValueSerializerTest : public TestWithIsolate {

protected:
ValueSerializerTest() {
FLAG_SCOPE(js_float16array);
Local<Context> serialization_context = Context::New(isolate());
Local<Context> deserialization_context = Context::New(isolate());
serialization_context_.Reset(isolate(), serialization_context);
Expand Down Expand Up @@ -2083,7 +2082,6 @@ TEST_F(ValueSerializerTestWithArrayBufferTransfer,
}

TEST_F(ValueSerializerTest, RoundTripTypedArray) {
FLAG_SCOPE(js_float16array);
// Check that the right type comes out the other side for every kind of typed
// array.
// TODO(v8:11111): Use API functions for testing is_length_tracking and
Expand Down Expand Up @@ -2133,7 +2131,6 @@ TEST_F(ValueSerializerTest, RoundTripTypedArray) {
}

TEST_F(ValueSerializerTest, RoundTripRabBackedLengthTrackingTypedArray) {
FLAG_SCOPE(js_float16array);
// Check that the right type comes out the other side for every kind of typed
// array.
// TODO(v8:11111): Use API functions for testing is_length_tracking and
Expand All @@ -2158,7 +2155,6 @@ TEST_F(ValueSerializerTest, RoundTripRabBackedLengthTrackingTypedArray) {
}

TEST_F(ValueSerializerTest, RoundTripRabBackedNonLengthTrackingTypedArray) {
FLAG_SCOPE(js_float16array);
// Check that the right type comes out the other side for every kind of typed
// array.
// TODO(v8:11111): Use API functions for testing is_length_tracking and
Expand Down
7 changes: 1 addition & 6 deletions lib/eslint.config_partial.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -412,12 +412,6 @@ export default [
name: 'SubtleCrypto',
message: "Use `const { SubtleCrypto } = require('internal/crypto/webcrypto');` instead of the global.",
},
// Float16Array is not available in primordials because it can be
// disabled with --no-js-float16array CLI flag.
{
name: 'Float16Array',
message: 'Use `const { Float16Array } = globalThis;` instead of the global.',
},
// DisposableStack and AsyncDisposableStack are not available in primordials because they can be
// disabled with --no-js-explicit-resource-management CLI flag.
{
Expand Down Expand Up @@ -478,6 +472,7 @@ export default [
name: 'FinalizationRegistry',
into: 'Safe',
},
{ name: 'Float16Array' },
{ name: 'Float32Array' },
{ name: 'Float64Array' },
{ name: 'Function' },
Expand Down
4 changes: 4 additions & 0 deletions lib/internal/freeze_intrinsics.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ const {
EvalErrorPrototype,
FinalizationRegistry,
FinalizationRegistryPrototype,
Float16Array,
Float16ArrayPrototype,
Float32Array,
Float32ArrayPrototype,
Float64Array,
Expand Down Expand Up @@ -196,6 +198,7 @@ module.exports = function() {
Uint16ArrayPrototype,
Int32ArrayPrototype,
Uint32ArrayPrototype,
Float16ArrayPrototype,
Float32ArrayPrototype,
Float64ArrayPrototype,
BigInt64ArrayPrototype,
Expand Down Expand Up @@ -296,6 +299,7 @@ module.exports = function() {
Uint16Array,
Int32Array,
Uint32Array,
Float16Array,
Float32Array,
Float64Array,
BigInt64Array,
Expand Down
Loading
Loading