Closed Bug 1267269 Opened 4 years ago Closed 4 years ago

Make MIRType an enum class

Categories

(Core :: JavaScript Engine: JIT, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla49
Tracking Status
firefox49 --- fixed

People

(Reporter: jandem, Assigned: jandem)

Details

Attachments

(1 file)

Attached patch PatchSplinter Review
The attached patch makes MIRType an enum class. 

We currently use a MIRType_ prefix for the enum values, so the difference is small (MIRType_Int32 -> MIRType::Int32). The main advantage here is better type safety.

There were ~2 places in IonTypes.h where I had to cast a MIRType to unsigned but other than that everything compiled fine after a global search-and-replace.
Attachment #8744923 - Flags: review?(bbouvier)
Comment on attachment 8744923 [details] [diff] [review]
Patch

Review of attachment 8744923 [details] [diff] [review]:
-----------------------------------------------------------------

Heroic! Thanks a lot for doing that.

Methodology for reviewing:
- apply the sed line, on the same parent revision
- commit
- diff the exported patches to see the differences

For what it's worth, the sed line I've used was:

for f in **/*.{h,cpp}; do mv $f $f.old; sed 's/MIRType_/MIRType::/g' $f.old > $f; rm -f $f.old; done
Attachment #8744923 - Flags: review?(bbouvier) → review+
https://hg.mozilla.org/mozilla-central/rev/b940a11bc559
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla48
Target Milestone: mozilla48 → mozilla49
You need to log in before you can comment on or make changes to this bug.