• Benedikt Meurer's avatar
    [cleanup] Remove obsolete "one byte data hint" for strings. · 683cf6f4
    Benedikt Meurer authored
    In the early days of Chrome when we used WebKit there was no support for
    ASCII strings on the C++ side, so we put a hint onto these two-byte
    strings that said "string only contains one byte data", such that
    internally in V8 when these were involved in string operations, we could
    instead create the *cheaper* one byte strings.
    
    Nowadays Blink properly supports one-byte string representations and
    this additional hint only comes with overhead, since we check it in
    quite a few places (i.e. on the hot path for string concatenation), plus
    we end up consuming more memory due to the additional string maps.
    Removing the hint also frees one bit in the InstanceType zoo for
    strings.
    
    This alone improves performance on the `bench-dom-serialize.js` test case
    by around **3%**.
    
    Tbr: mstarzinger@chromium.org
    Bug: v8:6622, v8:8834, v8:8939
    Cq-Include-Trybots: luci.chromium.try:linux-blink-rel
    Change-Id: I0753f2859cee7b5a37b6f0da64d8ec39fcb044ff
    Doc: https://bit.ly/fast-string-concatenation-in-javascript
    Reviewed-on: https://chromium-review.googlesource.com/c/1498478
    Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
    Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#60006}
    683cf6f4
v8-internal.h 14 KB