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).
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,
here and
here). Is all that correct?
Thanks,
Zach