On Wed, Jul 29, 2015 at 11:05 PM Zach Bjornson <[email protected]> wrote:

> Some of this has been discussed before, but the API has changed a lot
> recently and I'm lost a bit in the discussion.
>
> In v8 4.2.77.20 (version in iojs 2.4.0) the following seems to work for
> arrays *larger than 64 bytes:*
>
>     Local<Uint8ClampedArray> arr = args[0].As<Uint8ClampedArray>();
>     void *data = arr->GetIndexedPropertiesExternalArrayData();
>
> For arrays smaller than 64 bytes, data is 0. I'm guessing this is an
> artifact of small arrays being sliced off from a shared buffer while larger
> arrays are assigned their own memory? I'm not sure if this is even supposed
> to work. Trevor Norris asked in November and didn't get a reply (
> https://groups.google.com/forum/#!msg/v8-dev/qathcB2-M-A/MVKwE8oHVH4J).
>
>
V8 can store the elements directly on the object, the (configurable) upper
bound for this is indeed 64 bytes. If you want to access them as an
external array, you can get the buffer from the typed array, that'll change
the representation to use an external array.


> As far as I understand, the Get/SetIndexedProperties... API is being
> removed in v8 4.3 and the proper interface there is
> ArrayBuffer::GetContents (to not externalize the ArrayBuffer) (discussed
> here <https://github.com/nodejs/io.js/issues/1451>, here
> <https://codereview.chromium.org/1092923002> and here
> <https://codereview.chromium.org/1095083002>). Is all that correct?
>
> yes. GetContents works independently of whether the data is in external
array or on heap.

best
-jochen


> Thanks,
> Zach
>
> --
> --
> v8-users mailing list
> [email protected]
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to