[v8:13321] Add a flag and a builtin for Array.fromAsync.

Added a flag to implemet Array.fromAsync behind it,
and added a builtin in builtin-array.cc for the implementation
of the feature.

Bug: v8:13321
Change-Id: I5498f5bbc4616594efdcf9be8f74dd46afe7a0b7
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4204827
Commit-Queue: Rezvan Mahdavi Hezaveh <rezvan@chromium.org>
Reviewed-by: Shu-yu Guo <syg@chromium.org>
Cr-Commit-Position: refs/heads/main@{#85573}
This commit is contained in:
Rezvan Mahdavi Hezaveh 2023-01-31 22:29:46 +00:00 committed by V8 LUCI CQ
parent 04b766ad80
commit f891b0697d
4 changed files with 14 additions and 1 deletions

View File

@ -1849,5 +1849,12 @@ BUILTIN(ArrayPrototypeGroupToMap) {
return *map;
}
BUILTIN(ArrayFromAsync) {
HandleScope scope(isolate);
DCHECK(v8_flags.harmony_array_from_async);
return ReadOnlyRoots(isolate).undefined_value();
}
} // namespace internal
} // namespace v8

View File

@ -398,6 +398,7 @@ namespace internal {
CPP(ArrayShift) \
/* ES6 #sec-array.prototype.unshift */ \
CPP(ArrayUnshift) \
CPP(ArrayFromAsync) \
/* Support for Array.from and other array-copying idioms */ \
TFS(CloneFastJSArray, kSource) \
TFS(CloneFastJSArrayFillingHoles, kSource) \

View File

@ -224,7 +224,8 @@ DEFINE_BOOL(harmony_shipping, true, "enable all shipped harmony features")
V(harmony_temporal, "Temporal") \
V(harmony_shadow_realm, "harmony ShadowRealm") \
V(harmony_struct, "harmony structs, shared structs, and shared arrays") \
V(harmony_json_parse_with_source, "harmony json parse with source")
V(harmony_json_parse_with_source, "harmony json parse with source") \
V(harmony_array_from_async, "harmony Array.fromAsync")
#ifdef V8_INTL_SUPPORT
#define HARMONY_INPROGRESS(V) \

View File

@ -4821,6 +4821,10 @@ void Genesis::InitializeGlobal_harmony_weak_refs_with_cleanup_some() {
DONT_ENUM);
}
void Genesis::InitializeGlobal_harmony_array_from_async() {
if (!v8_flags.harmony_array_from_async) return;
}
void Genesis::InitializeGlobal_regexp_linear_flag() {
if (!v8_flags.enable_experimental_regexp_engine) return;