Closed Bug 1608089 Opened 2 months ago Closed 2 months ago

Make JSOp an enum class

Categories

(Core :: JavaScript Engine, task, P1)

task

Tracking

()

RESOLVED FIXED
mozilla74
Tracking Status
firefox74 --- fixed

People

(Reporter: jorendorff, Assigned: jorendorff, NeedInfo)

References

(Blocks 1 open bug)

Details

Attachments

(5 files)

For now I'll keep JSOP_GETPROP and so on as aliases for the new names, like JSOp::GetProp, because this touches enough code already that it might be a pain to land.

But in an immediate follow-up bug I'll do the massive search-and-replace.

Apart from type safety, adding CamelCase names to FOR_EACH_OPCODE will make it easier to keep the Rust frontend up to date now that the integer values of the opcodes have been de-stabilized.

Priority: -- → P1

Later we will turn JSOp into an enum class that requires these casts.

In places where we are overwriting a previously written bytecode,
this casts to jsbytecode rather than uint8_t, following the prevailing
style.

Assignee: nobody → jorendorff
Status: NEW → ASSIGNED

The change to PendingEdge is OK because this default value is never used; the
field's accessor asserts that *this was created using one of the constructors
that requires an explicit JSOp from the caller.

Depends on D59359

The snake-case identifiers will be handy in Rust. The plan is to write a script
to import FOR_EACH_OPCODE as a similar Rust macro.

Depends on D59361

The new opcode names are like JSOp::InitHiddenProp. This patch creates
aliases with all of the old names, like JSOP_INITHIDDENPROP, to keep existing
code working.

Depends on D59362

Pushed by jorendorff@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/0774435321f8
Part 1: Add explicit casts between JSOp and uint8_t. r=jandem.
https://hg.mozilla.org/integration/autoland/rev/ad9edb807ff5
Part 2: Make JSOP_LIMIT an int constant rather than a JSOp value. r=jandem.
https://hg.mozilla.org/integration/autoland/rev/c143928209fb
Part 3: Add CamelCase and snake_case identifiers to FOR_EACH_OPCODE. r=jandem.
https://hg.mozilla.org/integration/autoland/rev/67fdb2aebe67
Part 4: Convert JSOp to an enum class. r=jandem.
Pushed by jorendorff@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/64b7a72f6d92
Part 1: Add explicit casts between JSOp and uint8_t. r=jandem.
https://hg.mozilla.org/integration/autoland/rev/790403ad8b09
Part 2: Make JSOP_LIMIT an int constant rather than a JSOp value. r=jandem.
https://hg.mozilla.org/integration/autoland/rev/936afc4e9720
Part 3: Add CamelCase and snake_case identifiers to FOR_EACH_OPCODE. r=jandem.
https://hg.mozilla.org/integration/autoland/rev/a236919785de
Part 4: Convert JSOp to an enum class. r=jandem.
Backout by shindli@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/2db36e83b324
Backed out 4 changesets for causing build bustages CLOSED TREE
Pushed by jorendorff@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/c9e4623c28c6
Part 1: Add explicit casts between JSOp and uint8_t. r=jandem.
https://hg.mozilla.org/integration/autoland/rev/d6e09c1456ae
Part 2: Make JSOP_LIMIT an int constant rather than a JSOp value. r=jandem.
https://hg.mozilla.org/integration/autoland/rev/41c509c1ee6d
Part 3: Add CamelCase and snake_case identifiers to FOR_EACH_OPCODE. r=jandem.
https://hg.mozilla.org/integration/autoland/rev/e8eb26db7f29
Part 4: Convert JSOp to an enum class. r=jandem.
Blocks: 1609208
Attachment #9120824 - Attachment description: Bug 1608089 - Fix up gdb prettyprinters for JSOp enum → Bug 1608089 - Fix up gdb prettyprinters for JSOp enum, r=jorendorff
Pushed by sfink@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/1fee2f8a0b01
Fix up gdb prettyprinters for JSOp enum, r=jorendorff
You need to log in before you can comment on or make changes to this bug.