• Dan Elphick's avatar
    [embedded handlers] Store the handlers without gaps · 5a9f0556
    Dan Elphick authored
    Previously the builtins table had a value for every single
    OperandScale/Bytecode combination regardless of whether it was valid.
    This change makes it so that only valid bytecode handlers are stored in
    the builtins table. This prevents placeholders being serialized into the
    snapshot (and embedded into the binary) saving 9KB in
    CODE_SPACE/OLD_SPACE and 2.5KB in the embedded data as well as 66
    entries in the builtins table.
    
    To do this, it generates a new header file bytecodes-builtins-list.h
    which is created from the BYTECODE_LIST and OPERAND_SCALE_LIST macros.
    Since list macros cannot be used to conditionally generate elements in
    the C-preprocessor, this is done by generator executable, compiled from
    interpreter/generate-flat-headers.cc.
    
    Additionally the generator creates the flat bytecode list so that it is
    transposed from the previous result, i.e. the results are grouped by
    bytecode and then operand scale rather than operand scale then bytecode.
    This should give better locality for commonly used bytecodes and may
    allow less commonly used ExtraWide bytecodes to never be mapped into
    memory at all.
    
    The cost to storing the handlers densely is that looking up a handler
    now requires a binary search through the builtins table, but this should
    only happen during debugging. It is also fixable at least for non-wide
    handlers and could be improved for wide ones if the need arises.
    
    Bug: v8:8068
    Cq-Include-Trybots: luci.chromium.try:linux_chromium_rel_ng
    Change-Id: Iaad22a952e2858f508030c5ddc082f91bf59f667
    Reviewed-on: https://chromium-review.googlesource.com/1209304
    Commit-Queue: Dan Elphick <delphick@chromium.org>
    Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
    Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#55757}
    5a9f0556
setup-builtins-internal.cc 14.4 KB