Avoid useless SIMD checks in CharacterData::ToCString

RESOLVED FIXED in Firefox 61

Status

()

enhancement
P2
normal
RESOLVED FIXED
a year ago
a year ago

People

(Reporter: hsivonen, Assigned: hsivonen)

Tracking

unspecified
mozilla61
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox61 fixed)

Details

Attachments

(1 attachment)

Assignee

Description

a year ago
We append as ASCII buffer shorter than 16, so AppendASCIItoUTF16 is an overkill.
Assignee

Updated

a year ago
Blocks: 1402247
Comment hidden (mozreview-request)

Comment 2

a year ago
mozreview-review
Comment on attachment 8962078 [details]
Bug 1448581 - Use AppendPrintf() in CharacterData::ToCString(). .

https://reviewboard.mozilla.org/r/230916/#review236746

Why don't we just

::: dom/base/CharacterData.cpp:430
(Diff revision 1)
>        } else if (ch == '>') {
>          aBuf.AppendLiteral(">");
>        } else if ((ch < ' ') || (ch >= 127)) {
>          char buf[10];
>          SprintfLiteral(buf, "\\u%04x", ch);
> -        AppendASCIItoUTF16(buf, aBuf);
> +        aBuf.AppendASCII(buf);

It'd be even cleaner if we just `aBuf.AppendPrintf("\\u%04x", ch);`.
Attachment #8962078 - Flags: review?(nika) → review+
Comment hidden (mozreview-request)
Assignee

Comment 4

a year ago
mozreview-review-reply
Comment on attachment 8962078 [details]
Bug 1448581 - Use AppendPrintf() in CharacterData::ToCString(). .

https://reviewboard.mozilla.org/r/230916/#review236746

> It'd be even cleaner if we just `aBuf.AppendPrintf("\\u%04x", ch);`.

Thanks for pointing out the existence of that method! Fixed.

Comment 5

a year ago
Pushed by hsivonen@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/729b8eb8a432
Use AppendPrintf() in CharacterData::ToCString(). r=mystor.
Priority: -- → P2

Comment 6

a year ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/729b8eb8a432
Status: ASSIGNED → RESOLVED
Last Resolved: a year ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla61
You need to log in before you can comment on or make changes to this bug.