Inserting ASM.JS code into vanilla javascript

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

+3


source to share


1 answer


Yes. Use

"use asm";

      

a prologue directive on top of a function block (i.e. function or file), which is asm. Complete example:



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

      

More on http://asmjs.org/spec/latest/#introduction

+3


source







All Articles