3 ms·
Typed arrays are a background thing in this case. The code one writes in asm.js (or compiles to asm.js) doesn't mention them at all. IE6 will see the code and u
by Millennium 14y ago
Typed arrays are a background thing in this case. The code one writes in asm.js (or compiles to asm.js) doesn't mention them at all. IE6 will see the code and use normal arrays, because as far as it knows, that's the only kind of array there is.
- hosay123 14y agoSadly not, I overshot the mark slightly here (what worse an advocate for your stuff than an incorrect advocate!). Typed arrays allow for things like casting, where the same chunk of 'heap' can be seen through multiple views, and interpreted as char* by one, and float* by the other. It can't even be shimmed on IE6, since you can't overload the array indexing operator there. It's entirely possible and easy to implement an extension/variant of Asm.js that could legitimately target these browsers, by providing shimmable names for the array indexing operation, but diminishing returns and all that.. Note nnethercote (parent comment) is one of Mozilla's engineering ninjas and author of Valgrind, it's pretty likely he knows what he's talking about here.
- Millennium 14y agoThat's not what backward-compatibility means here. IE6 sees ordinary JavaScript code and executes it. It's true that it can't do the typed-array magic in the background, but it doesn't have to. The JavaScript code that IE6 sees has the same result as compiled asm.js code would; it just does it in a less-optimal way. That's all that asm.js really is: a set of JavaScript coding conventions that (when followed) prove to be easy to optimize to near-native levels of speed, along with a compiler hint to tell the runtime that these conventions are being used. IE6 doesn't understand the compiler hint, but because the asm.js code is still valid JavaScript, it'll still run. I suspect that either nnethercote and I are using different definitions of backward-compatibility, or nnethercote is mistaken as to what exactly asm.js is. Authorities are less likely to make mistakes, but they can still make them.
- nnethercote 14y agoTyped arrays are an explicit JS feature: https://developer.mozilla.org/en-US/docs/JavaScript/Typed_arrays https://developer.mozilla.org/en-US/docs/JavaScript/Typed_ar.... There's nothing "background" about them. None of IE 6, 7, 8 and 9 support them: http://caniuse.com/typedarrays http://caniuse.com/typedarrays. Ergo, asm.js won't work on IE 6, 7, 8 or 9. (Speaking of authorities: I got this info from azakai, who's the author of Emscripten and one of the designers of asm.js.)