• Ross McIlroy's avatar
    [TurboFan] Type internalized string constants as either Empty or NonEmpty. · db31bd6f
    Ross McIlroy authored
    Previously any object with maps INTERNALIZED_STRING_TYPE or
    ONE_BYTE_INTERNALIZED_STRING_TYPE would be typed as kInternalizedString.
    This meant that non-empty constants weren't typed as such. This causes the
    following issues:
      - StringConcat couldn't be typed lowered to inline cons string allocation
        if there were string constants after the first two operands, since these
        constants would be typed as possibly empty (even if known not to be).
      - When inlining, a heap constant could end up becoming the input to a
        ToPrimitiveToString operand. If the ToPrimitiveToString is speculatively
        lowered to a CheckNonEmpty, then the verifier would fail since the
        typer can't deal well with intersecting a bitset type (NonEmpty) with
        a HeapConstantType - the end result type would be (None | HeapConstant..)
        but the HeapConstantType would retain it's LUB of kInternalizedSeqString,
        (which includes the EmptyString type) and so the verifier would fail
        since the output of CheckNonEmpty would still include the EmptyString.
    
    To address this, when typing an actual object, check for the empty
    string and return EmptyString if it is, otherwise type as normal but
    remove the EmptyString bit since we know it's non-empty.
    
    BUG=v8:6243
    
    Change-Id: I2b34ca24e9b488199dce0d2c092d2701c2b22791
    Reviewed-on: https://chromium-review.googlesource.com/544988Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
    Commit-Queue: Ross McIlroy <rmcilroy@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#46204}
    db31bd6f
types.cc 33.8 KB