Skip to content
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] - Refactor construct and PromiseCapability to preserve JsObject invariants #2136

Closed
wants to merge 3 commits into from

Conversation

jedel1043
Copy link
Member

@jedel1043 jedel1043 commented Jun 21, 2022

This Pull Request changes the signature of construct to always return JsObjects, and refactors PromiseCapability to store only JsObject/JsFunctions. This preserves the following invariants specified in the spec:

https://tc39.es/ecma262/multipage/ordinary-and-exotic-objects-behaviours.html#sec-ecmascript-function-objects-construct-argumentslist-newtarget

The [[Construct]] internal method of an ECMAScript function object ... returns either a normal completion containing an Object or a throw completion ...

https://tc39.es/ecma262/multipage/control-abstraction-objects.html#sec-promisecapability-records

Table 82: PromiseCapability Record Fields

Field Name Value Meaning
[[Promise]] an Object An object that is usable as a promise.
[[Resolve]] a function object The function that is used to resolve the given promise.
[[Reject]] a function object The function that is used to reject the given promise.

@jedel1043 jedel1043 added execution Issues or PRs related to code execution Internal Category for changelog labels Jun 21, 2022
@jedel1043 jedel1043 added this to the v0.16.0 milestone Jun 21, 2022
@jedel1043 jedel1043 force-pushed the constructor-improv branch from 946e2f1 to 4247ae8 Compare June 21, 2022 00:49
@github-actions
Copy link

github-actions bot commented Jun 21, 2022

Test262 conformance changes

VM implementation

