Add dedicate ParseNode subclasses for function/module, and do not use JSOp
Categories
(Core :: JavaScript Engine, enhancement, P3)
Tracking
()
People
(Reporter: arai, Assigned: arai)
References
Details
Attachments
(4 files)
CodeNode uses several kind of JSOp to express multiple kind of function/method in multiple kind of situation.
We should create dedicated enum class and use it instead to simplicify and clarity.
which should also make bug 1473796 simpler.
Assignee | ||
Comment 1•5 years ago
|
||
turns out that most cases are just obsolete.
https://treeherder.mozilla.org/#/jobs?repo=try&revision=563d7534cd8ff4a1bff24038c94b4e29702f020e
https://hg.mozilla.org/try/rev/0d4b1c79c0d0b2b23b3799b41a0ab9bdf28c82e1#l2.12
bool functionIsHoisted() const {
MOZ_ASSERT(isKind(ParseNodeKind::Function));
- MOZ_ASSERT(
- isOp(JSOP_LAMBDA) || // lambda
- isOp(JSOP_LAMBDA_ARROW) || // arrow function
- isOp(JSOP_DEFFUN) || // non-body-level function statement
- isOp(JSOP_NOP) || // body-level function stmt in global code
- isOp(JSOP_GETLOCAL) || // body-level function stmt in function code
- isOp(JSOP_GETARG) || // body-level function redeclaring formal
- isOp(JSOP_INITLEXICAL)); // block-level function stmt
- return !isOp(JSOP_LAMBDA) && !isOp(JSOP_LAMBDA_ARROW) && !isOp(JSOP_DEFFUN);
+ return isOp(JSOP_NOP);
}
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Comment 2•5 years ago
|
||
pn_op for CodeNode can only be JSOP_NOP, JSOP_LAMBDA, and JSOP_LAMBDA_ARROW.
Removed other cases.
Also removed the override with JSOP_FUNWITHPROTO given the field is never read
after the function.
Assignee | ||
Comment 3•5 years ago
|
||
CodeNode was shared between ParseNodeKind::Function and ParseNodeKind::Module,
but Module only uses pn_u.code.body
.
Separated them for further refactoring for function part.
Depends on D18325
Assignee | ||
Comment 4•5 years ago
|
||
This is a replacement for pn_op that is used in BytecodeEmitter.
This patch just adds the field, but keeps using pn_op.
Part 4 removes the usage of pn_op for FunctionNode.
Depends on D18327
Assignee | ||
Comment 5•5 years ago
|
||
Depends on D18328
Assignee | ||
Comment 6•5 years ago
|
||
Comment 7•5 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/42be5dc5a73a
https://hg.mozilla.org/mozilla-central/rev/22428c15bb03
https://hg.mozilla.org/mozilla-central/rev/c753ec107783
https://hg.mozilla.org/mozilla-central/rev/a8aa16000d01
Updated•5 years ago
|
Description
•