Closed
Bug 1455548
Opened 7 years ago
Closed 4 years ago
Refactor BytecodeEmitter to let us emit bytecode without a ParseNode
Categories
(Core :: JavaScript Engine, enhancement, P2)
Core
JavaScript Engine
Tracking
()
People
(Reporter: Yoric, Assigned: arai)
References
(Depends on 1 open bug)
Details
Right now, we have a bunch of `BytecodeEmitter::emit*`, many of which take as argument a `ParseNode`. Ideally, we'd like to be able to emit bytecode without having a ParseNode.
This means refactoring `BytecodeEmitter` as follows:
- expose a bunch of APIs that are the building blocks for the `emit*` but don't need a ParseNode – with clear documentation on how to use them;
- refactor the `emit*` methods as drivers for these APIs;
- move the `emit*` methods to a subclass of `BytecodeEmitter`.
Assignee | ||
Updated•7 years ago
|
Assignee: nobody → arai.unmht
Status: NEW → ASSIGNED
Updated•7 years ago
|
status-firefox61:
--- → affected
Priority: -- → P1
Comment hidden (obsolete) |
Assignee | ||
Comment 2•7 years ago
|
||
another update.
https://treeherder.mozilla.org/#/jobs?repo=try&revision=2259f80dff35ee8f5e703602924906c67bc0e54d&filter-searchStr=sm%20plain%20linux%20opt%2064
now the js shell can execute binjs file without creating ParseNode tree, with the following command:
(where test.binjs is binary for `print(10);`)
js --binast-direct -B js/src/jsapi-tests/binast/test.binjs
still the number of supported syntax is very small, but I think this can be done incrementally.
Assignee | ||
Comment 3•7 years ago
|
||
In the WIP patch series, I implemented the consumer inside BytecodeEmitter.cpp, because helper classes and some BytecodeEmitter related classes are defined inside BytecodeEmitter.cpp.
ultimately the consumer should be moved outside of BytecodeEmitter.cpp, that means those helper classes need to be exposed to BytecodeEmitter.h (or maybe separate file might be better, because current BytecodeEmitter consumers don't need those helpers)
Assignee | ||
Updated•7 years ago
|
status-firefox61:
affected → ---
Assignee | ||
Comment 4•7 years ago
|
||
update:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=8f2430413ee2ef9941edcdff80e45634705d1c2b
Implemented call expression.
compared to parser, we have to look more into child nodes inside single function while emitting,
in order to determine what bytecode to emit before each child node.
this might be troublesome, for example in destructuring, because of emitting order, and because single expression can contain function (that means, we should temporarily create AST for subtree, or support seek in tokenizer).
Assignee | ||
Comment 5•7 years ago
|
||
(In reply to Tooru Fujisawa [:arai] from comment #4)
> compared to parser, we have to look more into child nodes inside single
> function while emitting,
> in order to determine what bytecode to emit before each child node.
or, we should design the helper functions to defer receiving each parameter as much as possible,
like, current IfEmitter (IfThenElseEmitter) expects that the existence of else-clause is known at the beginning,
but with current BinAST structure it's unknown until we start parsing the else-clause.
then, in IfEmitter's case, the expectation is based on the source note structure,
(SRC_IF vs SRC_IF_ELSE)
so, in some case it might require modifying bytecode or source note after emitting them.
Updated•7 years ago
|
status-firefox62:
--- → wontfix
Updated•7 years ago
|
status-firefox63:
--- → wontfix
Updated•7 years ago
|
status-firefox64:
--- → wontfix
status-firefox65:
--- → affected
Updated•7 years ago
|
Priority: P1 → P2
Comment 6•4 years ago
|
||
Resolving BinAST bugs as Incomplete.
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → INCOMPLETE
You need to log in
before you can comment on or make changes to this bug.
Description
•