Test result main count PR count difference
Total 90,619 90,619 0
Passed 56,885 57,196 +311
Ignored 13,788 13,788 0
Failed 19,946 19,635 -311
Panics 0 0 0
Conformance 62.77% 63.12% +0.34%
Fixed tests (311):
test/language/statements/class/subclass/builtin-objects/Object/constructor-returns-non-object.js [strict mode] (previously Failed)
test/language/statements/class/subclass/builtin-objects/Object/constructor-returns-non-object.js (previously Failed)
test/built-ins/Array/from/proto-from-ctor-realm.js [strict mode] (previously Failed)
test/built-ins/Array/from/proto-from-ctor-realm.js (previously Failed)
test/built-ins/Array/of/proto-from-ctor-realm.js [strict mode] (previously Failed)
test/built-ins/Array/of/proto-from-ctor-realm.js (previously Failed)
test/built-ins/Function/internals/Construct/derived-return-val.js [strict mode] (previously Failed)
test/built-ins/Function/internals/Construct/derived-return-val.js (previously Failed)
test/built-ins/Promise/reject-via-abrupt-queue.js [strict mode] (previously Failed)
test/built-ins/Promise/reject-via-abrupt-queue.js (previously Failed)
test/built-ins/Promise/create-resolving-functions-resolve.js [strict mode] (previously Failed)
test/built-ins/Promise/create-resolving-functions-resolve.js (previously Failed)
test/built-ins/Promise/create-resolving-functions-reject.js [strict mode] (previously Failed)
test/built-ins/Promise/create-resolving-functions-reject.js (previously Failed)
test/built-ins/Promise/reject-via-fn-deferred-queue.js [strict mode] (previously Failed)
test/built-ins/Promise/reject-via-fn-deferred-queue.js (previously Failed)
test/built-ins/Promise/reject-via-fn-immed-queue.js [strict mode] (previously Failed)
test/built-ins/Promise/reject-via-fn-immed-queue.js (previously Failed)
test/built-ins/Promise/reject/capability-invocation-error.js [strict mode] (previously Failed)
test/built-ins/Promise/reject/capability-invocation-error.js (previously Failed)
test/built-ins/Promise/reject/S25.4.4.4_A2.1_T1.js [strict mode] (previously Failed)
test/built-ins/Promise/reject/S25.4.4.4_A2.1_T1.js (previously Failed)
test/built-ins/Promise/reject/capability-invocation.js (previously Failed)
test/built-ins/Promise/reject/capability-executor-called-twice.js [strict mode] (previously Failed)
test/built-ins/Promise/reject/capability-executor-called-twice.js (previously Failed)
test/built-ins/Promise/resolve/S25.4.4.5_A4.1_T1.js [strict mode] (previously Failed)
test/built-ins/Promise/resolve/S25.4.4.5_A4.1_T1.js (previously Failed)
test/built-ins/Promise/resolve/arg-non-thenable.js [strict mode] (previously Failed)
test/built-ins/Promise/resolve/arg-non-thenable.js (previously Failed)
test/built-ins/Promise/resolve/S25.4.4.5_A2.2_T1.js [strict mode] (previously Failed)
test/built-ins/Promise/resolve/S25.4.4.5_A2.2_T1.js (previously Failed)
test/built-ins/Promise/resolve/resolve-poisoned-then.js [strict mode] (previously Failed)
test/built-ins/Promise/resolve/resolve-poisoned-then.js (previously Failed)
test/built-ins/Promise/resolve/resolve-self.js [strict mode] (previously Failed)
test/built-ins/Promise/resolve/resolve-self.js (previously Failed)
test/built-ins/Promise/resolve/S25.4.4.5_A2.3_T1.js [strict mode] (previously Failed)
test/built-ins/Promise/resolve/S25.4.4.5_A2.3_T1.js (previously Failed)
test/built-ins/Promise/resolve/S25.4.4.5_A3.1_T1.js [strict mode] (previously Failed)
test/built-ins/Promise/resolve/S25.4.4.5_A3.1_T1.js (previously Failed)
test/built-ins/Promise/resolve/arg-poisoned-then.js [strict mode] (previously Failed)
test/built-ins/Promise/resolve/arg-poisoned-then.js (previously Failed)
test/built-ins/Promise/resolve/resolve-thenable.js [strict mode] (previously Failed)
test/built-ins/Promise/resolve/resolve-thenable.js (previously Failed)
test/built-ins/Promise/resolve/resolve-non-thenable.js [strict mode] (previously Failed)
test/built-ins/Promise/resolve/resolve-non-thenable.js (previously Failed)
test/built-ins/Promise/resolve/S25.Promise_resolve_foreign_thenable_1.js [strict mode] (previously Failed)
test/built-ins/Promise/resolve/S25.Promise_resolve_foreign_thenable_1.js (previously Failed)
test/built-ins/Promise/resolve/S25.Promise_resolve_foreign_thenable_2.js [strict mode] (previously Failed)
test/built-ins/Promise/resolve/S25.Promise_resolve_foreign_thenable_2.js (previously Failed)
test/built-ins/Promise/resolve/resolve-non-obj.js [strict mode] (previously Failed)
test/built-ins/Promise/resolve/resolve-non-obj.js (previously Failed)
test/built-ins/Promise/prototype/then/S25.4.5.3_A5.1_T1.js [strict mode] (previously Failed)
test/built-ins/Promise/prototype/then/S25.4.5.3_A5.1_T1.js (previously Failed)
test/built-ins/Promise/prototype/then/S25.4.4_A2.1_T1.js [strict mode] (previously Failed)
test/built-ins/Promise/prototype/then/S25.4.4_A2.1_T1.js (previously Failed)
test/built-ins/Promise/prototype/then/reject-pending-rejected.js [strict mode] (previously Failed)
test/built-ins/Promise/prototype/then/reject-pending-rejected.js (previously Failed)
test/built-ins/Promise/prototype/then/resolve-settled-fulfilled-thenable.js [strict mode] (previously Failed)
test/built-ins/Promise/prototype/then/resolve-settled-fulfilled-thenable.js (previously Failed)
test/built-ins/Promise/prototype/then/S25.4.4_A2.1_T2.js [strict mode] (previously Failed)
test/built-ins/Promise/prototype/then/S25.4.4_A2.1_T2.js (previously Failed)
test/built-ins/Promise/prototype/then/rxn-handler-fulfilled-next-abrupt.js [strict mode] (previously Failed)
test/built-ins/Promise/prototype/then/rxn-handler-fulfilled-next-abrupt.js (previously Failed)
test/built-ins/Promise/prototype/then/resolve-settled-rejected-thenable.js [strict mode] (previously Failed)
test/built-ins/Promise/prototype/then/resolve-settled-rejected-thenable.js (previously Failed)
test/built-ins/Promise/prototype/then/S25.4.5.3_A4.2_T1.js [strict mode] (previously Failed)
test/built-ins/Promise/prototype/then/S25.4.5.3_A4.2_T1.js (previously Failed)
test/built-ins/Promise/prototype/then/reject-pending-fulfilled.js [strict mode] (previously Failed)
test/built-ins/Promise/prototype/then/reject-pending-fulfilled.js (previously Failed)
test/built-ins/Promise/prototype/then/rxn-handler-fulfilled-invoke-nonstrict.js (previously Failed)
test/built-ins/Promise/prototype/then/S25.4.4_A2.1_T3.js [strict mode] (previously Failed)
test/built-ins/Promise/prototype/then/S25.4.4_A2.1_T3.js (previously Failed)
test/built-ins/Promise/prototype/then/resolve-pending-rejected-self.js [strict mode] (previously Failed)
test/built-ins/Promise/prototype/then/resolve-pending-rejected-self.js (previously Failed)
test/built-ins/Promise/prototype/then/resolve-settled-rejected-self.js [strict mode] (previously Failed)
test/built-ins/Promise/prototype/then/resolve-settled-rejected-self.js (previously Failed)
test/built-ins/Promise/prototype/then/rxn-handler-fulfilled-return-abrupt.js [strict mode] (previously Failed)
test/built-ins/Promise/prototype/then/rxn-handler-fulfilled-return-abrupt.js (previously Failed)
test/built-ins/Promise/prototype/then/resolve-settled-fulfilled-non-thenable.js [strict mode] (previously Failed)
test/built-ins/Promise/prototype/then/resolve-settled-fulfilled-non-thenable.js (previously Failed)
test/built-ins/Promise/prototype/then/rxn-handler-rejected-return-normal.js [strict mode] (previously Failed)
test/built-ins/Promise/prototype/then/rxn-handler-rejected-return-normal.js (previously Failed)
test/built-ins/Promise/prototype/then/S25.4.4_A1.1_T1.js [strict mode] (previously Failed)
test/built-ins/Promise/prototype/then/S25.4.4_A1.1_T1.js (previously Failed)
test/built-ins/Promise/prototype/then/resolve-settled-rejected-poisoned-then.js [strict mode] (previously Failed)
test/built-ins/Promise/prototype/then/resolve-settled-rejected-poisoned-then.js (previously Failed)
test/built-ins/Promise/prototype/then/S25.4.5.3_A4.2_T2.js [strict mode] (previously Failed)
test/built-ins/Promise/prototype/then/S25.4.5.3_A4.2_T2.js (previously Failed)
test/built-ins/Promise/prototype/then/resolve-pending-fulfilled-thenable.js [strict mode] (previously Failed)
test/built-ins/Promise/prototype/then/resolve-pending-fulfilled-thenable.js (previously Failed)
test/built-ins/Promise/prototype/then/ctor-undef.js [strict mode] (previously Failed)
test/built-ins/Promise/prototype/then/ctor-undef.js (previously Failed)
test/built-ins/Promise/prototype/then/resolve-settled-fulfilled-self.js [strict mode] (previously Failed)
test/built-ins/Promise/prototype/then/resolve-settled-fulfilled-self.js (previously Failed)
test/built-ins/Promise/prototype/then/S25.4.5.3_A4.1_T2.js [strict mode] (previously Failed)
test/built-ins/Promise/prototype/then/S25.4.5.3_A4.1_T2.js (previously Failed)
test/built-ins/Promise/prototype/then/resolve-pending-fulfilled-non-thenable.js [strict mode] (previously Failed)
test/built-ins/Promise/prototype/then/resolve-pending-fulfilled-non-thenable.js (previously Failed)
test/built-ins/Promise/prototype/then/rxn-handler-thrower.js [strict mode] (previously Failed)
test/built-ins/Promise/prototype/then/rxn-handler-thrower.js (previously Failed)
test/built-ins/Promise/prototype/then/rxn-handler-fulfilled-invoke-strict.js [strict mode] (previously Failed)
test/built-ins/Promise/prototype/then/resolve-pending-rejected-non-thenable.js [strict mode] (previously Failed)
test/built-ins/Promise/prototype/then/resolve-pending-rejected-non-thenable.js (previously Failed)
test/built-ins/Promise/prototype/then/ctor-poisoned.js [strict mode] (previously Failed)
test/built-ins/Promise/prototype/then/ctor-poisoned.js (previously Failed)
test/built-ins/Promise/prototype/then/rxn-handler-rejected-invoke-nonstrict.js (previously Failed)
test/built-ins/Promise/prototype/then/S25.4.5.3_A5.2_T1.js [strict mode] (previously Failed)
test/built-ins/Promise/prototype/then/S25.4.5.3_A5.2_T1.js (previously Failed)
test/built-ins/Promise/prototype/then/rxn-handler-identity.js [strict mode] (previously Failed)
test/built-ins/Promise/prototype/then/rxn-handler-identity.js (previously Failed)
test/built-ins/Promise/prototype/then/resolve-pending-rejected-thenable.js [strict mode] (previously Failed)
test/built-ins/Promise/prototype/then/resolve-pending-rejected-thenable.js (previously Failed)
test/built-ins/Promise/prototype/then/resolve-settled-fulfilled-non-obj.js [strict mode] (previously Failed)
test/built-ins/Promise/prototype/then/resolve-settled-fulfilled-non-obj.js (previously Failed)
test/built-ins/Promise/prototype/then/resolve-pending-fulfilled-prms-cstm-then.js [strict mode] (previously Failed)
test/built-ins/Promise/prototype/then/resolve-pending-fulfilled-prms-cstm-then.js (previously Failed)
test/built-ins/Promise/prototype/then/resolve-settled-fulfilled-poisoned-then.js [strict mode] (previously Failed)
test/built-ins/Promise/prototype/then/resolve-settled-fulfilled-poisoned-then.js (previously Failed)
test/built-ins/Promise/prototype/then/resolve-settled-rejected-non-thenable.js [strict mode] (previously Failed)
test/built-ins/Promise/prototype/then/resolve-settled-rejected-non-thenable.js (previously Failed)
test/built-ins/Promise/prototype/then/reject-settled-rejected.js [strict mode] (previously Failed)
test/built-ins/Promise/prototype/then/reject-settled-rejected.js (previously Failed)
test/built-ins/Promise/prototype/then/rxn-handler-fulfilled-return-normal.js [strict mode] (previously Failed)
test/built-ins/Promise/prototype/then/rxn-handler-fulfilled-return-normal.js (previously Failed)
test/built-ins/Promise/prototype/then/resolve-pending-fulfilled-self.js [strict mode] (previously Failed)
test/built-ins/Promise/prototype/then/resolve-pending-fulfilled-self.js (previously Failed)
test/built-ins/Promise/prototype/then/resolve-settled-fulfilled-prms-cstm-then.js [strict mode] (previously Failed)
test/built-ins/Promise/prototype/then/resolve-settled-fulfilled-prms-cstm-then.js (previously Failed)
test/built-ins/Promise/prototype/then/rxn-handler-rejected-next-abrupt.js [strict mode] (previously Failed)
test/built-ins/Promise/prototype/then/rxn-handler-rejected-next-abrupt.js (previously Failed)
test/built-ins/Promise/prototype/then/S25.4.5.3_A5.3_T1.js [strict mode] (previously Failed)
test/built-ins/Promise/prototype/then/S25.4.5.3_A5.3_T1.js (previously Failed)
test/built-ins/Promise/prototype/then/reject-settled-fulfilled.js [strict mode] (previously Failed)
test/built-ins/Promise/prototype/then/reject-settled-fulfilled.js (previously Failed)
test/built-ins/Promise/prototype/then/rxn-handler-rejected-return-abrupt.js [strict mode] (previously Failed)
test/built-ins/Promise/prototype/then/rxn-handler-rejected-return-abrupt.js (previously Failed)
test/built-ins/Promise/prototype/then/resolve-pending-rejected-non-obj.js [strict mode] (previously Failed)
test/built-ins/Promise/prototype/then/resolve-pending-rejected-non-obj.js (previously Failed)
test/built-ins/Promise/prototype/then/resolve-pending-rejected-poisoned-then.js [strict mode] (previously Failed)
test/built-ins/Promise/prototype/then/resolve-pending-rejected-poisoned-then.js (previously Failed)
test/built-ins/Promise/prototype/then/resolve-pending-fulfilled-poisoned-then.js [strict mode] (previously Failed)
test/built-ins/Promise/prototype/then/resolve-pending-fulfilled-poisoned-then.js (previously Failed)
test/built-ins/Promise/prototype/then/S25.4.5.3_A4.1_T1.js [strict mode] (previously Failed)
test/built-ins/Promise/prototype/then/S25.4.5.3_A4.1_T1.js (previously Failed)
test/built-ins/Promise/prototype/then/rxn-handler-rejected-invoke-strict.js [strict mode] (previously Failed)
test/built-ins/Promise/prototype/then/resolve-pending-rejected-prms-cstm-then.js [strict mode] (previously Failed)
test/built-ins/Promise/prototype/then/resolve-pending-rejected-prms-cstm-then.js (previously Failed)
test/built-ins/Promise/prototype/then/resolve-settled-rejected-non-obj.js [strict mode] (previously Failed)
test/built-ins/Promise/prototype/then/resolve-settled-rejected-non-obj.js (previously Failed)
test/built-ins/Promise/prototype/then/resolve-pending-fulfilled-non-obj.js [strict mode] (previously Failed)
test/built-ins/Promise/prototype/then/resolve-pending-fulfilled-non-obj.js (previously Failed)
test/built-ins/Promise/prototype/then/resolve-settled-rejected-prms-cstm-then.js [strict mode] (previously Failed)
test/built-ins/Promise/prototype/then/resolve-settled-rejected-prms-cstm-then.js (previously Failed)
test/built-ins/Promise/prototype/catch/S25.4.5.1_A3.1_T1.js [strict mode] (previously Failed)
test/built-ins/Promise/prototype/catch/S25.4.5.1_A3.1_T1.js (previously Failed)
test/built-ins/Promise/prototype/catch/S25.4.5.1_A3.1_T2.js [strict mode] (previously Failed)
test/built-ins/Promise/prototype/catch/S25.4.5.1_A3.1_T2.js (previously Failed)
test/built-ins/Promise/prototype/catch/S25.4.5.1_A2.1_T1.js [strict mode] (previously Failed)
test/built-ins/Promise/prototype/catch/S25.4.5.1_A2.1_T1.js (previously Failed)
test/built-ins/Promise/prototype/finally/resolved-observable-then-calls.js [strict mode] (previously Failed)
test/built-ins/Promise/prototype/finally/resolved-observable-then-calls.js (previously Failed)
test/built-ins/Promise/prototype/finally/is-a-method.js [strict mode] (previously Failed)
test/built-ins/Promise/prototype/finally/is-a-method.js (previously Failed)
test/built-ins/Promise/prototype/finally/rejected-observable-then-calls.js [strict mode] (previously Failed)
test/built-ins/Promise/prototype/finally/rejected-observable-then-calls.js (previously Failed)
test/built-ins/Promise/prototype/finally/rejection-reason-override-with-throw.js [strict mode] (previously Failed)
test/built-ins/Promise/prototype/finally/rejection-reason-override-with-throw.js (previously Failed)
test/built-ins/Promise/prototype/finally/rejection-reason-no-fulfill.js [strict mode] (previously Failed)
test/built-ins/Promise/prototype/finally/rejection-reason-no-fulfill.js (previously Failed)
test/built-ins/Promise/prototype/finally/this-value-proxy.js [strict mode] (previously Failed)
test/built-ins/Promise/prototype/finally/this-value-proxy.js (previously Failed)
test/built-ins/Promise/prototype/finally/resolved-observable-then-calls-argument.js [strict mode] (previously Failed)
test/built-ins/Promise/prototype/finally/resolved-observable-then-calls-argument.js (previously Failed)
test/built-ins/Promise/prototype/finally/resolution-value-no-override.js [strict mode] (previously Failed)
test/built-ins/Promise/prototype/finally/resolution-value-no-override.js (previously Failed)
test/built-ins/Promise/race/resolve-non-callable.js [strict mode] (previously Failed)
test/built-ins/Promise/race/resolve-non-callable.js (previously Failed)
test/built-ins/Promise/race/S25.4.4.3_A7.1_T1.js [strict mode] (previously Failed)
test/built-ins/Promise/race/S25.4.4.3_A7.1_T1.js (previously Failed)
test/built-ins/Promise/race/iter-step-err-reject.js [strict mode] (previously Failed)
test/built-ins/Promise/race/iter-step-err-reject.js (previously Failed)
test/built-ins/Promise/race/reject-deferred.js [strict mode] (previously Failed)
test/built-ins/Promise/race/reject-deferred.js (previously Failed)
test/built-ins/Promise/race/S25.4.4.3_A4.1_T2.js [strict mode] (previously Failed)
test/built-ins/Promise/race/S25.4.4.3_A4.1_T2.js (previously Failed)
test/built-ins/Promise/race/S25.4.4.3_A7.3_T2.js [strict mode] (previously Failed)
test/built-ins/Promise/race/S25.4.4.3_A7.3_T2.js (previously Failed)
test/built-ins/Promise/race/invoke-resolve-error-close.js [strict mode] (previously Failed)
test/built-ins/Promise/race/invoke-resolve-error-close.js (previously Failed)
test/built-ins/Promise/race/iter-step-err-no-close.js [strict mode] (previously Failed)
test/built-ins/Promise/race/iter-step-err-no-close.js (previously Failed)
test/built-ins/Promise/race/resolve-poisoned-then.js [strict mode] (previously Failed)
test/built-ins/Promise/race/resolve-poisoned-then.js (previously Failed)
test/built-ins/Promise/race/S25.4.4.3_A7.1_T2.js [strict mode] (previously Failed)
test/built-ins/Promise/race/S25.4.4.3_A7.1_T2.js (previously Failed)
test/built-ins/Promise/race/resolve-self.js [strict mode] (previously Failed)
test/built-ins/Promise/race/resolve-self.js (previously Failed)
test/built-ins/Promise/race/reject-from-same-thenable.js [strict mode] (previously Failed)
test/built-ins/Promise/race/reject-from-same-thenable.js (previously Failed)
test/built-ins/Promise/race/S25.4.4.3_A7.3_T1.js [strict mode] (previously Failed)
test/built-ins/Promise/race/S25.4.4.3_A7.3_T1.js (previously Failed)
test/built-ins/Promise/race/S25.4.4.3_A2.2_T3.js [strict mode] (previously Failed)
test/built-ins/Promise/race/S25.4.4.3_A2.2_T3.js (previously Failed)
test/built-ins/Promise/race/S25.4.4.3_A6.1_T1.js [strict mode] (previously Failed)
test/built-ins/Promise/race/S25.4.4.3_A6.1_T1.js (previously Failed)
test/built-ins/Promise/race/iter-assigned-symbol-reject.js [strict mode] (previously Failed)
test/built-ins/Promise/race/iter-assigned-symbol-reject.js (previously Failed)
test/built-ins/Promise/race/iter-arg-is-false-reject.js [strict mode] (previously Failed)
test/built-ins/Promise/race/iter-arg-is-false-reject.js (previously Failed)
test/built-ins/Promise/race/iter-assigned-false-reject.js [strict mode] (previously Failed)
test/built-ins/Promise/race/iter-assigned-false-reject.js (previously Failed)
test/built-ins/Promise/race/invoke-then-error-close.js [strict mode] (previously Failed)
test/built-ins/Promise/race/invoke-then-error-close.js (previously Failed)
test/built-ins/Promise/race/S25.4.4.3_A6.2_T1.js [strict mode] (previously Failed)
test/built-ins/Promise/race/S25.4.4.3_A6.2_T1.js (previously Failed)
test/built-ins/Promise/race/S25.4.4.3_A5.1_T1.js [strict mode] (previously Failed)
test/built-ins/Promise/race/S25.4.4.3_A5.1_T1.js (previously Failed)
test/built-ins/Promise/race/invoke-then.js [strict mode] (previously Failed)
test/built-ins/Promise/race/invoke-then.js (previously Failed)
test/built-ins/Promise/race/iter-arg-is-null-reject.js [strict mode] (previously Failed)
test/built-ins/Promise/race/iter-arg-is-null-reject.js (previously Failed)
test/built-ins/Promise/race/iter-returns-null-reject.js [strict mode] (previously Failed)
test/built-ins/Promise/race/iter-returns-null-reject.js (previously Failed)
test/built-ins/Promise/race/iter-returns-true-reject.js [strict mode] (previously Failed)
test/built-ins/Promise/race/iter-returns-true-reject.js (previously Failed)
test/built-ins/Promise/race/iter-returns-string-reject.js [strict mode] (previously Failed)
test/built-ins/Promise/race/iter-returns-string-reject.js (previously Failed)
test/built-ins/Promise/race/resolve-thenable.js [strict mode] (previously Failed)
test/built-ins/Promise/race/resolve-thenable.js (previously Failed)
test/built-ins/Promise/race/invoke-resolve-get-error.js [strict mode] (previously Failed)
test/built-ins/Promise/race/invoke-resolve-get-error.js (previously Failed)
test/built-ins/Promise/race/invoke-resolve-get-once-multiple-calls.js [strict mode] (previously Failed)
test/built-ins/Promise/race/invoke-resolve-get-once-multiple-calls.js (previously Failed)
test/built-ins/Promise/race/invoke-then-get-error-reject.js [strict mode] (previously Failed)
test/built-ins/Promise/race/invoke-then-get-error-reject.js (previously Failed)
test/built-ins/Promise/race/resolve-ignores-late-rejection-deferred.js [strict mode] (previously Failed)
test/built-ins/Promise/race/resolve-ignores-late-rejection-deferred.js (previously Failed)
test/built-ins/Promise/race/resolve-non-thenable.js [strict mode] (previously Failed)
test/built-ins/Promise/race/resolve-non-thenable.js (previously Failed)
test/built-ins/Promise/race/iter-next-val-err-no-close.js [strict mode] (previously Failed)
test/built-ins/Promise/race/iter-next-val-err-no-close.js (previously Failed)
test/built-ins/Promise/race/S25.4.4.3_A2.2_T2.js [strict mode] (previously Failed)
test/built-ins/Promise/race/S25.4.4.3_A2.2_T2.js (previously Failed)
test/built-ins/Promise/race/invoke-then-error-reject.js [strict mode] (previously Failed)
test/built-ins/Promise/race/invoke-then-error-reject.js (previously Failed)
test/built-ins/Promise/race/resolve-ignores-late-rejection.js [strict mode] (previously Failed)
test/built-ins/Promise/race/resolve-ignores-late-rejection.js (previously Failed)
test/built-ins/Promise/race/resolve-prms-cstm-then.js [strict mode] (previously Failed)
test/built-ins/Promise/race/resolve-prms-cstm-then.js (previously Failed)
test/built-ins/Promise/race/invoke-resolve-on-values-every-iteration-of-promise.js [strict mode] (previously Failed)
test/built-ins/Promise/race/invoke-resolve-on-values-every-iteration-of-promise.js (previously Failed)
test/built-ins/Promise/race/invoke-then-get-error-close.js [strict mode] (previously Failed)
test/built-ins/Promise/race/invoke-then-get-error-close.js (previously Failed)
test/built-ins/Promise/race/iter-arg-is-number-reject.js [strict mode] (previously Failed)
test/built-ins/Promise/race/iter-arg-is-number-reject.js (previously Failed)
test/built-ins/Promise/race/invoke-resolve-on-promises-every-iteration-of-promise.js [strict mode] (previously Failed)
test/built-ins/Promise/race/invoke-resolve-on-promises-every-iteration-of-promise.js (previously Failed)
test/built-ins/Promise/race/iter-arg-is-true-reject.js [strict mode] (previously Failed)
test/built-ins/Promise/race/iter-arg-is-true-reject.js (previously Failed)
test/built-ins/Promise/race/resolved-then-catch-finally.js [strict mode] (previously Failed)
test/built-ins/Promise/race/resolved-then-catch-finally.js (previously Failed)
test/built-ins/Promise/race/iter-next-val-err-reject.js [strict mode] (previously Failed)
test/built-ins/Promise/race/iter-next-val-err-reject.js (previously Failed)
test/built-ins/Promise/race/iter-arg-is-symbol-reject.js [strict mode] (previously Failed)
test/built-ins/Promise/race/iter-arg-is-symbol-reject.js (previously Failed)
test/built-ins/Promise/race/reject-immed.js [strict mode] (previously Failed)
test/built-ins/Promise/race/reject-immed.js (previously Failed)
test/built-ins/Promise/race/iter-returns-symbol-reject.js [strict mode] (previously Failed)
test/built-ins/Promise/race/iter-returns-symbol-reject.js (previously Failed)
test/built-ins/Promise/race/S25.4.4.3_A7.1_T3.js [strict mode] (previously Failed)
test/built-ins/Promise/race/S25.4.4.3_A7.1_T3.js (previously Failed)
test/built-ins/Promise/race/S25.4.4.3_A2.2_T1.js [strict mode] (previously Failed)
test/built-ins/Promise/race/S25.4.4.3_A2.2_T1.js (previously Failed)
test/built-ins/Promise/race/iter-assigned-string-reject.js [strict mode] (previously Failed)
test/built-ins/Promise/race/iter-assigned-string-reject.js (previously Failed)
test/built-ins/Promise/race/reject-ignored-immed.js [strict mode] (previously Failed)
test/built-ins/Promise/race/reject-ignored-immed.js (previously Failed)
test/built-ins/Promise/race/iter-assigned-null-reject.js [strict mode] (previously Failed)
test/built-ins/Promise/race/iter-assigned-null-reject.js (previously Failed)
test/built-ins/Promise/race/reject-ignored-deferred.js [strict mode] (previously Failed)
test/built-ins/Promise/race/reject-ignored-deferred.js (previously Failed)
test/built-ins/Promise/race/iter-returns-false-reject.js [strict mode] (previously Failed)
test/built-ins/Promise/race/iter-returns-false-reject.js (previously Failed)
test/built-ins/Promise/race/S25.4.4.3_A4.1_T1.js [strict mode] (previously Failed)
test/built-ins/Promise/race/S25.4.4.3_A4.1_T1.js (previously Failed)
test/built-ins/Promise/race/iter-assigned-number-reject.js [strict mode] (previously Failed)
test/built-ins/Promise/race/iter-assigned-number-reject.js (previously Failed)
test/built-ins/Promise/race/S25.4.4.3_A2.1_T1.js [strict mode] (previously Failed)
test/built-ins/Promise/race/S25.4.4.3_A2.1_T1.js (previously Failed)
test/built-ins/Promise/race/iter-returns-undefined-reject.js [strict mode] (previously Failed)
test/built-ins/Promise/race/iter-returns-undefined-reject.js (previously Failed)
test/built-ins/Promise/race/iter-assigned-undefined-reject.js [strict mode] (previously Failed)
test/built-ins/Promise/race/iter-assigned-undefined-reject.js (previously Failed)
test/built-ins/Promise/race/iter-returns-number-reject.js [strict mode] (previously Failed)
test/built-ins/Promise/race/iter-returns-number-reject.js (previously Failed)
test/built-ins/Promise/race/invoke-resolve-error-reject.js [strict mode] (previously Failed)
test/built-ins/Promise/race/invoke-resolve-error-reject.js (previously Failed)
test/built-ins/Promise/race/same-reject-function.js [strict mode] (previously Failed)
test/built-ins/Promise/race/same-reject-function.js (previously Failed)
test/built-ins/Promise/race/S25.4.4.3_A7.2_T1.js [strict mode] (previously Failed)
test/built-ins/Promise/race/S25.4.4.3_A7.2_T1.js (previously Failed)
test/built-ins/Promise/race/invoke-resolve-get-error-reject.js [strict mode] (previously Failed)
test/built-ins/Promise/race/invoke-resolve-get-error-reject.js (previously Failed)
test/built-ins/Promise/race/resolve-non-obj.js [strict mode] (previously Failed)
test/built-ins/Promise/race/resolve-non-obj.js (previously Failed)
test/built-ins/Promise/race/iter-arg-is-string-resolve.js [strict mode] (previously Failed)
test/built-ins/Promise/race/iter-arg-is-string-resolve.js (previously Failed)
test/built-ins/Promise/race/iter-assigned-true-reject.js [strict mode] (previously Failed)
test/built-ins/Promise/race/iter-assigned-true-reject.js (previously Failed)
test/built-ins/Promise/race/iter-arg-is-undefined-reject.js [strict mode] (previously Failed)
test/built-ins/Promise/race/iter-arg-is-undefined-reject.js (previously Failed)

