Closed Bug 817401 Opened 12 years ago Closed 8 years ago

Prototype ForwardToTarget

Categories

(Core :: JavaScript Engine, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: bruant.d, Unassigned)

References

Details

A discussion on es-discuss suggested that invariant checks may be expensive [1]. It led to the idea of a new proxy type (notification proxy) [2]. These proxies are less powerful than the current ones, but the idea of having traps forward the operation to the target and then bypassing invariants is still a good idea. Enters ForwardToTarget [3][4][5] (no need to read everything, it's just for reference)

Here is how it could be implemented:
1) Add a new Proxy.ForwardToTarget property which value is an object (maybe one day it'll be a symbol or a constructor, but for now an object will be enough).
2) When a trap throws this particular object (check wit SameValue algorithm), the JS engine forwards the operation to the target and returns the proper value to the calling code, very much like when there is no trap.
By nature of forwarding to the target, the result can't violate an object invariant, so invariant checking are bypassed.

It is expected that traps throwing Proxy.ForwardToTarget are faster than traps returning and passing through invariant checks, but it will be interesting feedback if it's not the case to understand why it is not.


[1] https://mail.mozilla.org/pipermail/es-discuss/2012-November/026510.html
[2] https://mail.mozilla.org/pipermail/es-discuss/2012-November/026587.html
[3] https://mail.mozilla.org/pipermail/es-discuss/2012-November/026606.html
[4] https://mail.mozilla.org/pipermail/es-discuss/2012-November/026629.html
[5] https://mail.mozilla.org/pipermail/es-discuss/2012-December/026768.html
Blocks: 703537
Assignee: general → nobody
This is not part of ES2015 and does not look like something that is planned.
Closing accordingly.
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.