• Benedikt Meurer's avatar
    [turbofan] Introduce a dedicated StringLength operator. · 500d7b93
    Benedikt Meurer authored
    Strings are immutable in JavaScript land (contrast with the runtime,
    where we can truncate strings that haven't escaped to JavaScript yet),
    so the length of a String is immutable. Thus loading the length of a
    String is a pure operation and should be expressed as such (i.e. doesn't
    depend on control or effect). The StringLength operator does exactly
    this and is hooked up to the effect chain in the EffectControlLinearizer.
    
    This will eventually allow us to simplify the optimization of string
    concatention and other operations that are a bit cumbersome in TurboFan
    currently, and it will also allow us to optimize string operations
    across effectful operations, for example combining multiple invocations
    to String#slice with the same inputs.
    
    Bug: v8:5269, v8:6936, v8:7109, v8:7137
    Change-Id: Iffcccbb0c7fc4cfe1281c10e7af24b40eba4c987
    Reviewed-on: https://chromium-review.googlesource.com/799690Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
    Reviewed-by: 's avatarBenedikt Meurer <bmeurer@chromium.org>
    Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#49731}
    500d7b93
simplified-operator.cc 53 KB