This section defines the types used by the validation logic.
Validation in limits Java Script programs to only use operations that can be mapped closely to efficient data representations and machine operations of modern architectures, such as 32-bit integers and integer arithmetic.
A combination of static and dynamic validation allows Java Script engines to employ an ahead-of-time (AOT) optimizing compilation strategy for valid code.
This specification is working towards a candidate draft for version 1.
Using an module requires calling its function to obtain an object containing the module's exports; this is known as .
An module can also be given access to standard libraries and custom Java Script functions through linking.
If either dynamic or static validation fails, the implementation must fall back to the interpreter.
But if both validations succeed, calling the module exports executes the binary executable code generated by AOT compilation.
This specification defines asm.js, a strict subset of Java Script that can be used as a low-level, efficient target language for compilers.
This sublanguage effectively describes a sandboxed virtual machine for memory-unsafe languages like C or C .
So in the general case, an module declaration looks like: These annotations serve two purposes: first, to provide the function's type signature so that the validator can enforce that all calls to the function are well-typed; second, to ensure that even if the function is exported and called by external Java Script, its arguments are dynamically coerced to the expected type.