AccessorInfo is a "native data property". It behaves like an accessor from
the embedder point-of-view, but looks like a data property from javascript
(getOwnPropertyDescriptor will return value: ... rather than get(), set(v)).

Even though regular objects can have them too in V8, the embedder can only
attach them to custom receivers. If you see something else, this might be
because you're looking at This() rather than Holder() when loading a
property through the prototype chain. This() will be the object on which
the lookup was started, while Holder() is the custom receiver object on
which the accessor is installed.

hth

On Mon, Jul 20, 2020 at 7:10 PM Jakob Kummerow <[email protected]>
wrote:

> They can be defined on normal objects. The canonical example is
> Array.prototype.length being implemented as an AccessorInfo.
>
>
> On Mon, Jul 20, 2020 at 4:39 PM Jann G <[email protected]> wrote:
>
>> Can an AccessorInfo be defined on normal objects or only custom
>> receivers? There's been some confusion in bug reports like:
>> https://bugs.chromium.org/p/chromium/issues/detail?id=1082355
>> <https://bugs.chromium.org/p/chromium/issues/detail?id=1082355&q=%22PropertyCallbackArguments%3A%3ACallAccessorGetter%22&can=1>
>>  which
>> reaches PropertyCallbackArguments::CallAccessorGetter.
>>
>>
>> On Monday, July 20, 2020 at 1:50:23 PM UTC+1, Jakob Kummerow wrote:
>>>
>>> AFAIK AccessorInfo can only be defined via the C++ API, i.e. by the
>>> embedder (or by V8 itself). AccessorPair is what you get when you define
>>> accessors via JavaScript.
>>>
>>>
>>> On Mon, Jul 20, 2020 at 1:03 PM Jann Godspeed <[email protected]>
>>> wrote:
>>>
>>>> I'm having trouble understanding how AccessInfo works. Can they only be
>>>> defined on special objects?
>>>>
>>>>
>>>> To define an AccessorPair on an object I would do something like
>>>>
>>>> let o = {}
>>>> o.__defineGetter__("test", function() { });
>>>>
>>>> let o = {};
>>>> ???
>>>>
>>>> --
>>>> --
>>>
>>> --
> --
> v8-dev mailing list
> [email protected]
> http://groups.google.com/group/v8-dev
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/v8-dev/CAKSzg3RxoJDrz2DB4Lt1ww0me6T-3xi2xQfGD9nBabR4q%2BKLbw%40mail.gmail.com
> <https://groups.google.com/d/msgid/v8-dev/CAKSzg3RxoJDrz2DB4Lt1ww0me6T-3xi2xQfGD9nBabR4q%2BKLbw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
-- 
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- 
You received this message because you are subscribed to the Google Groups 
"v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/v8-dev/CANS-YRpjwjz%2B4Ky-MR5C4eMsVvYbQN6QKnxquHSiFgRdEYUryw%40mail.gmail.com.

Reply via email to