[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: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66228}
This commit is contained in:
Georg Neis 2020-02-11 10:48:30 +01:00 committed by Commit Bot
parent 1166f87a1c
commit 447e2a7c49
3 changed files with 10 additions and 6 deletions

View File

@ -121,10 +121,13 @@ class UnorderedModuleSet
};
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 =
ArrayList::Add(isolate, handle(async_parent_modules(), isolate), module);
set_async_parent_modules(*new_array_list);
ArrayList::Add(isolate, async_parent_modules, parent);
module->set_async_parent_modules(*new_array_list);
}
Handle<SourceTextModule> SourceTextModule::GetAsyncParentModule(

View File

@ -1059,7 +1059,7 @@ MaybeHandle<Object> SourceTextModule::InnerModuleEvaluation(
module->IncrementPendingAsyncDependencies();
// 2. Append module to requiredModule.[[AsyncParentModules]].
required_module->AddAsyncParentModule(isolate, module);
AddAsyncParentModule(isolate, required_module, module);
}
} else {
RETURN_ON_EXCEPTION(isolate, Module::Evaluate(isolate, requested_module),

View File

@ -69,8 +69,9 @@ class SourceTextModule
// Appends a tuple of module and generator to the async parent modules
// ArrayList.
inline void AddAsyncParentModule(Isolate* isolate,
Handle<SourceTextModule> module);
inline static void AddAsyncParentModule(Isolate* isolate,
Handle<SourceTextModule> module,
Handle<SourceTextModule> parent);
// Returns a SourceTextModule, the
// ith parent in depth first traversal order of a given async child.