Closed Bug 1519100 Opened 5 years ago Closed 3 years ago

Implement the Top-level await proposal

Categories

(Core :: JavaScript Engine, enhancement, P3)

63 Branch
enhancement

Tracking

()

RESOLVED FIXED
85 Branch
Tracking Status
firefox85 --- fixed

People

(Reporter: alex.fdm, Assigned: yulia)

References

(Blocks 2 open bugs, )

Details

(Keywords: dev-doc-complete)

Attachments

(15 files, 6 obsolete files)

47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review

The proposal is currently in Stage 2.

Priority: -- → P3
Assignee: nobody → ystartsev
Depends on: 1669153

This still needs to be cleaned up

This change introduces an async emitter that can be shared by FunctionEmitter and module code.

Depends on D93524

Attachment #9164004 - Attachment description: Bug 1519100 - WIP Async parser work → Bug 1519100 - Implement basic stencil changes for top-level await
Attachment #9181527 - Attachment description: Bug 1519100 - WIP Async parser work p2 → Bug 1519100 - Mark modules as async if we find a top level await while parsinng
Attachment #9181588 - Attachment description: Bug 1519100 - add tests for top level await → Bug 1519100 - Add tests for top level await
Attachment #9181528 - Attachment description: Bug 1519100 - (Prep) create AsyncEmitter to handle shared async behavior between functions and modules; r=arai → Bug 1519100 - create AsyncEmitter to handle shared async behavior between functions and modules; r=arai
Attachment #9164004 - Attachment description: Bug 1519100 - Implement basic stencil changes for top-level await → Bug 1519100 - Implement basic stencil changes for top-level await; r=tcampbell
Attachment #9181528 - Attachment description: Bug 1519100 - create AsyncEmitter to handle shared async behavior between functions and modules; r=arai → Bug 1519100 - Create AsyncEmitter to handle shared async behavior between functions and modules; r=arai
Attachment #9181579 - Attachment description: Bug 1519100 - Implement Top-level async bytecode → Bug 1519100 - Implement Top-level async bytecode; r=arai
Attachment #9181580 - Attachment description: Bug 1519100 - Add suspendable modules → Bug 1519100 - Add suspendable modules; r=tcampbell,arai,mgaudet
Attachment #9181527 - Attachment is obsolete: true
Attachment #9181588 - Attachment description: Bug 1519100 - Add tests for top level await → Bug 1519100 - add tests for top level await; r=jonco
Attachment #9164004 - Attachment description: Bug 1519100 - Implement basic stencil changes for top-level await; r=tcampbell → Bug 1519100 - Implement basic stencil changes for top-level await; r=arai
Attachment #9181580 - Attachment description: Bug 1519100 - Add suspendable modules; r=tcampbell,arai,mgaudet → Bug 1519100 - Add capability in GeneratorObject for modules to be suspended; r=tcampbell,arai,mgaudet

Depends on D95884

Attachment #9185760 - Attachment description: Bug 1519100 - Move HandleFunction from streams into the builtin dir; r=mgaudet → Bug 1519100 - Move HandlerFunction from streams into the builtin dir; r=mgaudet
Blocks: 1676612
Attachment #9181581 - Attachment description: Bug 1519100 - Implement top-level await specification; r=jonco → Bug 1519100 - Implement Top-level await specification; r=jonco
Attachment #9186031 - Attachment description: Bug 1519100 - enable wpt tests; r=emilio → Bug 1519100 - Update web-platform tests, add expected behavior tests; r=emilio

Add tests behind the TLA flag;

Depends on D97181

Attachment #9186032 - Attachment description: Bug 1519100 - adjust jit tests to work with module promises; r=mgaudet → Bug 1519100 - Adjust jit tests to work with module promises; r=mgaudet

Add tests behind the TLA flag;

Depends on D97184

