Allow arbitrary directives in asm.js module/nested function Directive Prologues

It would be useful to allow arbitrary directives (expression-statements containing string literals) in the Directive Prologue of asm.js modules and nested functions, as long as they don’t have semantic effect (so, currently, everything but “use strict”).

This extension would be useful in that it would allow us to later experiment with AOT-compilation hints. For example, one thing we’re considering (but not yet proposing) is having processing directives that tell the AOT-compiler whether an individual nested function is hot or cold. More experimentation is required, but it’d be nice if all this experimentation could happen independently of the validation predicate.

Actually, while strict-mode doesn’t cause any fundamental conflicts, it is strictly more work to support per-function strictness, so I’d prefer to allow any “non-semantically-defined processing directives” (which, currently, and for the forseeable future, is just “use strict”).

Module level & nested function level directives are going to be first expression statement in the Module\function body right? (Similar to “use strict”). If yes this looks good to me.

Current implementation in Firefox agrees with this, so I think this is what was meant in the first post, which could be updated to that matter :slight_smile:

Agreed. I just realized that “processing directive” isn’t the official terminology, Directive Prologue is. I’ll fix in OP.