Docs: the ownKeys invariant check charges code units only for names it looks up

For an extensible target whose own properties are all configurable, the
check reads each property's descriptor for one unit of fuel and returns
before it looks any name up, so it does not charge for code units. The
paragraph in docs/mcp.md now says which part of the check charges per key
and which part charges per code unit.
This commit is contained in:
dotCooCoo committed 2026-12-01 20:25:00 -08:00
1 parent 21bca75580
commit 18b8e71086
1 file changed
+3 -1
+3 -1
View File
@@ -2863,7 +2863,9 @@ globals `Proxy`, with `Proxy.revocable`, and `Reflect` (https://262.ecma-interna
and 26.2), with string and Symbol property keys. A trap is a script call: it takes fuel and counts against the limit on nested calls.
The copy of the property name it is given, key lists retained by enumeration callers, and the names retained during
a `for-in` prototype walk count against the heap limit. Each name an `ownKeys` trap returns takes fuel for its
UTF-16 code units, as does each name the proxy invariants check. A trap result that breaks one of the proxy invariants,
UTF-16 code units. The `ownKeys` invariant check takes one unit of fuel for each of the target's own keys. When the
target is non-extensible or has a non-configurable property, the check also looks names up in the trap's result, and
each name it looks up takes fuel for its UTF-16 code units. A trap result that breaks one of the proxy invariants,
or any operation on a revoked proxy, throws a `TypeError`. A
proxy in a command's params throws a `TypeError` without running its traps. An engine that `#targetengine` keeps gets
`Proxy` and `Reflect` at its first ECMAScript 2015 run and keeps them for later `.jsx` runs.