• jgruber's avatar
    [builtins] Add builtins constants list to roots · ad74be52
    jgruber authored
    This is a step towards off-heap (and eventually isolate-independent)
    builtins.
    
    Off-heap code cannot use the standard CallStub/CallRuntime mechanisms,
    since they directly embed the callee code object pointer within the
    caller.  There are two main issues with that: 1. the callee may be
    moved by GC, and 2. the pc-relative addressing we currently use breaks
    (i.e. ends up pointing to a random spot on the heap) when moving the
    caller off-heap.
    
    This CL addresses that by introducing a constants list stored on the
    roots array.  Instead of embedding code targets, we now have the option
    of loading them from constants list. The code sequence is:
    
    REX.W movq rax,[r13+0x4a0]  // Load the constants cache.
    REX.W movq rdx,[rax+0xf]    // From there, load the code target.
    ...
    REX.W addq rdx,0x5f         // Add instruction_start.
    call rdx
    
    There's no visible performance impact on the web tooling benchmark.
    
    This list will later be extended to also contain other constants such
    as Strings.
    
    Bug: v8:6666
    Change-Id: Ifcf67d1f682804ba0b6d3d0383216e16575b6bf5
    Reviewed-on: https://chromium-review.googlesource.com/923729
    Commit-Queue: Jakob Gruber <jgruber@chromium.org>
    Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
    Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#51434}
    ad74be52
test-isolate-independent-builtins.cc 9.62 KB