@codecov
Copy link

codecov bot commented Jun 21, 2022

Codecov Report

Merging #2136 (49042db) into main (3f4232b) will increase coverage by 0.05%.
The diff coverage is 39.02%.

@@            Coverage Diff             @@
##             main    #2136      +/-   ##
==========================================
+ Coverage   43.47%   43.52%   +0.05%     
==========================================
  Files         220      220              
  Lines       19985    20028      +43     
==========================================
+ Hits         8688     8717      +29     
- Misses      11297    11311      +14     
Impacted Files Coverage Δ
boa_engine/src/builtins/array_buffer/mod.rs 9.48% <0.00%> (+0.06%) ⬆️
boa_engine/src/builtins/error/type.rs 94.73% <ø> (ø)
boa_engine/src/builtins/function/mod.rs 25.16% <0.00%> (+0.81%) ⬆️
boa_engine/src/builtins/generator_function/mod.rs 77.27% <ø> (ø)
boa_engine/src/builtins/reflect/mod.rs 77.33% <ø> (ø)
boa_engine/src/builtins/regexp/mod.rs 68.15% <0.00%> (+0.35%) ⬆️
boa_engine/src/builtins/typed_array/mod.rs 3.75% <0.00%> (+0.01%) ⬆️
...gine/src/object/internal_methods/bound_function.rs 0.00% <ø> (ø)
boa_engine/src/object/internal_methods/function.rs 100.00% <ø> (ø)
boa_engine/src/object/internal_methods/mod.rs 67.96% <ø> (ø)
... and 17 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3f4232b...49042db. Read the comment docs.

