-
-
Notifications
You must be signed in to change notification settings - Fork 402
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Merged by Bors] - Execution stack & promises #2107
Conversation
Note: it still requires bringing the enhancements proposed by multiple members of the team. |
Test262 conformance changesVM implementation
Fixed tests (319):
|
Codecov Report
@@ Coverage Diff @@
## main #2107 +/- ##
==========================================
- Coverage 43.57% 43.50% -0.07%
==========================================
Files 217 220 +3
Lines 19695 19968 +273
==========================================
+ Hits 8583 8688 +105
- Misses 11112 11280 +168
Continue to review full report at Codecov.
|
Benchmark for fbf1d01Click to view benchmark
|
Benchmark for bf6af9eClick to view benchmark
|
Benchmark for 0fd5ac0Click to view benchmark
|
Benchmark for cdda963Click to view benchmark
|
Benchmark for 99392d3Click to view benchmark
|
Benchmark for c3c5b44Click to view benchmark
|
Benchmark for 7f012faClick to view benchmark
|
Benchmark for 62aff30Click to view benchmark
|
Benchmark for 2bc5167Click to view benchmark
|
Co-authored-by: aaronmunsters <aaronmunstersbxl@gmail.com>
Benchmark for 0af2ea7Click to view benchmark
|
Benchmark for c6d5958Click to view benchmark
|
Benchmark for aee020aClick to view benchmark
|
Feel free to check this up and merge it. I will create separate PRs for async/await execution and the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got some inital comments. I will probably take a detailed look later today.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there are some more optimizations with some types, but let's go ahead and merge it and address those in follow ups. From here we got a really nice starting point into everything async.
bors r+ |
This PR overrides #1923. It also removes the `queues` dependency added there, and rebases it to the latest `main` branch state. It adds the following: - A job queue (in `Context`) - The constructor [`Promise`](https://tc39.es/ecma262/#sec-promise-executor) - [`Promise.race`](https://tc39.es/ecma262/#sec-promise.race) - [`Promise.reject`](https://tc39.es/ecma262/#sec-promise.reject) - [`Promise.resolve`](https://tc39.es/ecma262/#sec-promise.resolve) - [`get Promise [ @@species ]`](https://tc39.es/ecma262/#sec-get-promise-@@species) - [`Promise.prototype [ @@toStringTag ]`](https://tc39.es/ecma262/#sec-promise.prototype-@@tostringtag) - [`Promise.prototype.then`](https://tc39.es/ecma262/#sec-promise.prototype.then) - [`Promise.prototype.finally`](https://tc39.es/ecma262/#sec-promise.prototype.finally) - [`Promise.prototype.catch`](https://tc39.es/ecma262/#sec-promise.prototype.catch) - The additional needed infrastructure - [`PerformPromiseThen ( promise, onFulfilled, onRejected [ , resultCapability ] )`](https://tc39.es/ecma262/#sec-performpromisethen) - [`TriggerPromiseReactions ( reactions, argument )`](https://tc39.es/ecma262/#sec-triggerpromisereactions) - [`PerformPromiseRace ( iteratorRecord, constructor, resultCapability, promiseResolve )`](https://tc39.es/ecma262/#sec-performpromiserace) - [`RejectPromise ( promise, reason )`](https://tc39.es/ecma262/#sec-rejectpromise) - [`FulfillPromise ( promise, value )`](https://tc39.es/ecma262/#sec-fulfillpromise) - [`IfAbruptRejectPromise ( value, capability )`](https://tc39.es/ecma262/#sec-ifabruptrejectpromise) - [`CreateResolvingFunctions ( promise )`](https://tc39.es/ecma262/#sec-createresolvingfunctions) - [`NewPromiseCapability ( C )`](https://tc39.es/ecma262/#sec-newpromisecapability) - [`NewPromiseReactionJob ( reaction, argument )`](https://tc39.es/ecma262/#sec-newpromisereactionjob) - [`NewPromiseResolveThenableJob ( promiseToResolve, thenable, then )`](https://tc39.es/ecma262/#sec-newpromiseresolvethenablejob) - [`PromiseResolve ( C, x )`](https://tc39.es/ecma262/#sec-promise-resolve) - A test case showcasing the run-to-completion semantics. An example program that shows the control flow with this addition is: ```javascript new Promise((res, rej) => { console.log("A"); res(undefined); }).then((_) => console.log("B")); console.log("C"); ``` Which would output: ``` A C B ```
Pull request successfully merged into main. Build succeeded: |
This PR overrides #1923. It also removes the
queues
dependency added there, and rebases it to the latestmain
branch state.It adds the following:
Context
)Promise
Promise.race
Promise.reject
Promise.resolve
get Promise [ @@species ]
Promise.prototype [ @@toStringTag ]
Promise.prototype.then
Promise.prototype.finally
Promise.prototype.catch
PerformPromiseThen ( promise, onFulfilled, onRejected [ , resultCapability ] )
TriggerPromiseReactions ( reactions, argument )
PerformPromiseRace ( iteratorRecord, constructor, resultCapability, promiseResolve )
RejectPromise ( promise, reason )
FulfillPromise ( promise, value )
IfAbruptRejectPromise ( value, capability )
CreateResolvingFunctions ( promise )
NewPromiseCapability ( C )
NewPromiseReactionJob ( reaction, argument )
NewPromiseResolveThenableJob ( promiseToResolve, thenable, then )
PromiseResolve ( C, x )
An example program that shows the control flow with this addition is:
Which would output: