On 20 December 2012 23:51, Rafael Weinstein <[email protected]> wrote:

> On Tue, Dec 11, 2012 at 5:42 AM, <[email protected]> wrote:
>
>> Description:
>> Object.observe: prevent observed objects from using fast elements.
>>
>> This is necessary because polymorphic stores generally
>> do not perform a map check but only an instance type check,
>> which misses out on changes in the observation status.
>> Unfortunately, there currently is no efficient way in V8
>> to maintain that optimisation in the presence of Object.observe.
>>
>
> Out of curiosity, how expensive would the additional map check be? I.e.
> how much would it regress relevant benchmarks?
>

The cost isn't so much the map check itself, but the fact that a failed map
check would deopt (and introduce more polymorphic sites). Only checking the
elements kind makes sure that any access to indexed properties (i.e.,
especially arrays) is completely oblivious to differences in other aspects
of the objects it sees. Apparently, that scheme was introduced because it
was relevant for benchmarks. I don't have any concrete numbers, though.

The only way we saw to maintain this scheme would be by duplicating the
observation status in the elements kind. But given the already highly
complex lattice of elements kinds, and the number of specialised code paths
it implies, our array experts scared stiff in terror at the mere idea.

/Andreas

-- 
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to