@jedel1043 jedel1043 requested review from Razican, raskad and HalidOdat and removed request for Razican and raskad June 21, 2022 01:04
boa_engine/src/builtins/array_buffer/mod.rs Outdated Show resolved Hide resolved
boa_engine/src/builtins/function/mod.rs Show resolved Hide resolved
boa_engine/src/builtins/promise/mod.rs Outdated Show resolved Hide resolved
Copy link
Member

@Razican Razican left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks very good :) I added some suggestions for improvements

boa_engine/src/vm/code_block.rs Show resolved Hide resolved
@jedel1043 jedel1043 changed the title Ensure construct always return JsObject Refactor construct and Promise to preserve JsObject invariants Jun 21, 2022
@jedel1043 jedel1043 changed the title Refactor construct and Promise to preserve JsObject invariants Refactor construct and PromiseCapability to preserve JsObject invariants Jun 21, 2022
@jedel1043 jedel1043 requested a review from Razican June 21, 2022 16:20
Copy link
Member

@raskad raskad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice change!

Copy link
Member

@Razican Razican left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! This is a very cool improvement for the internal invariants, and I really liked the enhancements for Promises.

boa_engine/src/object/jsfunction.rs Outdated Show resolved Hide resolved
@Razican
Copy link
Member

Razican commented Jun 22, 2022

