• Mu Tao's avatar
    [mips][Liftoff] Improve initialization for many locals · 76bc9a86
    Mu Tao authored
    Port a8cdda99
    
    Original Commit Message:
    
        WebAssembly locals are specified to be zero on function entry. Liftoff
        implements this by just storing the constant 0 in the virtual stack for
        integer types, and using one floating point register initialized to
        zero for all floating point types.
        For big counts of locals this leads to problems (manifesting as huge
        blocks of code being generated) once we hit a merge point: All those
        constants (for int) and all duplicate register uses (for floats) need to
        be fixed up, by using separate registers for the locals or spilling to
        the stack if no more registers are available. All this spilling
        generates a lot of code, and can even happen multiple times within a
        function.
    
        This CL optimizes for such cases by spilling all locals to the stack
        initially. All merges within the function body get much smaller then.
        The spilled values rarely have to be loaded anyway, because the initial
        zero value is usually overwritten before the first use.
    
        To optimize the code size for initializing big numbers of locals on the
        stack, this CL also introduces the platform-specific
        {FillStackSlotsWithZero} method which uses a loop for bigger local
        counts.
    
        This often saves dozens of kilobytes for very big functions, and shows
        an overall code size reduction of 4-5 percent for big modules.
    
    R=xwafish@gmail.com
    
    Change-Id: Id65b6d36beadcba0d3f3726bb6559bb316cb212e
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1862830
    Auto-Submit: Mu Tao <pamilty@gmail.com>
    Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
    Commit-Queue: Mu Tao <pamilty@gmail.com>
    Cr-Commit-Position: refs/heads/master@{#64315}
    76bc9a86
liftoff-assembler-mips64.h 46 KB