Closed
Bug 1465999
Opened 6 years ago
Closed 6 years ago
Add ExpressionStatementEmitter
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
(1 file)
10.02 KB,
patch
|
Waldo
:
review+
|
Details | Diff | Splinter Review |
Just like others (bug 1456006, bug 1456404), we'll need a class to emit ExpressionStatement, which handles source note and POP/SETRVAL.
Assignee | ||
Updated•6 years ago
|
status-firefox62:
affected → ---
Assignee | ||
Updated•6 years ago
|
Priority: -- → P3
Assignee | ||
Comment 1•6 years ago
|
||
A small abstraction for expression statement + ValueUsage (pop/setrval). ValueUsage is moved to its own header given that it's used from ParseNode independent part.
Attachment #9010845 -
Flags: review?(jwalden+bmo)
Assignee | ||
Comment 2•6 years ago
|
||
Comment on attachment 9010845 [details] [diff] [review] Add ExpressionStatementEmitter. Review of attachment 9010845 [details] [diff] [review]: ----------------------------------------------------------------- ::: js/src/frontend/ExpressionStatementEmitter.cpp @@ +19,5 @@ > + : bce_(bce), > + valueUsage_(valueUsage) > +#ifdef DEBUG > + , state_(State::Start) > +#endif forgot to move this to header. fixed locally.
Comment 3•6 years ago
|
||
Comment on attachment 9010845 [details] [diff] [review] Add ExpressionStatementEmitter. Review of attachment 9010845 [details] [diff] [review]: ----------------------------------------------------------------- ::: js/src/frontend/ExpressionStatementEmitter.cpp @@ +47,5 @@ > + MOZ_ASSERT(state_ == State::Expr); > + MOZ_ASSERT(bce_->stackDepth == depth_ + 1); > + > + if (valueUsage_ == ValueUsage::WantValue) { > + if (!bce_->emit1(JSOP_SETRVAL)) { This seems more readable as JSOp op = valueUsage_ == ValueUsage::WantValue ? JSOP_SETRVAL : JSOP_POP; if (!bce_->emit1(op)) { return false; } across four lines rather than nine. ::: js/src/frontend/ExpressionStatementEmitter.h @@ +28,5 @@ > +// ese.emitExpr(Some(offset_of_expr)); > +// emit(expr); > +// ese.emitEnd(); > +// > +// `expr;` in eval script It feels like you probably should just show this once, with a variable for the ValueUsage value, whose meaning you describe in prose. ::: js/src/frontend/ValueUsage.h @@ +10,5 @@ > +namespace js { > +namespace frontend { > + > +// Used to control whether JSOP_CALL_IGNORES_RV is emitted for function calls. > +enum class ValueUsage { { on its own line. @@ +22,5 @@ > + IgnoreValue > +}; > + > +} /* namespace frontend */ > +} /* namespace js */ //-style comments?
Attachment #9010845 -
Flags: review?(jwalden+bmo) → review+
Assignee | ||
Comment 4•6 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/1be0907510b948b7ba0693dc8410d1348e88e5c5 Bug 1465999 - Add ExpressionStatementEmitter. r=Waldo
Comment 5•6 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/1be0907510b9
Status: ASSIGNED → RESOLVED
Closed: 6 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
•