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


#1

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.


#2

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”).


#3

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.


#4

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:


#5

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