• Igor Sheludko's avatar
    [builtins] Port String.prototype.substr to Torque · 3c57ad21
    Igor Sheludko authored
    ... and refactor String.prototype.substring.
    
    This is done to simplify cleaning up callers of ConvertToRelativeIndex()
    in a follow-up CL.
    
    This CL also introduces Smi-overflow friendly helper function
      ClampToIndexRange(index: JSAny, min: uintptr, max: uintptr): uintptr
    
    which can be used in other String builtins as a better alternative to
      NumberMin(NumberMax(value, min), max)
    pattern.
    
    Bug: v8:8996, v8:4153
    Change-Id: Ie1bb5ab305ebf851c033d109ffe9e6afb9418274
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1872392
    Commit-Queue: Igor Sheludko <ishell@chromium.org>
    Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#64463}
    3c57ad21
builtins-string-gen.h 9.47 KB