Rename JSOp::IfNe and JSop::IfEq
Categories
(Core :: JavaScript Engine, task, P3)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox87 | --- | fixed |
People
(Reporter: jorendorff, Assigned: jandem)
Details
Attachments
(2 files)
JSOP_IFEQ means "jump if false".
JSOP_IFNE means "jump if true".
These names are old. The original idea was probably an analogy to assembly language; x86 has je and jne. But in SpiderMonkey this is not a good analogy. These opcode names are super confusing to newcomers. I've wanted to change them forever.
Bikeshed zone: So what should the new names be? I think JSOP_JUMP_IF_TRUE/FALSE. A bit long, but clear. I like JSOP_JT, but then we also have JSOP_JUMPTARGET. JUMP_IF_TRUTHY would be more technically correct, but it would make everyone go "wtf" the first time they see it, and then it'd be ugly forever.
| Reporter | ||
Comment 1•6 years ago
|
||
To illustrate why I think this is confusing: the statement if (x != 0) { f(x); } has bytecode that says getlocal x; zero; ne; ifeq +24
That ne; ifeq sequence is pretty bad imho.
| Assignee | ||
Comment 2•6 years ago
|
||
+10. Whenever I see JSOP_IFEQ or JSOP_IFNE I pause and think "which one is this again?".
JSOP_JUMP_IF_TRUE seems reasonable. At some point I want to rename the bytecode ops so we have JSOp::JumpIfTrue and that's really not that long.
Comment 3•6 years ago
|
||
Updated•6 years ago
|
| Assignee | ||
Comment 4•5 years ago
|
||
IfEq and IfNe are very confusing.
Updated•5 years ago
|
| Assignee | ||
Comment 5•5 years ago
|
||
Depends on D104210
| Assignee | ||
Updated•5 years ago
|
Comment 7•5 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/a670453eafa3
https://hg.mozilla.org/mozilla-central/rev/af48b695bea3
Description
•