bors r+

@bors
Copy link

bors bot commented Jun 22, 2022

🕐 Waiting for PR status (Github check) to be set, probably by CI. Bors will automatically try to run when all required PR statuses are set.

bors bot pushed a commit that referenced this pull request Jun 22, 2022
…nvariants (#2136)

This Pull Request changes the signature of `construct` to always return `JsObject`s, and refactors `PromiseCapability` to store only `JsObject`/`JsFunction`s. This preserves the following invariants specified in the spec:

https://tc39.es/ecma262/multipage/ordinary-and-exotic-objects-behaviours.html#sec-ecmascript-function-objects-construct-argumentslist-newtarget
> The [[Construct]] internal method of an ECMAScript function object ... returns either a normal completion containing an Object or a throw completion ... 

https://tc39.es/ecma262/multipage/control-abstraction-objects.html#sec-promisecapability-records

Table 82: [PromiseCapability Record](https://tc39.es/ecma262/multipage/control-abstraction-objects.html#sec-promisecapability-records) Fields
Field Name | Value | Meaning
-- | -- | --
[[Promise]] | an Object | An object that is usable as a promise.
[[Resolve]] | a function object | The function that is used to resolve the given promise.
[[Reject]] | a function object | The function that is used to reject the given promise.

Co-authored-by: Iban Eguia <razican@protonmail.ch>
@bors
Copy link

bors bot commented Jun 22, 2022

Pull request successfully merged into main.

Build succeeded:

@bors bors bot changed the title Refactor construct and PromiseCapability to preserve JsObject invariants [Merged by Bors] - Refactor construct and PromiseCapability to preserve JsObject invariants Jun 22, 2022
@bors bors bot closed this Jun 22, 2022
@bors bors bot deleted the constructor-improv branch June 22, 2022 08:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
execution Issues or PRs related to code execution Internal Category for changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants