Skip to content
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

deps: V8: cherry-pick ca5b0ec #30708

Closed
wants to merge 2 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion common.gypi
Expand Up @@ -39,7 +39,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
10 changes: 6 additions & 4 deletions deps/v8/src/heap/factory.cc
Expand Up @@ -3070,20 +3070,22 @@ Handle<SyntheticModule> Factory::NewSyntheticModule(
Handle<String> module_name, Handle<FixedArray> export_names,
v8::Module::SyntheticModuleEvaluationSteps evaluation_steps) {
ReadOnlyRoots roots(isolate());
Handle<SyntheticModule> module(
SyntheticModule::cast(New(synthetic_module_map(), AllocationType::kOld)),
isolate());

Handle<ObjectHashTable> exports =
ObjectHashTable::New(isolate(), static_cast<int>(export_names->length()));
Handle<Foreign> evaluation_steps_foreign =
NewForeign(reinterpret_cast<i::Address>(evaluation_steps));
module->set_exports(*exports);

Handle<SyntheticModule> module(
SyntheticModule::cast(New(synthetic_module_map(), AllocationType::kOld)),
isolate());
module->set_hash(isolate()->GenerateIdentityHash(Smi::kMaxValue));
module->set_module_namespace(roots.undefined_value());
module->set_status(Module::kUninstantiated);
module->set_exception(roots.the_hole_value());
module->set_name(*module_name);
module->set_export_names(*export_names);
module->set_exports(*exports);
module->set_evaluation_steps(*evaluation_steps_foreign);
return module;
}
Expand Down
25 changes: 25 additions & 0 deletions deps/v8/test/cctest/test-api.cc
Expand Up @@ -23918,6 +23918,31 @@ TEST(CreateSyntheticModule) {
CHECK_EQ(i_module->status(), i::Module::kInstantiated);
}

TEST(CreateSyntheticModuleGC) {
// Try to make sure that CreateSyntheticModule() deals well with a GC
// happening during its execution.
i::FLAG_gc_interval = 10;
i::FLAG_inline_new = false;

LocalContext env;
v8::Isolate* isolate = env->GetIsolate();
v8::Isolate::Scope iscope(isolate);
v8::HandleScope scope(isolate);
v8::Local<v8::Context> context = v8::Context::New(isolate);
v8::Context::Scope cscope(context);

std::vector<v8::Local<v8::String>> export_names{v8_str("default")};
v8::Local<v8::String> module_name =
v8_str("CreateSyntheticModule-TestSyntheticModuleGC");

for (int i = 0; i < 200; i++) {
Local<Module> module = v8::Module::CreateSyntheticModule(
isolate, module_name, export_names,
UnexpectedSyntheticModuleEvaluationStepsCallback);
USE(module);
}
}

TEST(SyntheticModuleSetExports) {
LocalContext env;
v8::Isolate* isolate = env->GetIsolate();
Expand Down
4 changes: 0 additions & 4 deletions test/parallel/parallel.status
Expand Up @@ -33,7 +33,3 @@ test-async-hooks-http-parser-destroy: PASS,FLAKY
[$system==freebsd]

[$system==aix]

[$mode==debug]
# https://github.com/nodejs/node/issues/30498
test-domain-error-types: PASS,FLAKY