Skip to content

Commit 86d8a54

Browse files
o-aduh95
andcommitted
deps: V8: backport f3d4d458fe59
Original commit message: [cleanup] Remove --js-float16array Remove the --js-float16array flag and incorporate Float16Array into the standard typed array macros and baseline snapshot unconditionally. Float16Array has been shipping by default since M138. Bug: 548385945 TAG=agy CONV=052f499d-4ee5-4a10-8afd-900ba4a338db Change-Id: I2c0012158febf422fdc1b866b9414f3f040e83ad Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/8264275 Reviewed-by: Nikolaos Papaspyrou <nikolaos@chromium.org> Auto-Submit: Olivier Flückiger <olivf@chromium.org> Commit-Queue: Nikolaos Papaspyrou <nikolaos@chromium.org> Cr-Commit-Position: refs/heads/main@{#109335} Refs: v8/v8@f3d4d45 Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent 242909f commit 86d8a54

12 files changed

Lines changed: 16 additions & 140 deletions

File tree

common.gypi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242

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

4747
##### V8 defaults for Node.js #####
4848

deps/v8/src/api/api.cc

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -3741,14 +3741,6 @@ bool Value::IsTypedArray() const {
37413741
TYPED_ARRAYS_BASE(VALUE_IS_TYPED_ARRAY)
37423742
#undef VALUE_IS_TYPED_ARRAY
37433743

3744-
bool Value::IsFloat16Array() const {
3745-
auto obj = *Utils::OpenDirectHandle(this);
3746-
return i::IsJSTypedArray(obj) &&
3747-
i::Cast<i::JSTypedArray>(obj)->type() == i::kExternalFloat16Array &&
3748-
Utils::ApiCheck(i::v8_flags.js_float16array, "Value::IsFloat16Array",
3749-
"Float16Array is not supported");
3750-
}
3751-
37523744
bool Value::IsDataView() const {
37533745
auto obj = *Utils::OpenDirectHandle(this);
37543746
return IsJSDataView(obj) || IsJSRabGsabDataView(obj);
@@ -4292,16 +4284,6 @@ void v8::TypedArray::CheckCast(Value* that) {
42924284
TYPED_ARRAYS_BASE(CHECK_TYPED_ARRAY_CAST)
42934285
#undef CHECK_TYPED_ARRAY_CAST
42944286

4295-
void v8::Float16Array::CheckCast(Value* that) {
4296-
Utils::ApiCheck(i::v8_flags.js_float16array, "v8::Float16Array::Cast",
4297-
"Float16Array is not supported");
4298-
auto obj = *Utils::OpenDirectHandle(that);
4299-
Utils::ApiCheck(
4300-
i::IsJSTypedArray(obj) &&
4301-
i::Cast<i::JSTypedArray>(obj)->type() == i::kExternalFloat16Array,
4302-
"v8::Float16Array::Cast()", "Value is not a Float16Array");
4303-
}
4304-
43054287
void v8::DataView::CheckCast(Value* that) {
43064288
auto obj = *Utils::OpenDirectHandle(that);
43074289
Utils::ApiCheck(i::IsJSDataView(obj) || IsJSRabGsabDataView(obj),
@@ -9347,44 +9329,6 @@ static_assert(v8::TypedArray::kMaxByteLength == i::JSTypedArray::kMaxByteLength,
93479329
TYPED_ARRAYS_BASE(TYPED_ARRAY_NEW)
93489330
#undef TYPED_ARRAY_NEW
93499331

9350-
Local<Float16Array> Float16Array::New(Local<ArrayBuffer> array_buffer,
9351-
size_t byte_offset, size_t length) {
9352-
Utils::ApiCheck(i::v8_flags.js_float16array, "v8::Float16Array::New",
9353-
"Float16Array is not supported");
9354-
i::Isolate* i_isolate = i::Isolate::Current();
9355-
ApiRuntimeCallStatsScope rcs_scope(i_isolate, RCCId::kAPI_Float16Array_New);
9356-
EnterV8NoScriptNoExceptionScope api_scope(i_isolate);
9357-
if (!Utils::ApiCheck(
9358-
length <= kMaxLength,
9359-
"v8::Float16Array::New(Local<ArrayBuffer>, size_t, size_t)",
9360-
"length exceeds max allowed value")) {
9361-
return {};
9362-
}
9363-
auto buffer = Utils::OpenDirectHandle(*array_buffer);
9364-
i::DirectHandle<i::JSTypedArray> obj = i_isolate->factory()->NewJSTypedArray(
9365-
i::kExternalFloat16Array, buffer, byte_offset, length);
9366-
return Utils::ToLocalFloat16Array(obj);
9367-
}
9368-
Local<Float16Array> Float16Array::New(
9369-
Local<SharedArrayBuffer> shared_array_buffer, size_t byte_offset,
9370-
size_t length) {
9371-
Utils::ApiCheck(i::v8_flags.js_float16array, "v8::Float16Array::New",
9372-
"Float16Array is not supported");
9373-
i::Isolate* i_isolate = i::Isolate::Current();
9374-
ApiRuntimeCallStatsScope rcs_scope(i_isolate, RCCId::kAPI_Float16Array_New);
9375-
EnterV8NoScriptNoExceptionScope api_scope(i_isolate);
9376-
if (!Utils::ApiCheck(
9377-
length <= kMaxLength,
9378-
"v8::Float16Array::New(Local<SharedArrayBuffer>, size_t, size_t)",
9379-
"length exceeds max allowed value")) {
9380-
return {};
9381-
}
9382-
auto buffer = Utils::OpenDirectHandle(*shared_array_buffer);
9383-
i::DirectHandle<i::JSTypedArray> obj = i_isolate->factory()->NewJSTypedArray(
9384-
i::kExternalFloat16Array, buffer, byte_offset, length);
9385-
return Utils::ToLocalFloat16Array(obj);
9386-
}
9387-
93889332
// TODO(v8:11111): Support creating length tracking DataViews via the API.
93899333
Local<DataView> DataView::New(Local<ArrayBuffer> array_buffer,
93909334
size_t byte_offset, size_t byte_length) {

deps/v8/src/builtins/builtins.cc

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -863,12 +863,6 @@ Builtins::JSBuiltinStateFlags Builtins::GetJSBuiltinState(Builtin builtin) {
863863
RETURN_FLAG_DEPENDENT_BUILTIN_STATE(
864864
v8_flags.js_explicit_resource_management);
865865

866-
// --js-float16array
867-
case Builtin::kMathF16round:
868-
case Builtin::kDataViewPrototypeGetFloat16:
869-
case Builtin::kDataViewPrototypeSetFloat16:
870-
RETURN_FLAG_DEPENDENT_BUILTIN_STATE(v8_flags.js_float16array);
871-
872866
// --js-base-64
873867
case Builtin::kUint8ArrayFromBase64:
874868
case Builtin::kUint8ArrayFromHex:

deps/v8/src/flags/flag-definitions.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,8 +344,6 @@ DEFINE_BOOL(js_shipping, true, "enable all shipped JavaScript features")
344344
V(js_error_iserror, "Error.isError") \
345345
V(js_regexp_escape, "RegExp.escape") \
346346
V(js_explicit_resource_management, "explicit resource management") \
347-
V(js_float16array, \
348-
"Float16Array, Math.f16round, DataView.getFloat16, DataView.setFloat16") \
349347
V(js_base_64, "Uint8Array to/from base64 and hex") \
350348
V(js_esm_ns_reexport, \
351349
"Support diamond-importing re-expored namespaces " \

deps/v8/src/init/bootstrapper.cc

Lines changed: 6 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3483,6 +3483,8 @@ void Genesis::InitializeGlobal(DirectHandle<JSGlobalObject> global_object,
34833483
SimpleInstallFunction(isolate_, math, "exp", Builtin::kMathExp, 1, kAdapt);
34843484
SimpleInstallFunction(isolate_, math, "floor", Builtin::kMathFloor, 1,
34853485
kAdapt);
3486+
SimpleInstallFunction(isolate_, math, "f16round", Builtin::kMathF16round, 1,
3487+
kAdapt);
34863488
SimpleInstallFunction(isolate_, math, "fround", Builtin::kMathFround, 1,
34873489
kAdapt);
34883490
SimpleInstallFunction(isolate_, math, "hypot", Builtin::kMathHypot, 2,
@@ -4330,6 +4332,10 @@ void Genesis::InitializeGlobal(DirectHandle<JSGlobalObject> global_object,
43304332
Builtin::kDataViewPrototypeGetUint32, 1, kDontAdapt);
43314333
SimpleInstallFunction(isolate_, prototype, "setUint32",
43324334
Builtin::kDataViewPrototypeSetUint32, 2, kDontAdapt);
4335+
SimpleInstallFunction(isolate_, prototype, "getFloat16",
4336+
Builtin::kDataViewPrototypeGetFloat16, 1, kDontAdapt);
4337+
SimpleInstallFunction(isolate_, prototype, "setFloat16",
4338+
Builtin::kDataViewPrototypeSetFloat16, 2, kDontAdapt);
43334339
SimpleInstallFunction(isolate_, prototype, "getFloat32",
43344340
Builtin::kDataViewPrototypeGetFloat32, 1, kDontAdapt);
43354341
SimpleInstallFunction(isolate_, prototype, "setFloat32",
@@ -5084,11 +5090,6 @@ DirectHandle<JSFunction> Genesis::InstallTypedArray(
50845090
GetCorrespondingRabGsabElementsKind(elements_kind), 0);
50855091
rab_gsab_initial_map->SetConstructor(*result);
50865092

5087-
if (rab_gsab_initial_map_index == Context::RAB_GSAB_FLOAT16_ARRAY_MAP_INDEX &&
5088-
v8_flags.js_float16array) {
5089-
LOG(isolate(), MapDetails(*rab_gsab_initial_map));
5090-
}
5091-
50925093
native_context()->set(rab_gsab_initial_map_index, *rab_gsab_initial_map,
50935094
UPDATE_WRITE_BARRIER, kReleaseStore);
50945095
Map::SetPrototype(isolate(), rab_gsab_initial_map, prototype);
@@ -5869,34 +5870,6 @@ void Genesis::InitializeGlobal_js_explicit_resource_management() {
58695870
kAdapt);
58705871
}
58715872

5872-
void Genesis::InitializeGlobal_js_float16array() {
5873-
if (!v8_flags.js_float16array) return;
5874-
5875-
DirectHandle<JSGlobalObject> global(native_context()->global_object(),
5876-
isolate());
5877-
DirectHandle<JSObject> math = Cast<JSObject>(
5878-
JSReceiver::GetProperty(isolate(), global, "Math").ToHandleChecked());
5879-
5880-
SimpleInstallFunction(isolate_, math, "f16round", Builtin::kMathF16round, 1,
5881-
kAdapt);
5882-
5883-
DirectHandle<JSObject> dataview_prototype(
5884-
Cast<JSObject>(native_context()->data_view_fun()->instance_prototype()),
5885-
isolate());
5886-
5887-
SimpleInstallFunction(isolate_, dataview_prototype, "getFloat16",
5888-
Builtin::kDataViewPrototypeGetFloat16, 1, kDontAdapt);
5889-
SimpleInstallFunction(isolate_, dataview_prototype, "setFloat16",
5890-
Builtin::kDataViewPrototypeSetFloat16, 2, kDontAdapt);
5891-
5892-
DirectHandle<JSFunction> fun = InstallTypedArray(
5893-
"Float16Array", FLOAT16_ELEMENTS, FLOAT16_TYPED_ARRAY_CONSTRUCTOR_TYPE,
5894-
Context::RAB_GSAB_FLOAT16_ARRAY_MAP_INDEX);
5895-
5896-
InstallWithIntrinsicDefaultProto(isolate_, fun,
5897-
Context::FLOAT16_ARRAY_FUN_INDEX);
5898-
}
5899-
59005873
void Genesis::InitializeGlobal_js_regexp_escape() {
59015874
if (!v8_flags.js_regexp_escape) return;
59025875

deps/v8/src/objects/elements-kind.h

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,10 @@ namespace internal {
2626
V(BigInt64, bigint64, BIGINT64, int64_t) \
2727
V(Uint8Clamped, uint8_clamped, UINT8_CLAMPED, uint8_t) \
2828
V(Float32, float32, FLOAT32, float) \
29-
V(Float64, float64, FLOAT64, double)
29+
V(Float64, float64, FLOAT64, double) \
30+
V(Float16, float16, FLOAT16, uint16_t)
3031

31-
#define TYPED_ARRAYS_FLOAT16(V) V(Float16, float16, FLOAT16, uint16_t)
32-
33-
#define TYPED_ARRAYS(V) \
34-
TYPED_ARRAYS_BASE(V) \
35-
TYPED_ARRAYS_FLOAT16(V)
32+
#define TYPED_ARRAYS(V) TYPED_ARRAYS_BASE(V)
3633

3734
#define RAB_GSAB_TYPED_ARRAYS_BASE(V) \
3835
V(RabGsabUint8, rab_gsab_uint8, RAB_GSAB_UINT8, uint8_t) \
@@ -46,14 +43,10 @@ namespace internal {
4643
V(RabGsabUint8Clamped, rab_gsab_uint8_clamped, RAB_GSAB_UINT8_CLAMPED, \
4744
uint8_t) \
4845
V(RabGsabFloat32, rab_gsab_float32, RAB_GSAB_FLOAT32, float) \
49-
V(RabGsabFloat64, rab_gsab_float64, RAB_GSAB_FLOAT64, double)
50-
51-
#define RAB_GSAB_TYPED_ARRAYS_FLOAT16(V) \
46+
V(RabGsabFloat64, rab_gsab_float64, RAB_GSAB_FLOAT64, double) \
5247
V(RabGsabFloat16, rab_gsab_float16, RAB_GSAB_FLOAT16, uint16_t)
5348

54-
#define RAB_GSAB_TYPED_ARRAYS(V) \
55-
RAB_GSAB_TYPED_ARRAYS_BASE(V) \
56-
RAB_GSAB_TYPED_ARRAYS_FLOAT16(V)
49+
#define RAB_GSAB_TYPED_ARRAYS(V) RAB_GSAB_TYPED_ARRAYS_BASE(V)
5750

5851
// The TypedArrays backed by RAB / GSAB are called Uint8Array, Uint16Array etc,
5952
// and not RabGsabUint8Array, RabGsabUint16Array etc. This macro is used for
@@ -69,14 +62,11 @@ namespace internal {
6962
V(BigInt64, rab_gsab_bigint64, RAB_GSAB_BIGINT64, int64_t) \
7063
V(Uint8Clamped, rab_gsab_uint8_clamped, RAB_GSAB_UINT8_CLAMPED, uint8_t) \
7164
V(Float32, rab_gsab_float32, RAB_GSAB_FLOAT32, float) \
72-
V(Float64, rab_gsab_float64, RAB_GSAB_FLOAT64, double)
73-
74-
#define RAB_GSAB_TYPED_ARRAYS_WITH_TYPED_ARRAY_TYPE_FLOAT16(V) \
65+
V(Float64, rab_gsab_float64, RAB_GSAB_FLOAT64, double) \
7566
V(Float16, rab_gsab_float16, RAB_GSAB_FLOAT16, uint16_t)
7667

7768
#define RAB_GSAB_TYPED_ARRAYS_WITH_TYPED_ARRAY_TYPE(V) \
78-
RAB_GSAB_TYPED_ARRAYS_WITH_TYPED_ARRAY_TYPE_BASE(V) \
79-
RAB_GSAB_TYPED_ARRAYS_WITH_TYPED_ARRAY_TYPE_FLOAT16(V)
69+
RAB_GSAB_TYPED_ARRAYS_WITH_TYPED_ARRAY_TYPE_BASE(V)
8070

8171
// Like RAB_GSAB_TYPED_ARRAYS but has an additional parameter for
8272
// for the corresponding non-RAB/GSAB ElementsKind.
@@ -93,14 +83,11 @@ namespace internal {
9383
V(RabGsabUint8Clamped, rab_gsab_uint8_clamped, RAB_GSAB_UINT8_CLAMPED, \
9484
uint8_t, UINT8_CLAMPED) \
9585
V(RabGsabFloat32, rab_gsab_float32, RAB_GSAB_FLOAT32, float, FLOAT32) \
96-
V(RabGsabFloat64, rab_gsab_float64, RAB_GSAB_FLOAT64, double, FLOAT64)
97-
98-
#define RAB_GSAB_TYPED_ARRAYS_WITH_NON_RAB_GSAB_ELEMENTS_KIND_FLOAT16(V) \
86+
V(RabGsabFloat64, rab_gsab_float64, RAB_GSAB_FLOAT64, double, FLOAT64) \
9987
V(RabGsabFloat16, rab_gsab_float16, RAB_GSAB_FLOAT16, uint16_t, FLOAT16)
10088

10189
#define RAB_GSAB_TYPED_ARRAYS_WITH_NON_RAB_GSAB_ELEMENTS_KIND(V) \
102-
RAB_GSAB_TYPED_ARRAYS_WITH_NON_RAB_GSAB_ELEMENTS_KIND_BASE(V) \
103-
RAB_GSAB_TYPED_ARRAYS_WITH_NON_RAB_GSAB_ELEMENTS_KIND_FLOAT16(V)
90+
RAB_GSAB_TYPED_ARRAYS_WITH_NON_RAB_GSAB_ELEMENTS_KIND_BASE(V)
10491

10592
enum ElementsKind : uint8_t {
10693
// The "fast" kind for elements that only contain SMI values. Must be first

deps/v8/src/objects/value-serializer.cc

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2301,13 +2301,6 @@ MaybeDirectHandle<JSArrayBufferView> ValueDeserializer::ReadJSArrayBufferView(
23012301
break;
23022302
TYPED_ARRAYS_BASE(TYPED_ARRAY_CASE)
23032303
#undef TYPED_ARRAY_CASE
2304-
case ArrayBufferViewTag::kFloat16Array: {
2305-
if (i::v8_flags.js_float16array) {
2306-
external_array_type = kExternalFloat16Array;
2307-
element_size = sizeof(uint16_t);
2308-
}
2309-
break;
2310-
}
23112304
}
23122305
if (element_size == 0 || byte_offset % element_size != 0 ||
23132306
byte_length % element_size != 0) {

deps/v8/test/cctest/test-inobject-slack-tracking.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1100,7 +1100,6 @@ TEST(SubclassArrayBuiltinNoInlineNew) {
11001100

11011101

11021102
TEST(SubclassTypedArrayBuiltin) {
1103-
v8_flags.js_float16array = true;
11041103
CcTest::InitializeVM();
11051104
v8::HandleScope scope(CcTest::isolate());
11061105

deps/v8/test/cctest/test-typedarrays.cc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,28 +115,24 @@ void TestSpeciesProtector(char* code,
115115
}
116116

117117
UNINITIALIZED_TEST(SpeciesConstructor) {
118-
v8_flags.js_float16array = true;
119118
char code[] = "x.constructor = MyTypedArray";
120119
TestSpeciesProtector(code);
121120
}
122121

123122
UNINITIALIZED_TEST(SpeciesConstructorAccessor) {
124-
v8_flags.js_float16array = true;
125123
char code[] =
126124
"Object.defineProperty(x, 'constructor',{get() {return MyTypedArray;}})";
127125
TestSpeciesProtector(code);
128126
}
129127

130128
UNINITIALIZED_TEST(SpeciesModified) {
131-
v8_flags.js_float16array = true;
132129
char code[] =
133130
"Object.defineProperty(constructor, Symbol.species, "
134131
"{value:MyTypedArray})";
135132
TestSpeciesProtector(code);
136133
}
137134

138135
UNINITIALIZED_TEST(SpeciesParentConstructor) {
139-
v8_flags.js_float16array = true;
140136
char code[] = "constructor.prototype.constructor = MyTypedArray";
141137
TestSpeciesProtector(code);
142138
}

deps/v8/test/test262/testcfg.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@
5959
'import-attributes': '--harmony-import-attributes',
6060
'regexp-duplicate-named-groups': '--js-regexp-duplicate-named-groups',
6161
'regexp-modifiers': '--js-regexp-modifiers',
62-
'Float16Array': '--js-float16array',
6362
'explicit-resource-management': '--js-explicit-resource-management',
6463
'decorators': '--js-decorators',
6564
'promise-try': '--js-promise-try',

0 commit comments

Comments
 (0)