Skip to content

Commit

Permalink
deps: V8: backport 0d5d6e71bbb0
Browse files Browse the repository at this point in the history
Original commit message:

    Remove `--js-promise-withresolvers` runtime flag

    Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
    Bug: 42204122
    Change-Id: I017a0d1ae0f8225513206ffb7806a4250be75d4c
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5843972
    Reviewed-by: Igor Sheludko <ishell@chromium.org>
    Commit-Queue: Erik Corry <erikcorry@chromium.org>
    Reviewed-by: Shu-yu Guo <syg@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#96215}

Refs: v8/v8@0d5d6e7
PR-URL: #55115
Backport-PR-URL: #55260
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
  • Loading branch information
anonrig authored and aduh95 committed Oct 8, 2024
1 parent 2f65b3f commit b533a51
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 22 deletions.
2 changes: 1 addition & 1 deletion common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,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.20',
'v8_embedder_string': '-node.21',

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

Expand Down
3 changes: 1 addition & 2 deletions deps/v8/src/flags/flag-definitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,7 @@ DEFINE_BOOL(js_shipping, true, "enable all shipped JavaScript features")
V(harmony_set_methods, "harmony Set Methods") \
V(harmony_import_attributes, "harmony import attributes")

#define JAVASCRIPT_SHIPPING_FEATURES_BASE(V) \
V(js_promise_withresolvers, "Promise.withResolvers")
#define JAVASCRIPT_SHIPPING_FEATURES_BASE(V)

#ifdef V8_INTL_SUPPORT
#define HARMONY_SHIPPING(V) HARMONY_SHIPPING_BASE(V)
Expand Down
26 changes: 9 additions & 17 deletions deps/v8/src/init/bootstrapper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3217,6 +3217,15 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
InstallFunctionWithBuiltinId(isolate_, promise_fun, "reject",
Builtin::kPromiseReject, 1, true);

std::array<Handle<Name>, 3> fields{factory->promise_string(),
factory->resolve_string(),
factory->reject_string()};
DirectHandle<Map> result_map =
CreateLiteralObjectMapFromCache(isolate_, fields);
native_context()->set_promise_withresolvers_result_map(*result_map);
InstallFunctionWithBuiltinId(isolate_, promise_fun, "withResolvers",
Builtin::kPromiseWithResolvers, 0, true);

SetConstructorInstanceType(isolate_, promise_fun,
JS_PROMISE_CONSTRUCTOR_TYPE);

Expand Down Expand Up @@ -5445,23 +5454,6 @@ void Genesis::InitializeGlobal_harmony_iterator_helpers() {
#undef ITERATOR_HELPERS
}

void Genesis::InitializeGlobal_js_promise_withresolvers() {
if (!v8_flags.js_promise_withresolvers) return;

Factory* factory = isolate()->factory();

std::array<Handle<Name>, 3> fields{factory->promise_string(),
factory->resolve_string(),
factory->reject_string()};
Handle<Map> result_map = CreateLiteralObjectMapFromCache(isolate(), fields);
native_context()->set_promise_withresolvers_result_map(*result_map);

Handle<JSFunction> promise_fun =
handle(native_context()->promise_function(), isolate());
InstallFunctionWithBuiltinId(isolate(), promise_fun, "withResolvers",
Builtin::kPromiseWithResolvers, 0, true);
}

void Genesis::InitializeGlobal_harmony_set_methods() {
if (!v8_flags.harmony_set_methods) return;

Expand Down
2 changes: 1 addition & 1 deletion deps/v8/test/mjsunit/harmony/promise-withresolvers.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Flags: --js-promise-withresolvers --allow-natives-syntax
// Flags: --allow-natives-syntax

const desc = Object.getOwnPropertyDescriptor(Promise, 'withResolvers');
assertTrue(desc.configurable);
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 @@ -58,7 +58,6 @@
'json-parse-with-source': '--harmony-json-parse-with-source',
'iterator-helpers': '--harmony-iterator-helpers',
'set-methods': '--harmony-set-methods',
'promise-with-resolvers': '--js-promise-withresolvers',
'Array.fromAsync': '--harmony-array-from-async',
'import-attributes': '--harmony-import-attributes',
'regexp-duplicate-named-groups': '--js-regexp-duplicate-named-groups',
Expand Down

0 comments on commit b533a51

Please sign in to comment.