Skip to content

Commit

Permalink
Bug 1927125 - Avoid triggering gray unmarking when unlinking module s…
Browse files Browse the repository at this point in the history
…cripts r=sfink, a=dmeehan

Differential Revision: https://phabricator.services.mozilla.com/D226902
  • Loading branch information
jonco3 committed Oct 28, 2024
1 parent 19208e0 commit 71278e3
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions js/loader/LoadedScript.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,13 +282,13 @@ void ModuleScript::UnlinkModuleRecord() {
// Remove the module record's pointer to this object if present and decrement
// our reference count. The reference is added by SetModuleRecord() below.
//
// This takes care not to trigger gray unmarking because this takes a lot of
// time when we're tearing down the entire page. This is safe because we are
// only writing undefined into the module private, so it won't create any
// black-gray edges.
if (mModuleRecord) {
if (JS::IsCyclicModule(mModuleRecord)) {
JSObject* module = mModuleRecord.unbarrieredGet();
// Take care not to trigger gray unmarking because this takes a lot of time
// when we're tearing down the entire page. This is safe because we are only
// writing undefined into the module private, so it won't create any
// black-gray edges.
JSObject* module = mModuleRecord.unbarrieredGet();
if (JS::IsCyclicModule(module)) {
MOZ_ASSERT(JS::GetModulePrivate(module).toPrivate() == this);
JS::ClearModulePrivate(module);
}
Expand Down

0 comments on commit 71278e3

Please sign in to comment.