Commit 447e2a7c authored by Georg Neis's avatar Georg Neis Committed by Commit Bot

[modules] Fix handle bug

SourceTextModule::AddAsyncParentModule can allocate so it must be a
static function.

Bug: chromium:1050433
Change-Id: I86e58569d16e626ce3f85cc46ea5f376c2d06f3f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2050383
Commit-Queue: Adam Klein <adamk@chromium.org>
Auto-Submit: Georg Neis <neis@chromium.org>
Reviewed-by: 's avatarAdam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66228}
parent 1166f87a
...@@ -121,10 +121,13 @@ class UnorderedModuleSet ...@@ -121,10 +121,13 @@ class UnorderedModuleSet
}; };
void SourceTextModule::AddAsyncParentModule(Isolate* isolate, void SourceTextModule::AddAsyncParentModule(Isolate* isolate,
Handle<SourceTextModule> module) { Handle<SourceTextModule> module,
Handle<SourceTextModule> parent) {
Handle<ArrayList> async_parent_modules(module->async_parent_modules(),
isolate);
Handle<ArrayList> new_array_list = Handle<ArrayList> new_array_list =
ArrayList::Add(isolate, handle(async_parent_modules(), isolate), module); ArrayList::Add(isolate, async_parent_modules, parent);
set_async_parent_modules(*new_array_list); module->set_async_parent_modules(*new_array_list);
} }
Handle<SourceTextModule> SourceTextModule::GetAsyncParentModule( Handle<SourceTextModule> SourceTextModule::GetAsyncParentModule(
......
...@@ -1059,7 +1059,7 @@ MaybeHandle<Object> SourceTextModule::InnerModuleEvaluation( ...@@ -1059,7 +1059,7 @@ MaybeHandle<Object> SourceTextModule::InnerModuleEvaluation(
module->IncrementPendingAsyncDependencies(); module->IncrementPendingAsyncDependencies();
// 2. Append module to requiredModule.[[AsyncParentModules]]. // 2. Append module to requiredModule.[[AsyncParentModules]].
required_module->AddAsyncParentModule(isolate, module); AddAsyncParentModule(isolate, required_module, module);
} }
} else { } else {
RETURN_ON_EXCEPTION(isolate, Module::Evaluate(isolate, requested_module), RETURN_ON_EXCEPTION(isolate, Module::Evaluate(isolate, requested_module),
......
...@@ -69,8 +69,9 @@ class SourceTextModule ...@@ -69,8 +69,9 @@ class SourceTextModule
// Appends a tuple of module and generator to the async parent modules // Appends a tuple of module and generator to the async parent modules
// ArrayList. // ArrayList.
inline void AddAsyncParentModule(Isolate* isolate, inline static void AddAsyncParentModule(Isolate* isolate,
Handle<SourceTextModule> module); Handle<SourceTextModule> module,
Handle<SourceTextModule> parent);
// Returns a SourceTextModule, the // Returns a SourceTextModule, the
// ith parent in depth first traversal order of a given async child. // ith parent in depth first traversal order of a given async child.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment