• Tobias Tebbi's avatar
    [torque] uniform flattening and string access in Torque · 65d2c4b4
    Tobias Tebbi authored
    Port String::Flatten to Torque (using a fast C call for the
    non-allocating part) and provide fast and easy access to sequential
    string data in Torque: GetStringData() flattens if necessary and
    computes slices that allow direct access.
    
    Applications: String.prototype.replaceAll, String.prototype.endsWith,
      and String.prototype.beginsWith now use GetStringData() and direct
      slice access instead of the slow StringCharCodeAt and they no
      longer bail out to the runtime for flattening.
    
    Drive-by changes:
      - Expose String instance type bits as bitfields and enums in Torque.
      - Fix method lookup in Torque to include superclass methods.
      - Use char8 and char16 types in more places.
      - Allow fast C calls with void return type.
      - Add Torque macros to create subslices.
      - Add no-GC scopes to runtime functions loading external string data.
    
    
    Bug: v8:7793
    Change-Id: I763b9b24212770307c9b2fe9f070f21f65d68d58
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2565515
    Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
    Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#71611}
    65d2c4b4
string.tq 8.19 KB