Attachment #9188080 - Attachment is obsolete: true
Attachment #9188081 - Attachment is obsolete: true
Attachment #9185764 - Attachment is obsolete: true
Attachment #9181588 - Attachment description: Bug 1519100 - add tests for top level await; r=jonco → Bug 1519100 - Add tests for Top level await; r=jonco
Attachment #9181588 - Attachment description: Bug 1519100 - Add tests for Top level await; r=jonco → Bug 1519100 - Add tests for top level await; r=jonco
Attachment #9188085 - Attachment is obsolete: true
Attachment #9188083 - Attachment description: Bug 1519100 - Use pref and duplicated old code path to completely pref-off top-level await in the browser; r=emilio,jonco → Bug 1519100 - Use pref to completely pref-off top-level await in the browser; r=emilio,jonco
Attachment #9188084 - Attachment is obsolete: true
Pushed by ystartsev@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/da24af409d92
Add flag for experimental Top Level Await feature; r=mgaudet
https://hg.mozilla.org/integration/autoland/rev/c723f6b16b67
Move HandlerFunction from streams into the builtin dir; r=mgaudet
https://hg.mozilla.org/integration/autoland/rev/d99f0109da7a
Introduce SuspendableContext for async/generators in functions and modules; r=arai,mgaudet
https://hg.mozilla.org/integration/autoland/rev/880873b815a4
Create AsyncEmitter to handle shared async behavior between functions and modules; r=arai,mgaudet
https://hg.mozilla.org/integration/autoland/rev/10194540aff0
Add capability in GeneratorObject for modules to be suspended; r=arai,mgaudet
https://hg.mozilla.org/integration/autoland/rev/d7f3440addc7
Implement basic stencil changes for top-level await; r=arai
https://hg.mozilla.org/integration/autoland/rev/5f90543431cb
Mark modules as async if we find a top level await while parsing; r=mgaudet
https://hg.mozilla.org/integration/autoland/rev/e0250e4cba61
Implement Top-level async bytecode; r=arai
https://hg.mozilla.org/integration/autoland/rev/90b61247d071
Implement Top-level await specification; r=jonco
https://hg.mozilla.org/integration/autoland/rev/c9afefd66eb7
Update Dynamic Import to use module promises, and implement module changes in shell. r=jonco
https://hg.mozilla.org/integration/autoland/rev/bfd96f55a3bd
Update web-platform tests, add expected behavior tests; r=emilio
https://hg.mozilla.org/integration/autoland/rev/47cf4bde107e
Implement module promises in html r=emilio,jonco
https://hg.mozilla.org/integration/autoland/rev/ee02050e3c97
Use pref to completely pref-off top-level await in the browser; r=emilio,jonco
https://hg.mozilla.org/integration/autoland/rev/5b89081f0f08
Add tests for top level await; r=jonco
https://hg.mozilla.org/integration/autoland/rev/7302ebdbaa35
Adjust jit tests to work with module promises; r=mgaudet
Blocks: 1680259

Yulia: hooray for top-level await! I'm curious: will xpcshell have top-level await? I've actually wanted that in the very recent past.

Hi Nick:

So.. from my understanding xpcshell currently only compiles to global scripts. Top-Level await is restricted to modules. These are two different parse goals, so for now Top-Level await won't work for xpcshell, at least to my knowledge.

It should be possible to enable it, but I would need to talk to someone who knows more about xpcshell. You can use it in the js-shell with the flag --enable-top-level-await and -m for a module goal.

Flags: needinfo?(ystartsev)

