Skip to content

Commit 557271e

Browse files
o-joyeecheung
authored 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> PR-URL: #65702 Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Filip Skokan <panva.ip@gmail.com> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com> r-li.patch
1 parent 18ee14f commit 557271e

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
@@ -43,7 +43,7 @@
4343

4444
# Reset this number to 0 on major V8 upgrades.
4545
# Increment by one for each non-official patch applied to deps/v8.
46-
'v8_embedder_string': '-node.11',
46+
'v8_embedder_string': '-node.12',
4747

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

deps/v8/src/api/api.cc

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -3866,14 +3866,6 @@ bool Value::IsTypedArray() const {
38663866
TYPED_ARRAYS_BASE(VALUE_IS_TYPED_ARRAY)
38673867
#undef VALUE_IS_TYPED_ARRAY
38683868

3869-
bool Value::IsFloat16Array() const {
3870-
auto obj = *Utils::OpenDirectHandle(this);
3871-
return i::IsJSTypedArray(obj) &&
3872-
i::Cast<i::JSTypedArray>(obj)->type() == i::kExternalFloat16Array &&
3873-
Utils::ApiCheck(i::v8_flags.js_float16array, "Value::IsFloat16Array",
3874-
"Float16Array is not supported");
3875-
}
3876-
38773869
bool Value::IsDataView() const {
38783870
auto obj = *Utils::OpenDirectHandle(this);
38793871
return IsJSDataView(obj) || IsJSRabGsabDataView(obj);
@@ -4410,16 +4402,6 @@ void v8::TypedArray::CheckCast(Value* that) {
44104402
TYPED_ARRAYS_BASE(CHECK_TYPED_ARRAY_CAST)
44114403
#undef CHECK_TYPED_ARRAY_CAST
44124404

4413-
void v8::Float16Array::CheckCast(Value* that) {
4414-
Utils::ApiCheck(i::v8_flags.js_float16array, "v8::Float16Array::Cast",
4415-
"Float16Array is not supported");
4416-
auto obj = *Utils::OpenDirectHandle(that);
4417-
Utils::ApiCheck(
4418-
i::IsJSTypedArray(obj) &&
4419-
i::Cast<i::JSTypedArray>(obj)->type() == i::kExternalFloat16Array,
4420-
"v8::Float16Array::Cast()", "Value is not a Float16Array");
4421-
}
4422-
44234405
void v8::DataView::CheckCast(Value* that) {
44244406
auto obj = *Utils::OpenDirectHandle(that);
44254407
Utils::ApiCheck(i::IsJSDataView(obj) || IsJSRabGsabDataView(obj),
@@ -9560,44 +9542,6 @@ static_assert(v8::TypedArray::kMaxByteLength == i::JSTypedArray::kMaxByteLength,
95609542
TYPED_ARRAYS_BASE(TYPED_ARRAY_NEW)
95619543
#undef TYPED_ARRAY_NEW
95629544

9563-
Local<Float16Array> Float16Array::New(Local<ArrayBuffer> array_buffer,
9564-
size_t byte_offset, size_t length) {
9565-
Utils::ApiCheck(i::v8_flags.js_float16array, "v8::Float16Array::New",
9566-
"Float16Array is not supported");
9567-
i::Isolate* i_isolate = i::Isolate::Current();
9568-
ApiRuntimeCallStatsScope rcs_scope(i_isolate, RCCId::kAPI_Float16Array_New);
9569-
EnterV8NoScriptNoExceptionScope api_scope(i_isolate);
9570-
if (!Utils::ApiCheck(
9571-
length <= kMaxLength,
9572-
"v8::Float16Array::New(Local<ArrayBuffer>, size_t, size_t)",
9573-
"length exceeds max allowed value")) {
9574-
return {};
9575-
}
9576-
auto buffer = Utils::OpenDirectHandle(*array_buffer);
9577-
i::DirectHandle<i::JSTypedArray> obj = i_isolate->factory()->NewJSTypedArray(
9578-
i::kExternalFloat16Array, buffer, byte_offset, length);
9579-
return Utils::ToLocalFloat16Array(obj);
9580-
}
9581-
Local<Float16Array> Float16Array::New(
9582-
Local<SharedArrayBuffer> shared_array_buffer, size_t byte_offset,
9583-
size_t length) {
9584-
Utils::ApiCheck(i::v8_flags.js_float16array, "v8::Float16Array::New",
9585-
"Float16Array is not supported");
9586-
i::Isolate* i_isolate = i::Isolate::Current();
9587-
ApiRuntimeCallStatsScope rcs_scope(i_isolate, RCCId::kAPI_Float16Array_New);
9588-
EnterV8NoScriptNoExceptionScope api_scope(i_isolate);
9589-
if (!Utils::ApiCheck(
9590-
length <= kMaxLength,
9591-
"v8::Float16Array::New(Local<SharedArrayBuffer>, size_t, size_t)",
9592-
"length exceeds max allowed value")) {
9593-
return {};
9594-
}
9595-
auto buffer = Utils::OpenDirectHandle(*shared_array_buffer);
9596-
i::DirectHandle<i::JSTypedArray> obj = i_isolate->factory()->NewJSTypedArray(
9597-
i::kExternalFloat16Array, buffer, byte_offset, length);
9598-
return Utils::ToLocalFloat16Array(obj);
9599-
}
9600-
96019545
// TODO(v8:11111): Support creating length tracking DataViews via the API.
96029546
Local<DataView> DataView::New(Local<ArrayBuffer> array_buffer,
96039547
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
@@ -879,12 +879,6 @@ Builtins::JSBuiltinStateFlags Builtins::GetJSBuiltinState(Builtin builtin) {
879879
RETURN_FLAG_DEPENDENT_BUILTIN_STATE(
880880
v8_flags.js_explicit_resource_management);
881881

882-
// --js-float16array
883-
case Builtin::kMathF16round:
884-
case Builtin::kDataViewPrototypeGetFloat16:
885-
case Builtin::kDataViewPrototypeSetFloat16:
886-
RETURN_FLAG_DEPENDENT_BUILTIN_STATE(v8_flags.js_float16array);
887-
888882
// --js-base-64
889883
case Builtin::kUint8ArrayFromBase64:
890884
case Builtin::kUint8ArrayFromHex:

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,8 +379,6 @@ DEFINE_BOOL(js_shipping, true, "enable all shipped JavaScript features")
379379
V(js_error_iserror, "Error.isError") \
380380
V(js_regexp_escape, "RegExp.escape") \
381381
V(js_explicit_resource_management, "explicit resource management") \
382-
V(js_float16array, \
383-
"Float16Array, Math.f16round, DataView.getFloat16, DataView.setFloat16") \
384382
V(js_base_64, "Uint8Array to/from base64 and hex") \
385383
V(js_esm_ns_reexport, \
386384
"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
@@ -3514,6 +3514,8 @@ void Genesis::InitializeGlobal(DirectHandle<JSGlobalObject> global_object,
35143514
SimpleInstallFunction(isolate_, math, "exp", Builtin::kMathExp, 1, kAdapt);
35153515
SimpleInstallFunction(isolate_, math, "floor", Builtin::kMathFloor, 1,
35163516
kAdapt);
3517+
SimpleInstallFunction(isolate_, math, "f16round", Builtin::kMathF16round, 1,
3518+
kAdapt);
35173519
SimpleInstallFunction(isolate_, math, "fround", Builtin::kMathFround, 1,
35183520
kAdapt);
35193521
SimpleInstallFunction(isolate_, math, "hypot", Builtin::kMathHypot, 2,
@@ -4373,6 +4375,10 @@ void Genesis::InitializeGlobal(DirectHandle<JSGlobalObject> global_object,
43734375
Builtin::kDataViewPrototypeGetUint32, 1, kDontAdapt);
43744376
SimpleInstallFunction(isolate_, prototype, "setUint32",
43754377
Builtin::kDataViewPrototypeSetUint32, 2, kDontAdapt);
4378+
SimpleInstallFunction(isolate_, prototype, "getFloat16",
4379+
Builtin::kDataViewPrototypeGetFloat16, 1, kDontAdapt);
4380+
SimpleInstallFunction(isolate_, prototype, "setFloat16",
4381+
Builtin::kDataViewPrototypeSetFloat16, 2, kDontAdapt);
43764382
SimpleInstallFunction(isolate_, prototype, "getFloat32",
43774383
Builtin::kDataViewPrototypeGetFloat32, 1, kDontAdapt);
43784384
SimpleInstallFunction(isolate_, prototype, "setFloat32",
@@ -5129,11 +5135,6 @@ DirectHandle<JSFunction> Genesis::InstallTypedArray(
51295135
GetCorrespondingRabGsabElementsKind(elements_kind), 0);
51305136
rab_gsab_initial_map->SetConstructor(*result);
51315137

5132-
if (rab_gsab_initial_map_index == Context::RAB_GSAB_FLOAT16_ARRAY_MAP_INDEX &&
5133-
v8_flags.js_float16array) {
5134-
LOG(isolate(), MapDetails(*rab_gsab_initial_map));
5135-
}
5136-
51375138
native_context()->set(rab_gsab_initial_map_index, *rab_gsab_initial_map,
51385139
UPDATE_WRITE_BARRIER, kReleaseStore);
51395140
Map::SetPrototype(isolate(), rab_gsab_initial_map, prototype);
@@ -5970,34 +5971,6 @@ void Genesis::InitializeGlobal_js_explicit_resource_management() {
59705971
kAdapt);
59715972
}
59725973

5973-
void Genesis::InitializeGlobal_js_float16array() {
5974-
if (!v8_flags.js_float16array) return;
5975-
5976-
DirectHandle<JSGlobalObject> global(native_context()->global_object(),
5977-
isolate());
5978-
DirectHandle<JSObject> math = Cast<JSObject>(
5979-
JSReceiver::GetProperty(isolate(), global, "Math").ToHandleChecked());
5980-
5981-
SimpleInstallFunction(isolate_, math, "f16round", Builtin::kMathF16round, 1,
5982-
kAdapt);
5983-
5984-
DirectHandle<JSObject> dataview_prototype(
5985-
Cast<JSObject>(native_context()->data_view_fun()->instance_prototype()),
5986-
isolate());
5987-
5988-
SimpleInstallFunction(isolate_, dataview_prototype, "getFloat16",
5989-
Builtin::kDataViewPrototypeGetFloat16, 1, kDontAdapt);
5990-
SimpleInstallFunction(isolate_, dataview_prototype, "setFloat16",
5991-
Builtin::kDataViewPrototypeSetFloat16, 2, kDontAdapt);
5992-
5993-
DirectHandle<JSFunction> fun = InstallTypedArray(
5994-
"Float16Array", FLOAT16_ELEMENTS, FLOAT16_TYPED_ARRAY_CONSTRUCTOR_TYPE,
5995-
Context::RAB_GSAB_FLOAT16_ARRAY_MAP_INDEX);
5996-
5997-
InstallWithIntrinsicDefaultProto(isolate_, fun,
5998-
Context::FLOAT16_ARRAY_FUN_INDEX);
5999-
}
6000-
60015974
void Genesis::InitializeGlobal_js_regexp_escape() {
60025975
if (!v8_flags.js_regexp_escape) return;
60035976

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
@@ -2284,13 +2284,6 @@ MaybeDirectHandle<JSArrayBufferView> ValueDeserializer::ReadJSArrayBufferView(
22842284
break;
22852285
TYPED_ARRAYS_BASE(TYPED_ARRAY_CASE)
22862286
#undef TYPED_ARRAY_CASE
2287-
case ArrayBufferViewTag::kFloat16Array: {
2288-
if (i::v8_flags.js_float16array) {
2289-
external_array_type = kExternalFloat16Array;
2290-
element_size = sizeof(uint16_t);
2291-
}
2292-
break;
2293-
}
22942287
}
22952288
if (element_size == 0 || byte_offset % element_size != 0 ||
22962289
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)