v8/test/mjsunit/harmony
Joyee Cheung f77b05d464 [class] fix evaluation order and errors in private accessor assignments
In assignments the lhs should be evaluated first and shouldn't be
re-evaluated when the value of the rhs is available. Fix it by
saving the receiver and the key registers into AssignmentLhsData
before building the assignment and use them later, instead of visiting
the AST again to retrieve the receiver.

In addition, now that we save the receiver register, use it to
perform the brand check even when we know for sure that it's
going to fail later because it's a write to a private
method or accessing the accessor in the wrong way (v8:11364),
so that the brand check error always appears first if it is present,
as specified in
https://tc39.es/proposal-private-methods/#sec-privatefieldget

Drive-by: unify the brand check error messages, and replace "Object"
with "Receiver" in the messages for clarity. The instance private
brand check now throws "Receiver must be an instance of class <name>"
and the static private brand check now throws "Receiver must be
class <name>". Also always set the expression position to the
property load position, because the brand check failure comes from
the load operation.

Bug: v8:12352, v8:11364
Change-Id: I61a8979b2e02b561dd5b2b35f9e0b6691fe07599
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3266964
Commit-Queue: Joyee Cheung <joyee@igalia.com>
Reviewed-by: Marja Hölttä <marja@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#77797}
2021-11-09 15:36:28 +00:00
..
bigint [bigint] Truncate huge error messages 2021-09-01 10:09:52 +00:00
regress
weakrefs Rename stress_flush_bytecode to stress_flush_code 2021-08-02 19:02:57 +00:00
aggregate-error.js [flags] Remove --harmony-promise-any 2020-11-12 01:09:38 +00:00
array-concat-array-proto-getter.js
array-concat-array-proto.js
array-concat-object-proto-dict-getter.js
array-concat-object-proto-dict.js
array-concat-object-proto-generic-dict.js
array-concat-object-proto.js
array-findlast-unscopables.js [builtins] Implement Array#findFromLast and friends 2021-07-29 19:37:15 +00:00
array-flat-species.js
array-flat.js
array-flatMap-species.js
array-flatMap.js
array-prototype-findlast.js [builtins] Implement Array#findFromLast and friends 2021-07-29 19:37:15 +00:00
array-prototype-findlastindex.js [builtins] Implement Array#findFromLast and friends 2021-07-29 19:37:15 +00:00
array-sort-comparefn.js
async-await-optimization.js
async-for-of-non-iterable.js
async-from-sync-iterator-next-tick-count.js
async-from-sync-iterator-return-tick-count.js
async-from-sync-iterator-throw-tick-count.js
async-from-sync-iterator.js
async-generators-basic.js
async-generators-resume-return.js [d8][mjsunit][tools] Improve d8 file API 2021-06-01 13:37:57 +00:00
async-generators-return.js [d8][mjsunit][tools] Improve d8 file API 2021-06-01 13:37:57 +00:00
async-generators-throw-caught.js Add a synthetic return for async generator functions 2020-02-24 19:33:46 +00:00
async-generators-yield.js [d8][mjsunit][tools] Improve d8 file API 2021-06-01 13:37:57 +00:00
async-iterators-resolve.js
atomics-on-arraybuffer-detach.js [atomics] Relax Atomics methods to work on ArrayBuffers 2020-08-13 22:10:07 +00:00
atomics-value-check.js [test] Make worker related tests more fuzzable 2021-01-26 12:09:59 +00:00
atomics-waitasync-1thread-2timeout.js [d8][mjsunit][tools] Improve d8 file API 2021-06-01 13:37:57 +00:00
atomics-waitasync-1thread-buffer-out-of-scope-timeout.js [d8][mjsunit][tools] Improve d8 file API 2021-06-01 13:37:57 +00:00
atomics-waitasync-1thread-promise-out-of-scope.js Reland2: [Atomics.waitAsync] Implement Atomics.waitAsync 2020-07-21 06:43:48 +00:00
atomics-waitasync-1thread-timeout.js [d8][mjsunit][tools] Improve d8 file API 2021-06-01 13:37:57 +00:00
atomics-waitasync-1thread-timeouts-and-no-timeouts.js [test] Make worker related tests more fuzzable 2021-01-26 12:09:59 +00:00
atomics-waitasync-1thread-wake-up-all.js Reland2: [Atomics.waitAsync] Implement Atomics.waitAsync 2020-07-21 06:43:48 +00:00
atomics-waitasync-1thread-wake-up-fifo.js Reland2: [Atomics.waitAsync] Implement Atomics.waitAsync 2020-07-21 06:43:48 +00:00
atomics-waitasync-1thread-wake-up-simple.js Reland2: [Atomics.waitAsync] Implement Atomics.waitAsync 2020-07-21 06:43:48 +00:00
atomics-waitasync-helpers.js [test] Make worker related tests more fuzzable 2021-01-26 12:09:59 +00:00
atomics-waitasync-worker-shutdown-before-wait-finished-2-waits.js [test] Make worker related tests more fuzzable 2021-01-26 12:09:59 +00:00
atomics-waitasync-worker-shutdown-before-wait-finished-2-workers.js [test] Make worker related tests more fuzzable 2021-01-26 12:09:59 +00:00
atomics-waitasync-worker-shutdown-before-wait-finished-no-timeout.js [test] Make worker related tests more fuzzable 2021-01-26 12:09:59 +00:00
atomics-waitasync-worker-shutdown-before-wait-finished-timeout.js [test] Make worker related tests more fuzzable 2021-01-26 12:09:59 +00:00
atomics-waitasync.js Reland2: [Atomics.waitAsync] Implement Atomics.waitAsync 2020-07-21 06:43:48 +00:00
atomics.js [atomics] Relax Atomics methods to work on ArrayBuffers 2020-08-13 22:10:07 +00:00
bigintarray-keyedstore-tobigint.js
block-lazy-compile.js
class-static-blocks.js [class] Disallow return in class static blocks 2021-05-18 06:19:07 +00:00
dataview-accessors.js
define-private-class-field-stress.js [class] Add IC support for defining class fields to replace runtime call 2021-10-13 10:40:24 +00:00
error-cause.js [init] Error cause should not present on Error.prototype 2021-07-23 06:38:46 +00:00
eval-param-scoping.js Remove per-parameter position var scope 2019-12-19 10:38:00 +00:00
for-await-of.js
function-tostring.js
futex.js [test] Make worker related tests more fuzzable 2021-01-26 12:09:59 +00:00
generators-reduced.js
generators.js
global-configurable.js
global-writable.js
global.js
harmony-string-pad-end.js
harmony-string-pad-start.js
has-own.js [Object.hasOwn] Implementation Object.hasOwn tc39 proposal 2021-05-31 08:46:56 +00:00
hashbang-eval.js
import-from-compilation-errored.js [test] Remove unused --harmony-dynamic-import flag 2021-11-05 10:30:58 +00:00
import-from-evaluation-errored.js [test] Remove unused --harmony-dynamic-import flag 2021-11-05 10:30:58 +00:00
import-from-fetch-errored.js [test] Remove unused --harmony-dynamic-import flag 2021-11-05 10:30:58 +00:00
import-from-instantiation-errored.js [test] Remove unused --harmony-dynamic-import flag 2021-11-05 10:30:58 +00:00
logical-assignment-function-name.js Reland "Set .name of anonymous functions on the RHS of logical assignment." 2020-06-03 23:14:58 +00:00
logical-assignment.js Implement logical assignment 2020-04-23 07:23:58 +00:00
module-parsing-eval.mjs
modules-import-1.mjs [test] Remove unused --harmony-dynamic-import flag 2021-11-05 10:30:58 +00:00
modules-import-2.mjs [test] Remove unused --harmony-dynamic-import flag 2021-11-05 10:30:58 +00:00
modules-import-3.mjs [test] Remove unused --harmony-dynamic-import flag 2021-11-05 10:30:58 +00:00
modules-import-4.mjs [test] Remove unused --harmony-dynamic-import flag 2021-11-05 10:30:58 +00:00
modules-import-5.mjs [test] Remove unused --harmony-dynamic-import flag 2021-11-05 10:30:58 +00:00
modules-import-6.mjs [test] Remove unused --harmony-dynamic-import flag 2021-11-05 10:30:58 +00:00
modules-import-7.mjs [test] Remove unused --harmony-dynamic-import flag 2021-11-05 10:30:58 +00:00
modules-import-8.mjs [test] Remove unused --harmony-dynamic-import flag 2021-11-05 10:30:58 +00:00
modules-import-9.mjs [test] Remove unused --harmony-dynamic-import flag 2021-11-05 10:30:58 +00:00
modules-import-10.mjs [test] Remove unused --harmony-dynamic-import flag 2021-11-05 10:30:58 +00:00
modules-import-11.mjs [test] Remove unused --harmony-dynamic-import flag 2021-11-05 10:30:58 +00:00
modules-import-12.mjs [test] Remove unused --harmony-dynamic-import flag 2021-11-05 10:30:58 +00:00
modules-import-13.mjs [test] Remove unused --harmony-dynamic-import flag 2021-11-05 10:30:58 +00:00
modules-import-14.mjs [test] Remove unused --harmony-dynamic-import flag 2021-11-05 10:30:58 +00:00
modules-import-15-top-level-await.mjs [test] Remove unused --harmony-dynamic-import flag 2021-11-05 10:30:58 +00:00
modules-import-15.mjs [test] Remove unused --harmony-dynamic-import flag 2021-11-05 10:30:58 +00:00
modules-import-16.mjs [test] Remove unused --harmony-dynamic-import flag 2021-11-05 10:30:58 +00:00
modules-import-17.mjs
modules-import-assertions-1.mjs [modules][api] Add version of HostImportModuleDynamically with import assertions 2021-01-26 04:15:15 +00:00
modules-import-assertions-2.mjs [modules][api] Add version of HostImportModuleDynamically with import assertions 2021-01-26 04:15:15 +00:00
modules-import-assertions-3.mjs [modules][api] Add version of HostImportModuleDynamically with import assertions 2021-01-26 04:15:15 +00:00
modules-import-assertions-4.mjs [modules][api] Add version of HostImportModuleDynamically with import assertions 2021-01-26 04:15:15 +00:00
modules-import-assertions-dynamic-1.mjs [modules][api] Add version of HostImportModuleDynamically with import assertions 2021-01-26 04:15:15 +00:00
modules-import-assertions-dynamic-2.mjs [modules][api] Add version of HostImportModuleDynamically with import assertions 2021-01-26 04:15:15 +00:00
modules-import-assertions-dynamic-3.mjs [modules][api] Add version of HostImportModuleDynamically with import assertions 2021-01-26 04:15:15 +00:00
modules-import-assertions-dynamic-4.mjs [modules][api] Add version of HostImportModuleDynamically with import assertions 2021-01-26 04:15:15 +00:00
modules-import-assertions-dynamic-5.mjs [modules][api] Add version of HostImportModuleDynamically with import assertions 2021-01-26 04:15:15 +00:00
modules-import-assertions-dynamic-6.mjs [modules][api] Add version of HostImportModuleDynamically with import assertions 2021-01-26 04:15:15 +00:00
modules-import-assertions-dynamic-7.mjs [modules][api] Add version of HostImportModuleDynamically with import assertions 2021-01-26 04:15:15 +00:00
modules-import-assertions-dynamic-8.mjs [modules][api] Add version of HostImportModuleDynamically with import assertions 2021-01-26 04:15:15 +00:00
modules-import-assertions-dynamic-9.mjs [modules][api] Add version of HostImportModuleDynamically with import assertions 2021-01-26 04:15:15 +00:00
modules-import-assertions-dynamic-10.mjs [modules][api] Add version of HostImportModuleDynamically with import assertions 2021-01-26 04:15:15 +00:00
modules-import-assertions-dynamic-11.mjs Fix top-level await crash from synthetic module being evaluated twice 2021-02-10 16:50:25 +00:00
modules-import-assertions-dynamic-12.mjs Handle failure in KeyAccumulator::GetKeys 2021-05-06 17:05:51 +00:00
modules-import-large.mjs
modules-import-meta.mjs
modules-import-namespace.mjs
modules-import-rqstd-order-async-cycle.mjs [top-level-await] Implement spec fix for cycle root detection 2021-02-03 18:07:58 +00:00
modules-import-rqstd-order-async-subgraph.mjs [top-level-await] Implement the new post-order requirement for async subgraphs 2021-03-19 19:22:04 +00:00
modules-import-rqstd-order-top-level-await-1.mjs
modules-import-rqstd-order-top-level-await-2.mjs
modules-import-rqstd-order-top-level-await-3.mjs
modules-import-rqstd-order-top-level-await-4.mjs
modules-import-rqstd-order-top-level-await-5.mjs
modules-import-rqstd-order-top-level-await-6.mjs
modules-import-rqstd-order-top-level-await-7.mjs
modules-import-rqstd-order-top-level-await-8.mjs
modules-import-top-level-await-1.mjs [test] Remove unused --harmony-dynamic-import flag 2021-11-05 10:30:58 +00:00
modules-import-top-level-await-2.mjs [test] Remove unused --harmony-dynamic-import flag 2021-11-05 10:30:58 +00:00
modules-import-top-level-await-3.mjs [test] Remove unused --harmony-dynamic-import flag 2021-11-05 10:30:58 +00:00
modules-import-top-level-await-4.mjs [test] Remove unused --harmony-dynamic-import flag 2021-11-05 10:30:58 +00:00
modules-import-top-level-await-5.mjs [test] Remove unused --harmony-dynamic-import flag 2021-11-05 10:30:58 +00:00
modules-import-top-level-await-6.mjs [test] Remove unused --harmony-dynamic-import flag 2021-11-05 10:30:58 +00:00
modules-import-top-level-await-7.mjs [test] Remove unused --harmony-dynamic-import flag 2021-11-05 10:30:58 +00:00
modules-import-top-level-await-8.mjs [test] Remove unused --harmony-dynamic-import flag 2021-11-05 10:30:58 +00:00
modules-import-top-level-await-cycle.mjs [test] Remove unused --harmony-dynamic-import flag 2021-11-05 10:30:58 +00:00
modules-import-top-level-await-exception-1.mjs [test] Remove unused --harmony-dynamic-import flag 2021-11-05 10:30:58 +00:00
modules-import-top-level-await-exception-2.mjs [test] Remove unused --harmony-dynamic-import flag 2021-11-05 10:30:58 +00:00
modules-import-top-level-await-exception-3.mjs [test] Remove unused --harmony-dynamic-import flag 2021-11-05 10:30:58 +00:00
modules-skip-1-rqstd-order-indirect-top-level-await.mjs
modules-skip-1-rqstd-order-indirect-unreached-top-level-await.mjs
modules-skip-1-rqstd-order-top-level-await.mjs
modules-skip-1-rqstd-order-unreached-top-level-await.mjs
modules-skip-1-rqstd-order.mjs
modules-skip-1-top-level-await-cycle.mjs
modules-skip-1-top-level-await.mjs
modules-skip-1.json [modules][api] Add version of HostImportModuleDynamically with import assertions 2021-01-26 04:15:15 +00:00
modules-skip-1.mjs
modules-skip-2-rqstd-order-indirect-top-level-await.mjs
modules-skip-2-rqstd-order-top-level-await.mjs
modules-skip-2-rqstd-order.mjs
modules-skip-2-top-level-await-cycle.mjs
modules-skip-2-top-level-await.mjs
modules-skip-2.mjs
modules-skip-3-rqstd-order-indirect-top-level-await.mjs
modules-skip-3-rqstd-order-top-level-await.mjs
modules-skip-3-rqstd-order.mjs
modules-skip-3-top-level-await-cycle.mjs
modules-skip-3-top-level-await.mjs
modules-skip-3.mjs
modules-skip-4-rqstd-order-indirect-top-level-await.mjs
modules-skip-4-rqstd-order-top-level-await.mjs
modules-skip-4-rqstd-order.mjs
modules-skip-4-top-level-await-cycle.mjs
modules-skip-4-top-level-await.mjs
modules-skip-4.mjs
modules-skip-5-top-level-await.mjs
modules-skip-5.mjs [test] Remove unused --harmony-dynamic-import flag 2021-11-05 10:30:58 +00:00
modules-skip-6-top-level-await.mjs
modules-skip-6.mjs [test] Remove unused --harmony-dynamic-import flag 2021-11-05 10:30:58 +00:00
modules-skip-7-top-level-await.mjs
modules-skip-7.mjs [test] Remove unused --harmony-dynamic-import flag 2021-11-05 10:30:58 +00:00
modules-skip-8.mjs
modules-skip-9.mjs
modules-skip-10.mjs
modules-skip-11.mjs
modules-skip-12.mjs
modules-skip-13.mjs
modules-skip-async-cycle-1.mjs [top-level-await] Implement spec fix for cycle root detection 2021-02-03 18:07:58 +00:00
modules-skip-async-cycle-2.mjs [top-level-await] Implement spec fix for cycle root detection 2021-02-03 18:07:58 +00:00
modules-skip-async-cycle-3.mjs [top-level-await] Implement spec fix for cycle root detection 2021-02-03 18:07:58 +00:00
modules-skip-async-cycle-leaf.mjs [top-level-await] Implement spec fix for cycle root detection 2021-02-03 18:07:58 +00:00
modules-skip-async-cycle-start.mjs [top-level-await] Implement spec fix for cycle root detection 2021-02-03 18:07:58 +00:00
modules-skip-async-subgraph-1.mjs [top-level-await] Implement the new post-order requirement for async subgraphs 2021-03-19 19:22:04 +00:00
modules-skip-async-subgraph-2.mjs [top-level-await] Implement the new post-order requirement for async subgraphs 2021-03-19 19:22:04 +00:00
modules-skip-async-subgraph-async.mjs [top-level-await] Implement the new post-order requirement for async subgraphs 2021-03-19 19:22:04 +00:00
modules-skip-async-subgraph-start.mjs [top-level-await] Implement the new post-order requirement for async subgraphs 2021-03-19 19:22:04 +00:00
modules-skip-async-subgraph-x.mjs [top-level-await] Implement the new post-order requirement for async subgraphs 2021-03-19 19:22:04 +00:00
modules-skip-empty.mjs
modules-skip-export-import-meta.mjs
modules-skip-imports-json-1.mjs [modules][api] Add version of HostImportModuleDynamically with import assertions 2021-01-26 04:15:15 +00:00
modules-skip-large1.mjs
modules-skip-large2.mjs
modules-skip-top-level-await-cycle-error-indirection.mjs [modules] Fix AsyncModuleExecutionFulfilled with pending error 2021-08-09 15:15:03 +00:00
modules-skip-top-level-await-cycle-error-throwing.mjs [modules] Fix AsyncModuleExecutionFulfilled with pending error 2021-08-09 15:15:03 +00:00
modules-skip-top-level-await-cycle-error.mjs [modules] Fix AsyncModuleExecutionFulfilled with pending error 2021-08-09 15:15:03 +00:00
modules-top-level-await-cycle-error.mjs [modules] Fix AsyncModuleExecutionFulfilled with pending error 2021-08-09 15:15:03 +00:00
nullish.js
numeric-separator.js
object-fromentries.js
optional-catch-binding-breaks.js
optional-catch-binding.js
optional-chaining-this-private.js [class] Fix parenthesized calls of optional chains containing private fields 2020-05-25 19:04:54 +00:00
optional-chaining-this.js
optional-chaining.js Support the o?.#foo syntax 2020-04-14 10:16:25 +00:00
private-accessors.js [class] fix evaluation order and errors in private accessor assignments 2021-11-09 15:36:28 +00:00
private-brand-checks.js [parser] Fix parsing '#x in expr' in binary expressions 2021-09-23 17:36:03 +00:00
private-fields-ic.js
private-fields-special-object.js Reland "[d8] Verify host-defined options" 2021-11-04 22:28:18 +00:00
private-fields-static.js
private-fields.js
private-methods-empty-inner.js [flags] Remove --harmony-private-methods 2020-11-12 23:21:53 +00:00
private-methods.js [flags] Remove --harmony-private-methods 2020-11-12 23:21:53 +00:00
private-name-scopes.js
private-symbols.js
private.js
promise-all-settled.js [flags] Remove --harmony-promise-all-settled 2020-11-03 19:34:42 +00:00
promise-any-overflow-1.js [d8][mjsunit][tools] Improve d8 file API 2021-06-01 13:37:57 +00:00
promise-any-overflow-2.js [d8][mjsunit][tools] Improve d8 file API 2021-06-01 13:37:57 +00:00
promise-any-resolve-not-callable.js [d8][mjsunit][tools] Improve d8 file API 2021-06-01 13:37:57 +00:00
promise-any.js [d8][mjsunit][tools] Improve d8 file API 2021-06-01 13:37:57 +00:00
promise-prototype-finally.js [d8][mjsunit][tools] Improve d8 file API 2021-06-01 13:37:57 +00:00
public-instance-class-fields.js
public-static-class-fields.js
regexp-change-exec.js
regexp-dotall.js
regexp-match-indices.js [dict-proto] Constness tracking of dictionary properties (jitless) 2021-02-04 11:42:33 +00:00
regexp-named-captures.js [regexp] Update capture name parsing for recent spec changes 2021-11-05 10:09:07 +00:00
regexp-overriden-exec.js
regexp-property-binary.js
regexp-property-char-class.js
regexp-property-enumerated.js
regexp-property-exact-match.js
regexp-property-general-category.js
regexp-property-invalid.js
regexp-property-lu-ui0.js
regexp-property-lu-ui1.js
regexp-property-lu-ui2.js
regexp-property-lu-ui3.js
regexp-property-lu-ui4.js
regexp-property-lu-ui5.js
regexp-property-lu-ui6.js
regexp-property-lu-ui7.js
regexp-property-lu-ui8.js
regexp-property-lu-ui9.js
regexp-property-lu-ui.js
regexp-property-script-extensions.js
regexp-property-scripts.js
regexp-property-special.js
regress-generators-resume.js
relative-indexing-methods.js Add 'at' to Array.prototype[@@unscopables] 2020-11-24 15:41:11 +00:00
set-prototype-of.js
sharedarraybuffer-stress.js
sharedarraybuffer-worker-gc-stress.js [d8][mjsunit][tools] Improve d8 file API 2021-06-01 13:37:57 +00:00
sharedarraybuffer.js [builtins] TypedArray.prototype.set with number 2021-09-02 00:06:23 +00:00
static-private-methods.js [flags] Remove --harmony-private-methods 2020-11-12 23:21:53 +00:00
string-matchAll-deleted-matchAll.js
string-matchAll.js Reland "[torque] Allow storing to bitfield structs that are stored in Smis" 2020-04-22 10:34:46 +00:00
string-replaceAll.js [replaceAll] Fix replaceAll overflow with StringCompareSequence. 2019-12-26 18:47:05 +00:00
symbol-async-iterator.js
symbol-description.js
to-length.js [interpreter] Remove unused interpreter intrinsics 2021-06-17 13:43:41 +00:00
to-name.js
to-number.js
to-string.js [cleanup] Remove ToString intrinsic 2021-04-23 15:02:42 +00:00
trailing-commas-length.js
typedarray-findlast.js [builtins] Implement Array#findFromLast and friends 2021-07-29 19:37:15 +00:00
typedarray-findlastindex.js [builtins] Implement Array#findFromLast and friends 2021-07-29 19:37:15 +00:00
typedarray-set-length-detach.js [elements] Remove detach CHECK from the generic TypedArray#set 2020-09-22 16:10:38 +00:00
well-formed-json-stringify-checked.js
well-formed-json-stringify-unchecked.js