Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inserting ASM.JS code into vanilla javascript

Just a simple question, can I include a section of asm.js code in a set of normal javascript, as a function or otherwise, similar to how I can put ASM code into a C program for areas that need special optimization?

like image 269
Ecksters Avatar asked Sep 15 '26 18:09

Ecksters


1 Answers

Yes. Use the

"use asm";

prologue directive on top of the function block (i.e. function or file) that is asm. Full example:

function MyAsmModule() {
    "use asm";
    // module body
}

See http://asmjs.org/spec/latest/#introduction for more information

like image 146
Willem Mulder Avatar answered Sep 18 '26 06:09

Willem Mulder



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!