Closed Bug 1874683 Opened 1 year ago Closed 1 year ago

Reimplement String.prototype.{codePointAt, at} in C++

Categories

(Core :: JavaScript Engine: JIT, enhancement, P1)

enhancement

Tracking

()

RESOLVED FIXED
124 Branch
Tracking Status
firefox124 --- fixed

People

(Reporter: anba, Assigned: anba)

References

(Blocks 1 open bug)

Details

Attachments

(11 files)

48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review

Re-implement String.prototype.{codePointAt, at} in C++ as an alternative to bug 1874373.

  • Move jit::StringFromCharCode and jit::StringFromCodePoint to "builtin/String.cpp".
  • Call js::StringFrom{CharCode,CodePoint} instead of str_from{CharCode,CodePoint}_one_arg
    to avoid unnecessary JS::Value boxing.
  • Replace str_charCodeAt_impl by directly calling JSString::getChar in "jit/Recover.cpp",
    which allows to merge str_charCodeAt_impl and str_charCodeAt.
  • Add ToStringIndex to use a single implementation for the character index computation, but
    mark it as MOZ_ALWAYS_INLINE to ensure we don't observe any calling overhead.
  • Update spec references and step comments to match the latest spec draft.
  • Add trailing comma after JS_FS_END for nicer clang-formatting.

Used in part 5.

Depends on D198558

Move the existing surrogate code point test code into MacroAssembler in
preparation for part 5.

Depends on D198559

Extend MacroAssembler::loadStringChar and the corresponding branch methods to
support loading code points from a string.

Depends on D198560

Transpile LoadStringCodePoint similar to how LoadStringCharCodeResult is processed.

Depends on D198562

Used in part 10.

Depends on D198564

Transpile LoadStringAtResult similar to how LoadStringCharResult is processed.

Depends on D198566

Severity: -- → N/A
Priority: -- → P1
Pushed by andre.bargull@gmail.com: https://hg.mozilla.org/integration/autoland/rev/8fd07a0373ed Part 1: Clean-up and modernize String character access built-ins. r=jandem https://hg.mozilla.org/integration/autoland/rev/167fa0e1edfc Part 2: Port String.prototype.codePointAt to C++. r=jandem https://hg.mozilla.org/integration/autoland/rev/041a4d1c5612 Part 3: Add MacroAssembler::add32 with three operands. r=jandem https://hg.mozilla.org/integration/autoland/rev/3300300f9bcc Part 4: Add surrogate test methods to MacroAssembler. r=jandem https://hg.mozilla.org/integration/autoland/rev/018fe863b284 Part 5: Add MacroAssembler methods to load a code point. r=jandem https://hg.mozilla.org/integration/autoland/rev/bfe3913d8912 Part 6: Inline String.prototype.codePointAt in CacheIR. r=jandem https://hg.mozilla.org/integration/autoland/rev/e99e8882a3d7 Part 7: Transpile LoadStringCodePoint. r=jandem,nbp https://hg.mozilla.org/integration/autoland/rev/6e500448d6a9 Part 8: Port String.prototype.at to C++. r=jandem https://hg.mozilla.org/integration/autoland/rev/e267856d532c Part 9: Add MacroAssembler::cmp32Load32. r=jandem https://hg.mozilla.org/integration/autoland/rev/2098e0be66bf Part 10: Inline String.prototype.at in CacheIR. r=jandem https://hg.mozilla.org/integration/autoland/rev/3f41e0c8e5a1 Part 11: Transpile LoadStringAtResult. r=jandem
Regressions: 1875821
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: