Ignore:
Timestamp:
Sep 3, 2019, 6:47:02 PM (6 years ago)
Author:
[email protected]
Message:

Remove the need to pass performJITMemcpy as a pointer.
https://bugs.webkit.org/show_bug.cgi?id=201413

Reviewed by Michael Saboff.

We want performJITMemcpy to always be inlined. In this patch, we also clean up
some template parameters to use enums instead of booleans to better document the
intent of the code.

  • assembler/ARM64Assembler.h:

(JSC::ARM64Assembler::fillNops):
(JSC::ARM64Assembler::linkJump):
(JSC::ARM64Assembler::linkCall):
(JSC::ARM64Assembler::relinkJump):
(JSC::ARM64Assembler::relinkCall):
(JSC::ARM64Assembler::link):
(JSC::ARM64Assembler::linkJumpOrCall):
(JSC::ARM64Assembler::linkCompareAndBranch):
(JSC::ARM64Assembler::linkConditionalBranch):
(JSC::ARM64Assembler::linkTestAndBranch):
(JSC::ARM64Assembler::relinkJumpOrCall):
(JSC::ARM64Assembler::CopyFunction::CopyFunction): Deleted.
(JSC::ARM64Assembler::CopyFunction::operator()): Deleted.

  • assembler/ARMv7Assembler.h:

(JSC::ARMv7Assembler::fillNops):
(JSC::ARMv7Assembler::link):
(JSC::ARMv7Assembler::linkJumpT1):
(JSC::ARMv7Assembler::linkJumpT2):
(JSC::ARMv7Assembler::linkJumpT3):
(JSC::ARMv7Assembler::linkJumpT4):
(JSC::ARMv7Assembler::linkConditionalJumpT4):
(JSC::ARMv7Assembler::linkBX):
(JSC::ARMv7Assembler::linkConditionalBX):

  • assembler/AbstractMacroAssembler.h:

(JSC::AbstractMacroAssembler::emitNops):

  • assembler/LinkBuffer.cpp:

(JSC::LinkBuffer::copyCompactAndLinkCode):

  • assembler/MIPSAssembler.h:

(JSC::MIPSAssembler::fillNops):

  • assembler/MacroAssemblerARM64.h:

(JSC::MacroAssemblerARM64::link):

  • assembler/MacroAssemblerARMv7.h:

(JSC::MacroAssemblerARMv7::link):

  • assembler/X86Assembler.h:

(JSC::X86Assembler::fillNops):

  • jit/ExecutableAllocator.h:

(JSC::performJITMemcpy):

  • runtime/JSCPtrTag.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/assembler/ARMv7Assembler.h

    r247097 r249449  
    11/*
    2  * Copyright (C) 2009-2017 Apple Inc. All rights reserved.
     2 * Copyright (C) 2009-2019 Apple Inc. All rights reserved.
    33 * Copyright (C) 2010 University of Szeged
    44 *
     
    19701970    }
    19711971
    1972     template <typename CopyFunction>
    1973     static void fillNops(void* base, size_t size, CopyFunction copy)
     1972    using CopyFunction = void*(&)(void*, const void*, size_t);
     1973
     1974    template <CopyFunction copy>
     1975    static void fillNops(void* base, size_t size)
    19741976    {
    19751977        RELEASE_ASSERT(!(size % sizeof(int16_t)));
     
    21242126    }
    21252127
    2126     typedef void* (*CopyFunction)(void*, const void*, size_t);
    2127 
    2128     static void ALWAYS_INLINE link(LinkRecord& record, uint8_t* from, const uint8_t* fromInstruction8, uint8_t* to, CopyFunction copy)
     2128    template<CopyFunction copy>
     2129    static void ALWAYS_INLINE link(LinkRecord& record, uint8_t* from, const uint8_t* fromInstruction8, uint8_t* to)
    21292130    {
    21302131        const uint16_t* fromInstruction = reinterpret_cast_ptr<const uint16_t*>(fromInstruction8);
    21312132        switch (record.linkType()) {
    21322133        case LinkJumpT1:
    2133             linkJumpT1(record.condition(), reinterpret_cast_ptr<uint16_t*>(from), fromInstruction, to, copy);
     2134            linkJumpT1<copy>(record.condition(), reinterpret_cast_ptr<uint16_t*>(from), fromInstruction, to);
    21342135            break;
    21352136        case LinkJumpT2:
    2136             linkJumpT2(reinterpret_cast_ptr<uint16_t*>(from), fromInstruction, to, copy);
     2137            linkJumpT2<copy>(reinterpret_cast_ptr<uint16_t*>(from), fromInstruction, to);
    21372138            break;
    21382139        case LinkJumpT3:
    2139             linkJumpT3(record.condition(), reinterpret_cast_ptr<uint16_t*>(from), fromInstruction, to, copy);
     2140            linkJumpT3<copy>(record.condition(), reinterpret_cast_ptr<uint16_t*>(from), fromInstruction, to);
    21402141            break;
    21412142        case LinkJumpT4:
    2142             linkJumpT4(reinterpret_cast_ptr<uint16_t*>(from), fromInstruction, to, copy);
     2143            linkJumpT4<copy>(reinterpret_cast_ptr<uint16_t*>(from), fromInstruction, to);
    21432144            break;
    21442145        case LinkConditionalJumpT4:
    2145             linkConditionalJumpT4(record.condition(), reinterpret_cast_ptr<uint16_t*>(from), fromInstruction, to, copy);
     2146            linkConditionalJumpT4<copy>(record.condition(), reinterpret_cast_ptr<uint16_t*>(from), fromInstruction, to);
    21462147            break;
    21472148        case LinkConditionalBX:
    2148             linkConditionalBX(record.condition(), reinterpret_cast_ptr<uint16_t*>(from), fromInstruction, to, copy);
     2149            linkConditionalBX<copy>(record.condition(), reinterpret_cast_ptr<uint16_t*>(from), fromInstruction, to);
    21492150            break;
    21502151        case LinkBX:
    2151             linkBX(reinterpret_cast_ptr<uint16_t*>(from), fromInstruction, to, copy);
     2152            linkBX<copy>(reinterpret_cast_ptr<uint16_t*>(from), fromInstruction, to);
    21522153            break;
    21532154        default:
     
    25992600        return ((relative << 7) >> 7) == relative;
    26002601    }
    2601    
    2602     static void linkJumpT1(Condition cond, uint16_t* writeTarget, const uint16_t* instruction, void* target, CopyFunction copy = performJITMemcpy)
     2602
     2603    template<CopyFunction copy = performJITMemcpy>
     2604    static void linkJumpT1(Condition cond, uint16_t* writeTarget, const uint16_t* instruction, void* target)
    26032605    {
    26042606        // FIMXE: this should be up in the MacroAssembler layer. :-(       
     
    26182620        copy(writeTarget - 1, &newInstruction, sizeof(uint16_t));
    26192621    }
    2620    
    2621     static void linkJumpT2(uint16_t* writeTarget, const uint16_t* instruction, void* target, CopyFunction copy = performJITMemcpy)
     2622
     2623    template<CopyFunction copy = performJITMemcpy>
     2624    static void linkJumpT2(uint16_t* writeTarget, const uint16_t* instruction, void* target)
    26222625    {
    26232626        // FIMXE: this should be up in the MacroAssembler layer. :-(       
     
    26382641    }
    26392642   
    2640     static void linkJumpT3(Condition cond, uint16_t* writeTarget, const uint16_t* instruction, void* target, CopyFunction copy = performJITMemcpy)
     2643    template<CopyFunction copy = performJITMemcpy>
     2644    static void linkJumpT3(Condition cond, uint16_t* writeTarget, const uint16_t* instruction, void* target)
    26412645    {
    26422646        // FIMXE: this should be up in the MacroAssembler layer. :-(
     
    26552659    }
    26562660   
    2657     static void linkJumpT4(uint16_t* writeTarget, const uint16_t* instruction, void* target, CopyFunction copy = performJITMemcpy)
     2661    template<CopyFunction copy = performJITMemcpy>
     2662    static void linkJumpT4(uint16_t* writeTarget, const uint16_t* instruction, void* target)
    26582663    {
    26592664        // FIMXE: this should be up in the MacroAssembler layer. :-(       
     
    26742679        copy(writeTarget - 2, instructions, 2 * sizeof(uint16_t));
    26752680    }
    2676    
    2677     static void linkConditionalJumpT4(Condition cond, uint16_t* writeTarget, const uint16_t* instruction, void* target, CopyFunction copy = performJITMemcpy)
     2681
     2682    template<CopyFunction copy = performJITMemcpy>
     2683    static void linkConditionalJumpT4(Condition cond, uint16_t* writeTarget, const uint16_t* instruction, void* target)
    26782684    {
    26792685        // FIMXE: this should be up in the MacroAssembler layer. :-(       
     
    26832689        uint16_t newInstruction = ifThenElse(cond) | OP_IT;
    26842690        copy(writeTarget - 3, &newInstruction, sizeof(uint16_t));
    2685         linkJumpT4(writeTarget, instruction, target, copy);
    2686     }
    2687    
    2688     static void linkBX(uint16_t* writeTarget, const uint16_t* instruction, void* target, CopyFunction copy = performJITMemcpy)
     2691        linkJumpT4<copy>(writeTarget, instruction, target);
     2692    }
     2693
     2694    template<CopyFunction copy = performJITMemcpy>
     2695    static void linkBX(uint16_t* writeTarget, const uint16_t* instruction, void* target)
    26892696    {
    26902697        // FIMXE: this should be up in the MacroAssembler layer. :-(
     
    27052712        copy(writeTarget - 5, instructions, 5 * sizeof(uint16_t));
    27062713    }
    2707    
    2708     static void linkConditionalBX(Condition cond, uint16_t* writeTarget, const uint16_t* instruction, void* target, CopyFunction copy = performJITMemcpy)
     2714
     2715    template<CopyFunction copy = performJITMemcpy>
     2716    static void linkConditionalBX(Condition cond, uint16_t* writeTarget, const uint16_t* instruction, void* target)
    27092717    {
    27102718        // FIMXE: this should be up in the MacroAssembler layer. :-(       
Note: See TracChangeset for help on using the changeset viewer.