Closed
Bug 1491104
Opened 8 years ago
Closed 8 years ago
Add a script to (re)generate all binjs files in tree at once
Categories
(Core :: JavaScript Engine, enhancement, P3)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla64
| Tracking | Status | |
|---|---|---|
| firefox64 | --- | fixed |
People
(Reporter: arai, Assigned: arai)
References
Details
Attachments
(3 files)
|
16.30 KB,
patch
|
Yoric
:
review+
|
Details | Diff | Splinter Review |
|
4.90 KB,
patch
|
Yoric
:
review+
|
Details | Diff | Splinter Review |
|
210.87 KB,
patch
|
Yoric
:
review+
|
Details | Diff | Splinter Review |
We have multiple binjs files in tree.
those files are supposed to be updated every time the spec or format changes.
we should put a script that automates the step in tree.
| Assignee | ||
Comment 1•8 years ago
|
||
| Assignee | ||
Comment 2•8 years ago
|
||
testing/web-platform/mozilla/tests/binast/{small,large}.js are slightly different from the
source of testing/web-platform/mozilla/tests/binast/{small,large}.binjs, that binASTLoaded is true vs false.
added the source with binASTLoaded=true to use it from script.
| Assignee | ||
Comment 3•8 years ago
|
||
This script encodes all in-tree binjs files (let me know if I overlook something)
the script also supports babel, which is not yet used.
I'll add more testcases from jstests/jit-test, with babel, to convert all ES6+ feature into ES5 syntax.
Attachment #9014002 -
Flags: review?(dteller)
| Assignee | ||
Comment 4•8 years ago
|
||
and the result of the script.
Attachment #9014003 -
Flags: review?(dteller)
Comment on attachment 9014003 [details] [diff] [review]
Part 3: Update in-tree binjs files.
Review of attachment 9014003 [details] [diff] [review]:
-----------------------------------------------------------------
r=me
Attachment #9014003 -
Flags: review?(dteller) → review+
Attachment #9014001 -
Flags: review?(dteller) → review+
Comment on attachment 9014002 [details] [diff] [review]
Part 2: Add a script to regenerate all binjs files in tree.
Review of attachment 9014002 [details] [diff] [review]:
-----------------------------------------------------------------
So, Python code to drive a Rust application that's going to call into Node?
Why not :)
::: js/src/jsapi-tests/binast/README.md
@@ +4,5 @@
> +./encode.py \
> + --topsrcdir={path to mozilla-unified} \
> + --binjsdir={path to binjs-ref clone} \
> + --binjs_encode={path to binjs_encode} \
> + --babel={path to babel command} \
That would deserve some explanation about what babel is used for.
::: js/src/jsapi-tests/binast/encode.py
@@ +14,5 @@
> + help='cwd when running binjs_encode')
> +parser.add_option('--binjs_encode', dest='binjs_encode',
> + help='path to binjs_encode commad')
> +parser.add_option('--babel', dest='babel',
> + help='path to babel command')
Here, too, an explanation of what babel is used for would be useful.
@@ +20,5 @@
> + help='path to babel-preset-env')
> +(options, args) = parser.parse_args()
> +
> +if not os.path.isdir(options.topsrcdir):
> + print('topsrcdir directory {} does not exit'.format(options.topsrcdir),
s/exit/exists/g
In the entire file :)
@@ +40,5 @@
> + print('babel-preset-env directory {} does not exit'.format(options.babel_preset_env),
> + file=sys.stderr)
> + sys.exit(1)
> +
> +def encode(infile_path, outfile_path, use_babel=False, binjs_encode_args=[]):
It's probably faster if we can use a single call to `binjs_encode`, especially once we start reusing processes, but we don't have to do it now. Follow bug?
@@ +50,5 @@
> + if use_babel:
> + cmd = [options.babel,
> + '--presets={}'.format(options.babel_preset_env)]
> + babel_proc = subprocess.Popen(cmd, stdin=infile, stdout=subprocess.PIPE)
> + binjs_stdin = babel_proc.stdout
An alternative would be to babel everything (if needed) then call binjs_encode a single time. Your call.
Attachment #9014002 -
Flags: review?(dteller) → review+
| Assignee | ||
Comment 7•8 years ago
|
||
thank you for reviewing :D
about babel part, I need to fix the .babelrc issue anyway (which will change the required arguments)
I'll remove that parts for now.
(In reply to David Teller [:Yoric] (please use "needinfo") from comment #6)
> @@ +40,5 @@
> > + print('babel-preset-env directory {} does not exit'.format(options.babel_preset_env),
> > + file=sys.stderr)
> > + sys.exit(1)
> > +
> > +def encode(infile_path, outfile_path, use_babel=False, binjs_encode_args=[]):
>
> It's probably faster if we can use a single call to `binjs_encode`,
> especially once we start reusing processes, but we don't have to do it now.
> Follow bug?
Yeah, if babel is not used, switching to binjs_encode with --outdir mode should be better.
> @@ +50,5 @@
> > + if use_babel:
> > + cmd = [options.babel,
> > + '--presets={}'.format(options.babel_preset_env)]
> > + babel_proc = subprocess.Popen(cmd, stdin=infile, stdout=subprocess.PIPE)
> > + binjs_stdin = babel_proc.stdout
>
> An alternative would be to babel everything (if needed) then call
> binjs_encode a single time. Your call.
I'm not going to add babel's output in tree, so I have to think about how to handle multiple temporary files.
anyway, will file a bug for it.
| Assignee | ||
Comment 8•8 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/638b59fbfb47e37e088c9cf08fd5ba0ae5282660
Bug 1491104 - Part 1: Add JS files for binast web-platform. r=Yoric
https://hg.mozilla.org/integration/mozilla-inbound/rev/b6a33d28cb1e3fba94d040f4bc025258b02ad3a9
Bug 1491104 - Part 2: Add a script to regenerate all binjs files in tree. r=Yoric
https://hg.mozilla.org/integration/mozilla-inbound/rev/82efcc7fe32fe0bf727f3e9aea588d11c5a24ded
Bug 1491104 - Part 3: Update in-tree binjs files. r=Yoric
| Assignee | ||
Comment 9•8 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/52f118be7c585e6b4012f42463977fdd220a5eb6
Bug 1491104 - followup: fix for lint. r=me CLOSED TREE
Comment 10•8 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/638b59fbfb47
https://hg.mozilla.org/mozilla-central/rev/b6a33d28cb1e
https://hg.mozilla.org/mozilla-central/rev/82efcc7fe32f
https://hg.mozilla.org/mozilla-central/rev/52f118be7c58
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
status-firefox64:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla64
You need to log in
before you can comment on or make changes to this bug.
Description
•