From:  Tooru Fujisawa <arai.unmht@gmail.com>
Date:  28 Jan 2019 08:17:45 Hong Kong Time
Newsgroup:  news.mozilla.org/mozilla.dev.tech.js-engine.internals
Subject:  

BinAST-encoded jit-test is added

NNTP-Posting-Host:  63.245.210.105

Hi all.

Bug 1495611 [1] added several BinAST encoded testcases to jit-test.
Those tests are encoded from some existing plain JS jit-test files,
and stored in js/src/jit-test/tests/binast/{lazy,nonlazy}/ directories.


# Run them in jit-test

They're disabled by default to avoid timeout on some automation jobs.
Passing `--run-binast` option to jit_test.py enables them.

For more details, see js/src/jit-test/tests/binast/README.md [2].


# Run them in JS shell

On JS shell, passing `-B BINAST_FILE_PATH` runs the BinAST encoded file.


# Update BinAST-encoded test files

This should be the most important part of this message and relevant to
many people.

If you modified the original plain JS testcase (for example, for API change
or spec change or something), the change should also be reflected to the
BinAST encoded testcase.

To update those files, you first need to clone and build binjs-ref [3]
which is the reference encoder for BinAST.

After building binjs-ref, you can update the BinAST encoded testcase by
running js/src/jsapi-tests/binast/encode.py [4] like the following:

./encode.py \
    --topsrcdir=~/somewhere/mozilla-unified \
    --binjsdir=~/somewhere/binjs-ref \
    --binjs_encode=~/somewhere/binjs-ref/target/debug/binjs_encode \
    PATH_TO_BINAST_TESTCASE

where PATH_TO_BINAST_TESTCASE is substring match. and in practice you can
pass the plain JS file's path (relative path from js/src/jit-test/tests/)
excluding the trailing ".js".

For more details, see js/src/jsapi-tests/binast/README.md [5].


# Exclude tests from BinAST encoding

If the source plain JS file of a BinAST file becomes incompatible with
BinAST (for example, when the testcase uses ES6+ feature that is not yet
supported) and either the encoder or the test fails, add the BinAST file's
path to js/src/jsapi-tests/binast/jit-test.ignore [6] file
(the pattern is prefix match), and remove the BinAST test files from the
repository.


# Automation

On automation, they are enabled only in the following jobs:

 - linux64 opt SM(p)
 - linux64 debug SM(p)
 - linux64 debug SM(cgc)

To run them on other jobs, add the following property to the variant files
in js/src/devtools/automation/variants/ directory.

    "conditional-env": {
        "{PLATFORM_HERE}": {
            "JITTEST_EXTRA_ARGS": "--run-binast"
        }
    }

where `{PLATFORM_HERE}` is the value of `variant_platform` variable
in autospider.py [7].


[1] https://bugzilla.mozilla.org/show_bug.cgi?id=1495611
[2] https://searchfox.org/mozilla-central/source/js/src/jit-test/tests/binast/README.md
[3] https://github.com/binast/binjs-ref
[4] https://searchfox.org/mozilla-central/source/js/src/jsapi-tests/binast/encode.py
[5] https://searchfox.org/mozilla-central/source/js/src/jsapi-tests/binast/README.md
[6] https://searchfox.org/mozilla-central/source/js/src/jsapi-tests/binast/jit-test.ignore
[7] https://searchfox.org/mozilla-central/rev/4faab2f1b697827b93e16cb798b22b197e5235c9/js/src/devtools/automation/autospider.py#455-464

-- 
arai