Remove or replace macros/definitions in jsutil.h and jstypes.h with modern replacements

RESOLVED FIXED in Firefox 61

Status

()

enhancement
P3
normal
RESOLVED FIXED
Last year
Last year

People

(Reporter: anba, Assigned: anba)

Tracking

Trunk
mozilla61
Points:
---

Firefox Tracking Flags

(firefox60 wontfix, firefox61 fixed)

Details

Attachments

(7 attachments, 3 obsolete attachments)

No description provided.
AutoScopedAssign was only used in jsexn.cpp, replace it with MakeScopeExit and then remove AutoScopedAssign from jsutil.
Attachment #8955480 - Flags: review?(jorendorff)
The bitmap macros are only used in BytecodeEmitter.cpp, we can replace them with the bit-array-element functions (also defined in jsutil.h) and then remove the bitmap macros completely. The bit-array-element functions are internally asserting that no out-of-bounds access happens, so it's not less safe even though we're now passing the pointer returned by |Vector::begin()| to the bit-array-element functions.
Attachment #8955483 - Flags: review?(jorendorff)
The JS_SILENCE_UNUSED_VALUE_IN_EXPR macro is only used in builtin/Profilers.cpp, move it to that file so it's not accidentally used instead of mozilla::Unused.
Attachment #8955484 - Flags: review?(jorendorff)
Replace the few remaining uses of JS_ALWAYS_{TRUE,FALSE} with MOZ_ALWAYS_{TRUE,FALSE}.
Attachment #8955485 - Flags: review?(jorendorff)
Remove JSBasicStats from jsutil because it appears to be unused.
Attachment #8955486 - Flags: review?(jorendorff)
- JS_EXPORT_API was only used in js/src/shell/js.cpp and js/xpconnect/src/nsXPConnect.cpp, replace it with MOZ_EXPORT.
- And then we can remove all JS_{EXTERN,EXPORT,IMPORT} macros from jstypes.h, because they are no longer used.
- JS_BITS_PER_BYTE was only used twice, replace it CHAR_BIT, which is already used elsewhere.
- Remove the unused JS_BITS_PER_BYTE_LOG2 macro.
- And also remove the unused JS_EXTENSION macros.
Attachment #8955487 - Flags: review?(jorendorff)
Attachment #8955480 - Flags: review?(jorendorff) → review+
Attachment #8955483 - Flags: review?(jorendorff) → review+
Attachment #8955484 - Flags: review?(jorendorff) → review+
Attachment #8955485 - Flags: review?(jorendorff) → review+
Attachment #8955486 - Flags: review?(jorendorff) → review+
Comment on attachment 8955487 [details] [diff] [review]
bug1442599-part6-jstypes-macros.patch

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

Thanks!
Attachment #8955487 - Flags: review?(jorendorff) → review+
I've forgot to remove no longer used #includes and |using| declarations in part 5. 

While removing them I've noticed that |mozilla::Maybe| is used unqualified in jsutil.cpp. This currently works because jsutil.cpp includes vm/HelperThreads.h which in turn includes vm/JSContext.h which in turn includes vm/Runtime.h which in turn includes gc/ZoneGroup.h which in turn includes gc/Statistics.h and gc/Statistics.h has |using mozilla::Maybe|. And because vm/JSContext.h is part of this include chain, more or less any file in js/src can currently use |mozilla::Maybe| unqualified. Let's fix that and remove |using mozilla::Maybe| from gc/Statistics.h and then handle the fallout in various files.
Attachment #8955701 - Flags: review?(jorendorff)
Comment on attachment 8955701 [details] [diff] [review]
bug1442599-part7-using-and-includes.patch

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

*sustained, thunderous applause*
Attachment #8955701 - Flags: review?(jorendorff) → review+
Update part 1 to apply cleanly on inbound, carrying r+.
Attachment #8955480 - Attachment is obsolete: true
Attachment #8959146 - Flags: review+
Update part 4 to apply cleanly on inbound, carrying r+.
Attachment #8955485 - Attachment is obsolete: true
Attachment #8959147 - Flags: review+
Update part 7 to apply cleanly on inbound and to fix new files which don't properly include "mozilla/Maybe.h", carrying r+.
Attachment #8955701 - Attachment is obsolete: true
Attachment #8959149 - Flags: review+
Pushed by ryanvm@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/61ecd1a2547c
Part 1: Replace AutoScopedAssign with MakeScopeExit. r=jorendorff
https://hg.mozilla.org/integration/mozilla-inbound/rev/593825fbb674
Part 2: Replace bitmap macros with BitArrayElement functions. r=jorendorff
https://hg.mozilla.org/integration/mozilla-inbound/rev/12150eddce35
Part 3: Move JS_SILENCE_UNUSED_VALUE_IN_EXPR macro to last remaining call site. r=jorendorff
https://hg.mozilla.org/integration/mozilla-inbound/rev/2269c7ed37ff
Part 4: Replace JS_ALWAYS_TRUE/FALSE with MOZ_ALWAYS_TRUE/FALSE. r=jorendorff
https://hg.mozilla.org/integration/mozilla-inbound/rev/43b8be56fa06
Part 5: Remove "Basic stats" from jsutil. r=jorendorff
https://hg.mozilla.org/integration/mozilla-inbound/rev/1ff23ca2f9fd
Part 6: Remove macros from jstypes.h when unused or replacements exist. r=jorendorff
https://hg.mozilla.org/integration/mozilla-inbound/rev/2c450d858f01
Part 7: Clean up using and includes in jsutil. r=jorendorff
Keywords: checkin-needed
You need to log in before you can comment on or make changes to this bug.