Skip to content

deps: enable new JS features the V8 way #58230

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed
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 @@ -38,7 +38,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.13',
'v8_embedder_string': '-node.16',

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

Expand Down
2 changes: 1 addition & 1 deletion deps/v8/include/v8-version.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#define V8_MAJOR_VERSION 13
#define V8_MINOR_VERSION 6
#define V8_BUILD_NUMBER 233
#define V8_PATCH_LEVEL 8
#define V8_PATCH_LEVEL 10

// Use 1 for candidates and 0 otherwise.
// (Boolean macro values are not supported by all preprocessors.)
Expand Down
34 changes: 17 additions & 17 deletions deps/v8/infra/testing/builders.pyl
Original file line number Diff line number Diff line change
Expand Up @@ -1050,7 +1050,7 @@
'v8_mac64_asan_rel': {
'swarming_dimensions' : {
'cpu': 'x86-64',
'os': 'Mac-14',
'os': 'Mac-15',
},
'tests': [
{'name': 'v8testing', 'shards': 8},
Expand All @@ -1059,7 +1059,7 @@
'v8_mac64_dbg': {
'swarming_dimensions' : {
'cpu': 'x86-64',
'os': 'Mac-14',
'os': 'Mac-15',
},
'tests': [
{'name': 'mozilla'},
Expand All @@ -1074,7 +1074,7 @@
'v8_mac_arm64_gc_stress_dbg': {
'swarming_dimensions' : {
'cpu': 'arm64',
'os': 'Mac-14',
'os': 'Mac-15',
},
'tests': [
{'name': 'd8testing', 'test_args': ['--gc-stress'], 'shards': 3},
Expand All @@ -1083,7 +1083,7 @@
'v8_mac64_noopt_dbg': {
'swarming_dimensions' : {
'cpu': 'x86-64',
'os': 'Mac-14',
'os': 'Mac-15',
},
'tests': [
{'name': 'v8testing', 'shards': 6},
Expand All @@ -1092,7 +1092,7 @@
'v8_mac64_rel': {
'swarming_dimensions' : {
'cpu': 'x86-64',
'os': 'Mac-14',
'os': 'Mac-15',
},
'tests': [
{'name': 'mozilla'},
Expand All @@ -1107,7 +1107,7 @@
'v8_mac_arm64_rel': {
'swarming_dimensions' : {
'cpu': 'arm64',
'os': 'Mac-14',
'os': 'Mac-15',
'pool': 'chromium.tests',
},
'tests': [
Expand All @@ -1128,7 +1128,7 @@
'v8_mac_arm64_dbg': {
'swarming_dimensions' : {
'cpu': 'arm64',
'os': 'Mac-14',
'os': 'Mac-15',
'pool': 'chromium.tests',
},
'tests': [
Expand All @@ -1149,7 +1149,7 @@
'v8_mac_arm64_full_dbg': {
'swarming_dimensions' : {
'cpu': 'arm64',
'os': 'Mac-14',
'os': 'Mac-15',
'pool': 'chromium.tests',
},
'tests': [
Expand All @@ -1170,7 +1170,7 @@
'v8_mac_arm64_no_pointer_compression_dbg': {
'swarming_dimensions' : {
'cpu': 'arm64',
'os': 'Mac-14',
'os': 'Mac-15',
'pool': 'chromium.tests',
},
'tests': [
Expand Down Expand Up @@ -2026,7 +2026,7 @@
'V8 Mac64': {
'swarming_dimensions': {
'cpu': 'x86-64',
'os': 'Mac-14',
'os': 'Mac-15',
},
'tests': [
{'name': 'mozilla'},
Expand All @@ -2041,7 +2041,7 @@
'V8 Mac64 - debug': {
'swarming_dimensions': {
'cpu': 'x86-64',
'os': 'Mac-14',
'os': 'Mac-15',
},
'tests': [
{'name': 'mozilla'},
Expand All @@ -2056,7 +2056,7 @@
'V8 Mac64 ASAN': {
'swarming_dimensions': {
'cpu': 'x86-64',
'os': 'Mac-14',
'os': 'Mac-15',
},
'tests': [
{'name': 'v8testing', 'shards': 10},
Expand All @@ -2065,15 +2065,15 @@
'V8 Mac - arm64 - gc stress': {
'swarming_dimensions': {
'cpu': 'arm64',
'os': 'Mac-14',
'os': 'Mac-15',
},
'tests': [
{'name': 'd8testing', 'test_args': ['--gc-stress'], 'shards': 3},
],
},
'V8 Mac - arm64': {
'swarming_dimensions' : {
'os': 'Mac-14',
'os': 'Mac-15',
'cpu': 'arm64',
'pool': 'chromium.tests',
},
Expand All @@ -2095,7 +2095,7 @@
},
'V8 Mac - arm64 - release': {
'swarming_dimensions' : {
'os': 'Mac-14',
'os': 'Mac-15',
'cpu': 'arm64',
'pool': 'chromium.tests',
},
Expand All @@ -2117,7 +2117,7 @@
},
'V8 Mac - arm64 - debug': {
'swarming_dimensions' : {
'os': 'Mac-14',
'os': 'Mac-15',
'cpu': 'arm64',
'pool': 'chromium.tests',
},
Expand All @@ -2140,7 +2140,7 @@
'V8 Mac - arm64 - no pointer compression debug': {
'swarming_dimensions' : {
'cpu': 'arm64',
'os': 'Mac-14',
'os': 'Mac-15',
'pool': 'chromium.tests',
},
'tests': [
Expand Down
12 changes: 6 additions & 6 deletions deps/v8/src/flags/flag-definitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -294,10 +294,7 @@ DEFINE_BOOL(js_shipping, true, "enable all shipped JavaScript features")

// Features that are complete (but still behind the --harmony flag).
#define HARMONY_STAGED_BASE(V)
#define JAVASCRIPT_STAGED_FEATURES_BASE(V) \
V(js_explicit_resource_management, "explicit resource management") \
V(js_float16array, \
"Float16Array, Math.f16round, DataView.getFloat16, DataView.setFloat16")
#define JAVASCRIPT_STAGED_FEATURES_BASE(V)

#ifdef V8_INTL_SUPPORT
#define HARMONY_STAGED(V) \
Expand All @@ -311,7 +308,7 @@ DEFINE_BOOL(js_shipping, true, "enable all shipped JavaScript features")
#endif

// Features that are shipping (turned on by default, but internal flag remains).
#define HARMONY_SHIPPING_BASE(V) \
#define HARMONY_SHIPPING_BASE(V) \
V(harmony_import_attributes, "harmony import attributes")

#define JAVASCRIPT_SHIPPING_FEATURES_BASE(V) \
Expand All @@ -320,7 +317,10 @@ DEFINE_BOOL(js_shipping, true, "enable all shipped JavaScript features")
V(js_promise_try, "Promise.try") \
V(js_atomics_pause, "Atomics.pause") \
V(js_error_iserror, "Error.isError") \
V(js_regexp_escape, "RegExp.escape")
V(js_regexp_escape, "RegExp.escape") \
V(js_explicit_resource_management, "explicit resource management") \
V(js_float16array, \
"Float16Array, Math.f16round, DataView.getFloat16, DataView.setFloat16")

#ifdef V8_INTL_SUPPORT
#define HARMONY_SHIPPING(V) HARMONY_SHIPPING_BASE(V)
Expand Down
5 changes: 5 additions & 0 deletions deps/v8/src/init/bootstrapper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5211,6 +5211,11 @@ 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
16 changes: 9 additions & 7 deletions deps/v8/src/parsing/parser-base.h
Original file line number Diff line number Diff line change
Expand Up @@ -1165,16 +1165,18 @@ class ParserBase {
}
bool is_using_allowed() const {
// UsingDeclaration and AwaitUsingDeclaration are Syntax Errors if the goal
// symbol is Script. UsingDeclaration and AwaitUsingDeclaration are not
// contained, either directly or indirectly, within a Block, CaseBlock,
// ForStatement, ForInOfStatement, FunctionBody, GeneratorBody,
// symbol is Script. UsingDeclaration and AwaitUsingDeclaration are Syntax
// Errors if they are not contained, either directly or indirectly, within a
// Block, ForStatement, ForInOfStatement, FunctionBody, GeneratorBody,
// AsyncGeneratorBody, AsyncFunctionBody, ClassStaticBlockBody, or
// ClassBody. Unless the current scope's ScopeType is ScriptScope, the
// ClassBody. They are disallowed in 'bare' switch cases.
// Unless the current scope's ScopeType is ScriptScope, the
// current position is directly or indirectly within one of the productions
// listed above since they open a new scope.
return ((scope()->scope_type() != SCRIPT_SCOPE &&
scope()->scope_type() != EVAL_SCOPE) ||
scope()->scope_type() == REPL_MODE_SCOPE);
return (((scope()->scope_type() != SCRIPT_SCOPE &&
scope()->scope_type() != EVAL_SCOPE) ||
scope()->scope_type() == REPL_MODE_SCOPE) &&
!scope()->is_nonlinear());
}
bool IsNextUsingKeyword(Token::Value token_after_using, bool is_await_using) {
// using and await using declarations in for-of statements must be followed
Expand Down
2 changes: 1 addition & 1 deletion deps/v8/test/mjsunit/es6/iterator-prototype.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ var iteratorPrototype = arrayIteratorPrototype.__proto__;
assertSame(Object.prototype, Object.getPrototypeOf(iteratorPrototype));
assertTrue(Object.isExtensible(iteratorPrototype));
assertSame(12, Object.getOwnPropertyNames(iteratorPrototype).length);
assertSame(2, Object.getOwnPropertySymbols(iteratorPrototype).length);
assertSame(3, Object.getOwnPropertySymbols(iteratorPrototype).length);
assertSame(Symbol.iterator,
Object.getOwnPropertySymbols(iteratorPrototype)[0]);

Expand Down
8 changes: 4 additions & 4 deletions deps/v8/test/test262/test262.status
Original file line number Diff line number Diff line change
Expand Up @@ -1277,6 +1277,10 @@
# May OOM fatally
'staging/sm/regress/regress-610026': [SKIP],

# https://github.com/rbuckton/ecma262/pull/14
'staging/explicit-resource-management/await-using-in-switch-case-block': [SKIP],
'staging/explicit-resource-management/call-dispose-methods': [SKIP],

############################ SLOW TESTS #############################

'annexB/built-ins/RegExp/RegExp-leading-escape-BMP': [PASS, SLOW],
Expand Down Expand Up @@ -2496,7 +2500,6 @@
'staging/sm/Temporal/PlainMonthDay/from-coptic': [FAIL],
'staging/sm/Temporal/PlainMonthDay/from-gregory': [FAIL],
'staging/sm/Temporal/PlainMonthDay/result-not-after-1972-dec-31': [FAIL],
'staging/sm/Math/f16round': [FAIL],
'staging/sm/RegExp/unicode-ignoreCase': [FAIL],
'staging/sm/String/string-code-point-upper-lower-mapping': [FAIL],
'staging/sm/String/string-upper-lower-mapping': [FAIL],
Expand All @@ -2507,13 +2510,10 @@
'staging/sm/TypedArray/prototype-constructor-identity': [FAIL],
'staging/sm/TypedArray/set-detached-bigint': [FAIL],
'staging/sm/TypedArray/seal-and-freeze': [FAIL],
'staging/sm/TypedArray/sort-negative-nan': [FAIL],
'staging/sm/TypedArray/sort_small': [FAIL],
'staging/sm/TypedArray/test-integrity-level': [FAIL],
'staging/sm/TypedArray/test-integrity-level-detached': [FAIL],
'staging/sm/TypedArray/toReversed-detached': [FAIL],
'staging/sm/TypedArray/toSorted-detached': [FAIL],
'staging/sm/TypedArray/toString': [FAIL],
'staging/sm/TypedArray/with': [FAIL],
'staging/sm/TypedArray/with-detached': [FAIL],
}],
Expand Down
29 changes: 29 additions & 0 deletions deps/v8/test/unittests/parser/decls-unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1082,6 +1082,24 @@ TEST_F(DeclsTest, TestUsing) {
EXPECT_ERROR);
context.Check("{var using; \n using = 42;}", EXPECT_RESULT,
Number::New(isolate(), 42));
context.Check(
"let label = \"1\"; \n switch (label) { \n case 1: \n let y = 2; \n"
"using x = { \n "
" value: 1, \n "
" [Symbol.dispose]() { \n "
" return 42; \n "
" } \n "
" }; }",
EXPECT_ERROR);
context.Check(
"let label = \"1\"; \n switch (label) { \n case 1: {\n let y = 2; \n"
"using x = { \n "
" value: 1, \n "
" [Symbol.dispose]() { \n "
" return 42; \n "
" } \n "
" }; } }",
EXPECT_RESULT, Undefined(isolate()));
}
}

Expand Down Expand Up @@ -1144,6 +1162,17 @@ TEST_F(DeclsTest, TestAwaitUsing) {
" } } \n "
" f(); ",
EXPECT_ERROR);
context.Check(
"async function f() {let label = \"1\"; \n switch (label){ \n case 1: "
"\n let y = 2;"
"\n await using x = { \n "
" value: 1, \n "
" [Symbol.asyncDispose]() { \n "
" classStaticBlockBodyValues.push(42); \n "
" } \n "
" }; \n }"
"} \n f();",
EXPECT_ERROR);
}
}

Expand Down
5 changes: 0 additions & 5 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -845,11 +845,6 @@ static ExitCode InitializeNodeWithArgsInternal(
// is security relevant, for Node it's less important.
V8::SetFlagsFromString("--no-freeze-flags-after-init");

// These features are completed and enabled by default in Chrome, but not
// in V8.
V8::SetFlagsFromString("--js-explicit-resource-management");
V8::SetFlagsFromString("--js-float16array");

#if defined(NODE_V8_OPTIONS)
// Should come before the call to V8::SetFlagsFromCommandLine()
// so the user can disable a flag --foo at run-time by passing
Expand Down
Loading