Closed
Bug 1163488
Opened 10 years ago
Closed 10 years ago
replace pref lang lookup arrays with preprocessor generated arrays
Categories
(Core :: Graphics: Text, defect)
Core
Graphics: Text
Tracking
()
RESOLVED
FIXED
mozilla42
People
(Reporter: jtd, Assigned: jtd)
References
Details
(Whiteboard: gfx-noted)
Attachments
(1 file)
7.67 KB,
patch
|
m_kato
:
review+
|
Details | Diff | Splinter Review |
There's code in gfxPlatform.cpp for mapping language strings used in all.js to a pref lang enum. There are various arrays that must be maintained in an associated order:
http://mxr.mozilla.org/mozilla-central/source/gfx/thebes/gfxPlatform.cpp#353
http://mxr.mozilla.org/mozilla-central/source/gfx/thebes/gfxPlatform.h#75
Karl thinks this is too brittle and that we should use lookups that rely on case statements and simply let the compiler optimize the lookup code.
https://bugzilla.mozilla.org/show_bug.cgi?id=1056479#c79
Assignee | ||
Updated•10 years ago
|
Summary: replace pref lang lookup arrays with case statement → replace pref lang lookup arrays with switch statements
Another option would be to use the C preprocessor (like nsCSSPropList.h, nsCSSPseudoClassList.h, nsCSSFontDescList.h, etc.).
Comment 2•10 years ago
|
||
> Karl thinks this is too brittle and that we should use lookups that rely on
> case statements and simply let the compiler optimize the lookup code.
Large case statements usually cause lots of mispredicted branches. A lookup table is usually better.
> Another option would be to use the C preprocessor (like nsCSSPropList.h,
> nsCSSPseudoClassList.h, nsCSSFontDescList.h, etc.).
+1 to this. It would allow you to keep the lookup table, while also guaranteeing the different parts of the code follow the same ordering.
Assignee | ||
Updated•10 years ago
|
Summary: replace pref lang lookup arrays with switch statements → replace pref lang lookup arrays with preprocessor generated arrays
Updated•10 years ago
|
Whiteboard: gfx-noted
Assignee | ||
Comment 3•10 years ago
|
||
Consolidate the data arrays maintained for use with pref font handling into a shared list. Use preprocessor to populate arrays and maintain ordering between enum and lang atom/strings.
We can probably eliminate the string from the list but that requires a certain amount of refactoring within the pref font code, so that's a bigger job.
Attachment #8631917 -
Flags: review?(m_kato)
Updated•10 years ago
|
Attachment #8631917 -
Flags: review?(m_kato) → review+
Comment 5•10 years ago
|
||
Status: NEW → RESOLVED
Closed: 10 years ago
status-firefox42:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla42
You need to log in
before you can comment on or make changes to this bug.
Description
•