|I looked at our handling in JSC, and assuming similar behaviour in V8 this is likely a bug in the TypedArray implementation in WebKit itself. The engines already correctly pessimise access :-/|
On Apr 13, 2012, at 7:01 AM, Glenn Maynard wrote:
2012/4/13 Stéphan Kochen <firstname.lastname@example.org>
I was more surprised mixing type was allowed like this, and I suppose it's because it also accepts a plain Array. If it weren't for that, everyone would simply be calling memmove().
It's not actually like memcpy/memmove, because of the conversion that happens if the types are different. It's only memmove if the types happen to be the same.
As an aside, it doesn't seem like the conversion is actually defined, eg. if you set() an Int16Array onto an Int8Array and some values overflow. I'm not sure where the conversion is defined even for eg. array8 = 2000 (somewhere in WebIDL, I assume), but set() should use the same rules.