3

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?

1 Answer 1

3

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

Sign up to request clarification or add additional context in comments.

2 Comments

Could you show how to pass variables into a function like this, let's assume it was originally written in C++ and then compiled into ASM.
There's a good example in the link I posted. You should have a pretty good idea of the possibilities after reading the introduction part of that page.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.