• peterwmwong's avatar
    [builtins] Fast path TA.p.subarray creating TypedArray when default constructor is used · 7c35c03b
    peterwmwong authored
    Previously, the following call sequence was always made when creating resulting
    subsetted TypedArray:
    1) TFJ TypedArrayPrototypeSubArray
    2) TFS TypedArrayConstructor
    3) TFS CreateTypedArray
    
    This CL, skips #2 and goes straight to #3 when the default constructor (builtin) is
    safe to use (IsPrototypeTypedArrayPrototype and
    !IsTypedArraySpeciesProtectorCellInvalid).
    
    Local TypedArrays/SubarrayNoSpecies microbenchmark shows ~35-40% improvement...
    
    BEFORE
    TypedArrays-SubarrayNoSpecies(Score): 1033530
    TypedArrays-SubarrayNoSpecies(Score): 1018490
    TypedArrays-SubarrayNoSpecies(Score): 1037030
    
    AFTER
    TypedArrays-SubarrayNoSpecies(Score): 1439030
    TypedArrays-SubarrayNoSpecies(Score): 1417540
    TypedArrays-SubarrayNoSpecies(Score): 1405980
    
    Bug: v8:7161
    Change-Id: I356dace36570aa161ffe208a57a80e46714121a2
    Reviewed-on: https://chromium-review.googlesource.com/c/1331154
    Commit-Queue: Peter Wong <peter.wm.wong@gmail.com>
    Reviewed-by: 's avatarPeter Marshall <petermarshall@chromium.org>
    Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#57458}
    7c35c03b
typedarray.js 31 KB