(In reply to Yulia Startsev from comment #26)

Hi Nick:

So.. from my understanding xpcshell currently only compiles to global scripts. Top-Level await is restricted to modules. These are two different parse goals, so for now Top-Level await won't work for xpcshell, at least to my knowledge.

Fascinating, TIL. Thanks, Yulia!

Pushed by ystartsev@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/a3ea6c49dbf7
Add flag for experimental Top Level Await feature; r=mgaudet
https://hg.mozilla.org/integration/autoland/rev/98146209da6f
Move HandlerFunction from streams into the builtin dir; r=mgaudet
https://hg.mozilla.org/integration/autoland/rev/9f559a616909
Introduce SuspendableContext for async/generators in functions and modules; r=arai,mgaudet
https://hg.mozilla.org/integration/autoland/rev/b521ccd694f8
Create AsyncEmitter to handle shared async behavior between functions and modules; r=arai,mgaudet
https://hg.mozilla.org/integration/autoland/rev/bab7e81a6c2c
Add capability in GeneratorObject for modules to be suspended; r=arai,mgaudet
https://hg.mozilla.org/integration/autoland/rev/d5bff6c95feb
Implement basic stencil changes for top-level await; r=arai
https://hg.mozilla.org/integration/autoland/rev/3a0a021acc08
Mark modules as async if we find a top level await while parsing; r=mgaudet
https://hg.mozilla.org/integration/autoland/rev/8b5244786634
Implement Top-level async bytecode; r=arai
https://hg.mozilla.org/integration/autoland/rev/63d506024693
Implement Top-level await specification; r=jonco
https://hg.mozilla.org/integration/autoland/rev/683743bd0395
Update Dynamic Import to use module promises, and implement module changes in shell. r=jonco
https://hg.mozilla.org/integration/autoland/rev/55918f941155
Update web-platform tests, add expected behavior tests; r=emilio
https://hg.mozilla.org/integration/autoland/rev/53a792431e11
Implement module promises in html r=emilio,jonco
https://hg.mozilla.org/integration/autoland/rev/1155eecec034
Use pref to completely pref-off top-level await in the browser; r=emilio,jonco
https://hg.mozilla.org/integration/autoland/rev/019b00c63941
Add tests for top level await; r=jonco
https://hg.mozilla.org/integration/autoland/rev/16dc37dadf05
Adjust jit tests to work with module promises; r=mgaudet

eh, nuts that wasn't what I wanted to do... revert incoming..

Pushed by ystartsev@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/6bdc2b79fa26
Add flag for experimental Top Level Await feature; r=mgaudet
https://hg.mozilla.org/integration/autoland/rev/ff6fd518d035
Move HandlerFunction from streams into the builtin dir; r=mgaudet
https://hg.mozilla.org/integration/autoland/rev/c11b43616a2f
Introduce SuspendableContext for async/generators in functions and modules; r=arai,mgaudet
https://hg.mozilla.org/integration/autoland/rev/d7f3a9ac1933
Create AsyncEmitter to handle shared async behavior between functions and modules; r=arai,mgaudet
https://hg.mozilla.org/integration/autoland/rev/96c7515c8a1b
Add capability in GeneratorObject for modules to be suspended; r=arai,mgaudet
https://hg.mozilla.org/integration/autoland/rev/aa28d891047e
Implement basic stencil changes for top-level await; r=arai
https://hg.mozilla.org/integration/autoland/rev/406c05b73d5b
Mark modules as async if we find a top level await while parsing; r=mgaudet
https://hg.mozilla.org/integration/autoland/rev/18bbeedf4c2e
Implement Top-level async bytecode; r=arai
https://hg.mozilla.org/integration/autoland/rev/740f71543c0e
Implement Top-level await specification; r=jonco
https://hg.mozilla.org/integration/autoland/rev/f9bea80a5393
Update Dynamic Import to use module promises, and implement module changes in shell. r=jonco
https://hg.mozilla.org/integration/autoland/rev/1ffd544310f6
Update web-platform tests, add expected behavior tests; r=emilio
https://hg.mozilla.org/integration/autoland/rev/1f8c2419d053
Implement module promises in html r=emilio,jonco
https://hg.mozilla.org/integration/autoland/rev/76a1c42b797e
Use pref to completely pref-off top-level await in the browser; r=emilio,jonco
https://hg.mozilla.org/integration/autoland/rev/f3a874302dba
Add tests for top level await; r=jonco
https://hg.mozilla.org/integration/autoland/rev/7d9c82add62d
Adjust jit tests to work with module promises; r=mgaudet
Blocks: 1681046
Blocks: 1669153
No longer depends on: 1669153
Depends on: 1681258
Depends on: 1689499

Rumyra got this new functionality documented on MDN! See https://github.com/mdn/content/issues/297#issuecomment-762767516 for descriptions of what she did.

Please let us know if you notice anything that needs updating, or can think of anything else you'd like to see added.

Blocks: 1693261
Regressions: 1704480
Blocks: 1725621
Regressions: 1728588
Regressions: 1771090
Blocks: 1777972
Blocks: 1782713
No longer blocks: 1782713
Depends on: 1782713
Regressions: 1868992
You need to log in before you can comment on or make changes to this bug.