Removing Proxy hasOwn() trap (Was: [[Invoke]] and implicit method calls)

Allen Wirfs-Brock allen at wirfs-brock.com
Tue Sep 24 12:34:55 PDT 2013


On Sep 24, 2013, at 12:15 PM, André Bargull wrote:

>> On Sep 24, 2013, at 8:13 AM, Jason Orendorff wrote:
>> 
>> > On Tue, Sep 24, 2013 at 7:23 AM, Tom Van Cutsem <tomvc.be at gmail.com> wrote:
>> >> [forking from [[invoke]]-thread for clarity]
>> > 
>> > Thanks!
>> > 
>> >> Allen: would the removal of the hasOwn() trap imply that we can drop the
>> >> [[HasOwnProperty]] internal method altogether?
>> 
>> I look at the the opposite way -- we have an 'hasOwn' trap because be have a [[HasOwnProperty]] internal method ;-)
>> 
>> I pretty sure we discussed this before and decided we wanted to keep [[HasOwnProperty]].  However, the only reason I can think of for doing so now is to avoid forcing exotic objects to allocated the property descriptors that [[GetOwnProperty]] produces. 
> 
> Exotic string and integer indexed objects ( = TypedArray instances) provide custom implementations for [[HasOwnProperty]] for exactly this reason. 

And because of proxies, a specified call  to  [[GetOwnProperty]] can't be optimized away unless you're sure you are dealing with an ordinary object.

> 
> 
>> > 
>> > I searched the spec. There are not very many places where
>> > [[HasOwnProperty]] is used; each one can be replaced with a call to an
>> > Abstract Operation defined like this:
>> 
>> Right, an none of the places seem particularly performance sensitive.  In particular, ordinary property lookup uses [[GetOwnProperty]] rather than [[HasOwnProperlty]]
> 
> [[HasProperty]] for ordinary objects also uses [[HasOwnProperty]]. So this needs to be taken into account when searching for performance sensitive calls. 

and most of those [[HasProperty]] calls in the spec. are abstracted within the HasProperty abstract operation, so that also needs to be taken into account.

Allen

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130924/d44dfb5a/attachment.html>


More information about the es-discuss mailing list