Ignore:
Timestamp:
Aug 27, 2021, 1:49:34 PM (4 years ago)
Author:
[email protected]
Message:

Make ARM64 and X86_64 probe code a little bit more efficient.
https://bugs.webkit.org/show_bug.cgi?id=229618
rdar://82445743

Reviewed by Yusuke Suzuki.

We were using an unnecessary indirect call to call Probe::executeProbe() when we
can be using a direct call, which emits less JIT code. This patch changes the
ARM64 and X86_64 ports to use a direct call now.

Also rename executeProbe to executeJSCJITProbe to make it more unique since we're
switching to extern "C" linkage for this function now.

For MacroAssemblerX86Common.cpp, we left the X86 and MSVC implementations unchanged.
For X86, I don't know the stack alignment requirements (if any) plus we might want
to delete this code eventually since we're not supporting the X86 JIT anymore.
For MSVC, I don't know the way to express a direct call in MSVC assembly, and have
no way to test it. Will leave that as an exercise for folks working on the Windows
ports if they are interested.

Also remove JITProbeExecutorPtrTag since it's no longer needed.

  • assembler/MacroAssemblerARM64.cpp:

(JSC::MacroAssembler::probe):

  • assembler/MacroAssemblerARMv7.cpp:

(JSC::MacroAssembler::probe):

  • assembler/MacroAssemblerMIPS.cpp:

(JSC::MacroAssembler::probe):

  • assembler/MacroAssemblerX86Common.cpp:

(JSC::ctiMasmProbeTrampoline):
(JSC::MacroAssembler::probe):

  • assembler/ProbeContext.cpp:

(JSC::Probe::executeJSCJITProbe):
(JSC::Probe::executeProbe): Deleted.

  • assembler/ProbeContext.h:
  • runtime/JSCPtrTag.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/assembler/MacroAssemblerMIPS.cpp

    r277936 r281718  
    11/*
    2  * Copyright (C) 2013-2017 Apple Inc. All rights reserved.
     2 * Copyright (C) 2013-2021 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    305305    //     a0: probe function
    306306    //     a1: probe arg
    307     //     a2: Probe::executeProbe
     307    //     a2: Probe::executeJSCJITProbe
    308308    //     s0: scratch, was ctiMasmProbeTrampoline
    309309    //     s1: scratch
     
    395395    "move      $a0, $sp" "\n" // Set the Probe::State* arg.
    396396    "addiu     $sp, $sp, -16" "\n" // Allocate stack space for (unused) 16 bytes (8-byte aligned) for 4 arguments.
    397     "move      $t9, $a2" "\n" // Probe::executeProbe()
     397    "move      $t9, $a2" "\n" // Probe::executeJSCJITProbe()
    398398    "jalr      $t9" "\n" // Call the probe handler.
    399399    "nop" "\n"
     
    509509    // either modify ra or pc, but not both in the same probe invocation. The probe
    510510    // mechanism ensures that we never try to modify both ra and pc with a RELEASE_ASSERT
    511     // in Probe::executeProbe().
     511    // in Probe::executeJSCJITProbe().
    512512
    513513    // Determine if the probe handler changed the pc.
     
    564564    move(TrustedImmPtr(reinterpret_cast<void*>(function)), a0);
    565565    move(TrustedImmPtr(arg), a1);
    566     move(TrustedImmPtr(reinterpret_cast<void*>(Probe::executeProbe)), a2);
     566    move(TrustedImmPtr(reinterpret_cast<void*>(Probe::executeJSCJITProbe)), a2);
    567567    move(TrustedImmPtr(reinterpret_cast<void*>(ctiMasmProbeTrampoline)), s0);
    568568    m_assembler.jalr(s0);
Note: See TracChangeset for help on using the changeset viewer.