• Benedikt Meurer's avatar
    [turbofan] Add support to inline new Array(n) calls. · 34de39bf
    Benedikt Meurer authored
    Make calls like
    
      new Array(n)
      new A(n)
    
    (where A is a subclass of Array) inlinable into TurboFan. We do this by
    speculatively checking that n is an unsigned integer that is not greater
    than JSArray::kInitialMaxFastElementArray, and then lowering the backing
    store allocation to a builtin call. The speculative optimization is
    either protected by the AllocationSite for the Array constructor
    invocation (if we have one), or by a newly introduced global protector
    cell that is used for Array constructor invocations that don't have an
    AllocationSite, i.e. the ones from Array#map, Array#filter, or from
    subclasses of Array.
    
    Next step will be to implement the backing store allocations inline in
    TurboFan, but that requires Loop support in the GraphAssembler, so it's
    done as a separate CL. This should further boost the performance.
    
    This boosts the ARES6 ML benchmark by up to 8% on the steady state,
    and also improves monomorphic Array#map calls by around 20-25% on the
    initial setup.
    
    Bug: v8:6399
    Tbr: ulan@chromium.org
    Change-Id: I7c8bdecf7c814ce52db6ee3051c3206a4f7d4bb6
    Reviewed-on: https://chromium-review.googlesource.com/704639
    Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
    Reviewed-by: 's avatarBenedikt Meurer <bmeurer@chromium.org>
    Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
    Reviewed-by: 's avatarMichael Stanton <mvstanton@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#48348}
    34de39bf
array-constructor-feedback.js 6.72 KB