Closed Bug 1778732 Opened 2 years ago Closed 2 years ago

Refactor module implementation some more

Categories

(Core :: JavaScript Engine, task, P3)

task

Tracking

()

RESOLVED FIXED
104 Branch
Tracking Status
firefox104 --- fixed

People

(Reporter: jonco, Assigned: jonco)

References

Details

Attachments

(4 files)

Following tidyup work in bug 1778076, here are a few minor refactorings to make the module code simpler and easier to follow.

It's no longer necessary to create an array or list object to hold these. We
can use a vector instead.

This just moves these methods to a different source file. They belong with the
other implementation of the other spec methods and this also permits the next
refactoring.

Depends on D151382

We can just call the function directly now which is simpler and removes
duplication.

I've preserved the existing (questionable) behaviour here and kept the
MOZ_ALWAYS_TRUE. According to the spec this should be inside
ExecuteAsyncModule, however our implementation can fail for reasons that are
not addressed by the spec (e.g. OOM) so we probably need to handle this
somehow.

Depends on D151383

The isAsync method is a little confusing because we also have
isAsyncEvaluating, which is different in important ways. It also doesn't match
the spec which uses hasTLA for this. I find the spec steps easier to follow
with the even more explict 'hasTopLevelAwait' name.

I'm happy to also rename isAsync in the front end too if you think it's a good
idea.

Depends on D151384

Pushed by jcoppeard@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/f2c78e0c8f3b Part 1: Use a vector for exported names list r=arai https://hg.mozilla.org/integration/autoland/rev/5c39c8787b24 Part 2: Move AsyncModuleExecution{Fulfilled,Rejected} methods to Modules.cpp r=arai https://hg.mozilla.org/integration/autoland/rev/647230a3b525 Part 3: Call ExecuteAsyncModule in AsyncModuleExecutionFulfilled rather than inlining it r=arai https://hg.mozilla.org/integration/autoland/rev/628666fe24fb Part 4: Rename ModuleObject::isAsync to hasTopLevelAwait r=arai
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: