• Sathya Gunasekaran's avatar
    [turboprop] Unroll loop in the dynamic map checks operator · 9c67790b
    Sathya Gunasekaran authored
    The dynamic map checks operator loads the feedback vector and performs
    map checks against each map and handler entry in the feedback against
    the incoming map and handler.
    
    Instead of emitting code to iterate over this feedback vector at
    runtime, we unroll this loop at compile time.
    
    The generated code is similar to this pseudocode:
    
      length = feedback_slot.length
      if length >= 4: goto labels[3]
      if length == 3: goto labels[2]
      if length == 2: goto labels[1]
      if length == 1: goto labels[0]
    
      labels[3]:
        map = load(feedback_slot, 6)
        if incoming_map == map goto handler_check(7)
        goto labels[2]
      labels[2]:
        map = load(feedback_slot, 4)
        if incoming_map == map goto handler_check(5)
        goto labels[1]
      labels[1]:
        map = load(feedback_slot, 2)
        if incoming_map == map goto handler_check(3)
        goto labels[0]
      labels[0]:
        map = load(feedback_slot, 0)
        if incoming_map == map goto handler_check(1)
        bailout
    
      handler_check (index):
        handler = load(feedback_slot, index)
        if incoming_handler ==  handler goto done
        deoptimize
    
    Bug: v8:10582, v8:9684
    Change-Id: I64d64ff8eda664e4d476bf1b2612e26a344e98a6
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2339960
    Commit-Queue: Sathya Gunasekaran  <gsathya@chromium.org>
    Reviewed-by: 's avatarMythri Alle <mythria@chromium.org>
    Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#69797}
    9c67790b
fixed-array.h 21.8 KB