• jgruber's avatar
    [builtins,x64] pc-relative builtin-to-builtin calls · e5630ea9
    jgruber authored
    This addresses one of the major remaining slowdowns with embedded
    builtins on x64.
    
    When generating code for a call to a builtin callee from a builtin
    caller, we'd look up the Code target object from the builtins constant
    list, calculate the location of the first instruction, and jump to it.
    Note that for embedded builtin callees, the Code object is itself only
    a trampoline to the off-heap code and thus an additional indirection.
    An example of the call sequence in pseudo-asm:
    
    // Load from the constants list.
    mov reg, [kRootPointer, kBuiltinsConstantListOffset]
    mov reg, [reg, offset_of_the_code_constant]
    // Calculate first instruction and call it.
    add reg, Code::kHeaderOffset
    call reg
    // The trampoline forwards to the off-heap area.
    mov kOffHeapTrampolineRegister, <off-heap instruction_start>
    jmp kOffHeapTrampolineRegister
    
    This CL changes calls to embedded builtin targets to use pc-relative
    addressing. This reduces the above instruction sequence to:
    
    call <pc-relative offset to target instruction_start>
    
    Embedded-to-embedded calls jump directly to the embedded instruction
    stream, bypassing the trampoline. Heap-to-embedded calls (and all
    calls to heap-builtins) use pc-relative addressing targeting the
    on-heap Code object.
    
    Other relevant platforms (arm,arm64,mips,mips64) do not use pc-relative
    calls. For these, we'll need a different solution, e.g. a table of
    embedded builtin addresses reachable from the root pointer, similar to
    the external reference table.
    
    Bug: v8:6666
    Change-Id: Ic0317d454e2da37d74eaecebcdfcbc0d5f5041ad
    Reviewed-on: https://chromium-review.googlesource.com/1068732
    Commit-Queue: Jakob Gruber <jgruber@chromium.org>
    Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#53349}
    e5630ea9
Name
Last commit
Last update
..
DEPS Loading commit data...
OWNERS Loading commit data...
builtin-deserializer-allocator.cc Loading commit data...
builtin-deserializer-allocator.h Loading commit data...
builtin-deserializer.cc Loading commit data...
builtin-deserializer.h Loading commit data...
builtin-serializer-allocator.cc Loading commit data...
builtin-serializer-allocator.h Loading commit data...
builtin-serializer.cc Loading commit data...
builtin-serializer.h Loading commit data...
builtin-snapshot-utils.cc Loading commit data...
builtin-snapshot-utils.h Loading commit data...
code-serializer.cc Loading commit data...
code-serializer.h Loading commit data...
default-deserializer-allocator.cc Loading commit data...
default-deserializer-allocator.h Loading commit data...
default-serializer-allocator.cc Loading commit data...
default-serializer-allocator.h Loading commit data...
deserializer.cc Loading commit data...
deserializer.h Loading commit data...
embedded-empty.cc Loading commit data...
macros.h Loading commit data...
mksnapshot.cc Loading commit data...
natives-common.cc Loading commit data...
natives-external.cc Loading commit data...
natives.h Loading commit data...
object-deserializer.cc Loading commit data...
object-deserializer.h Loading commit data...
partial-deserializer.cc Loading commit data...
partial-deserializer.h Loading commit data...
partial-serializer.cc Loading commit data...
partial-serializer.h Loading commit data...
serializer-common.cc Loading commit data...
serializer-common.h Loading commit data...
serializer.cc Loading commit data...
serializer.h Loading commit data...
snapshot-common.cc Loading commit data...
snapshot-empty.cc Loading commit data...
snapshot-external.cc Loading commit data...
snapshot-source-sink.cc Loading commit data...
snapshot-source-sink.h Loading commit data...
snapshot.h Loading commit data...
startup-deserializer.cc Loading commit data...
startup-deserializer.h Loading commit data...
startup-serializer.cc Loading commit data...
startup-serializer.h Loading commit data...