javascriptasm.js

How to suppress asm.js compilation message?


When using asm.js code some browsers emit a compilation message. This one:

Successfully compiled asm.js code (loaded from cache in 201ms)

Is there a way to suppress this message?


Solution

  • The message itself is here: https://hg.mozilla.org/mozilla-central/file/tip/js/src/js.msg#l357

    MSG_DEF(JSMSG_USE_ASM_TYPE_OK, 1, JSEXN_WARN, "Successfully compiled asm.js code ({0})")
    

    And it is emitted here: https://hg.mozilla.org/mozilla-central/file/tip/js/src/wasm/AsmJS.cpp#l8718

    static bool
    SuccessfulValidation(AsmJSParser& parser, UniqueChars str)
    {
        return parser.warningNoOffset(JSMSG_USE_ASM_TYPE_OK, str.get());
    }
    

    Which is called here: https://hg.mozilla.org/mozilla-central/file/tip/js/src/wasm/AsmJS.cpp#l8877

        // Success! Write to the console with a "warning" message.
        *validated = true;
        SuccessfulValidation(parser, Move(message));
        return NoExceptionPending(cx);
    }
    

    There is no apparent "optionality" in that line, even the comment says that it is going to the console, period.

    Otherwise JSEXN_WARN has a couple real occurrences only (in jsexn.h, jsexn.cpp and in jsapi.h), the latter one descibes it as it is practically an exception type which does not break execution and does not have a scary part ("Error:..."): https://hg.mozilla.org/mozilla-central/file/tip/js/src/jsapi.h#l580

    * JSEXN_WARN is used for warnings in js.msg files (for instance because we
    * don't want to prepend 'Error:' to warning messages). This value can go away
    * if we ever decide to use an entirely separate mechanism for warnings.
    

    And it is true, most checks for JSEXN_WARN are about skipping the throw of an actual exception, in a if ( ... || exnType == JSEXN_WARN || ... ) do nothing fashion, like here (just one, ad-hoc example).

    I am not sure what you really need, but

    How to supress asm.js compilation message?

    Via building your own copy of Firefox: https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Build_Instructions/Simple_Firefox_build