Changeset 236604 in webkit


Ignore:
Timestamp:
Sep 28, 2018 11:18:14 AM (6 years ago)
Author:
guijemont@igalia.com
Message:

[JSC] [Armv7] Add a copy function argument to MacroAssemblerARMv7::link() and pass it down to the assembler's linking functions.
https://bugs.webkit.org/show_bug.cgi?id=190080

Reviewed by Mark Lam.

  • assembler/ARMv7Assembler.h:

(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/MacroAssemblerARMv7.h:

(JSC::MacroAssemblerARMv7::link):

Location:
trunk/Source/JavaScriptCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r236589 r236604  
     12018-09-28  Guillaume Emont  <guijemont@igalia.com>
     2
     3        [JSC] [Armv7] Add a copy function argument to MacroAssemblerARMv7::link() and pass it down to the assembler's linking functions.
     4        https://bugs.webkit.org/show_bug.cgi?id=190080
     5
     6        Reviewed by Mark Lam.
     7
     8        * assembler/ARMv7Assembler.h:
     9        (JSC::ARMv7Assembler::link):
     10        (JSC::ARMv7Assembler::linkJumpT1):
     11        (JSC::ARMv7Assembler::linkJumpT2):
     12        (JSC::ARMv7Assembler::linkJumpT3):
     13        (JSC::ARMv7Assembler::linkJumpT4):
     14        (JSC::ARMv7Assembler::linkConditionalJumpT4):
     15        (JSC::ARMv7Assembler::linkBX):
     16        (JSC::ARMv7Assembler::linkConditionalBX):
     17        * assembler/MacroAssemblerARMv7.h:
     18        (JSC::MacroAssemblerARMv7::link):
     19
    1202018-09-27  Saam barati  <sbarati@apple.com>
    221
  • trunk/Source/JavaScriptCore/assembler/ARMv7Assembler.h

    r236589 r236604  
    22122212    }
    22132213
    2214     static void ALWAYS_INLINE link(LinkRecord& record, uint8_t* from, const uint8_t* fromInstruction8, uint8_t* to)
     2214    typedef void* (*CopyFunction)(void*, const void*, size_t);
     2215
     2216    static void ALWAYS_INLINE link(LinkRecord& record, uint8_t* from, const uint8_t* fromInstruction8, uint8_t* to, CopyFunction copy)
    22152217    {
    22162218        const uint16_t* fromInstruction = reinterpret_cast_ptr<const uint16_t*>(fromInstruction8);
    22172219        switch (record.linkType()) {
    22182220        case LinkJumpT1:
    2219             linkJumpT1(record.condition(), reinterpret_cast_ptr<uint16_t*>(from), fromInstruction, to);
     2221            linkJumpT1(record.condition(), reinterpret_cast_ptr<uint16_t*>(from), fromInstruction, to, copy);
    22202222            break;
    22212223        case LinkJumpT2:
    2222             linkJumpT2(reinterpret_cast_ptr<uint16_t*>(from), fromInstruction, to);
     2224            linkJumpT2(reinterpret_cast_ptr<uint16_t*>(from), fromInstruction, to, copy);
    22232225            break;
    22242226        case LinkJumpT3:
    2225             linkJumpT3(record.condition(), reinterpret_cast_ptr<uint16_t*>(from), fromInstruction, to);
     2227            linkJumpT3(record.condition(), reinterpret_cast_ptr<uint16_t*>(from), fromInstruction, to, copy);
    22262228            break;
    22272229        case LinkJumpT4:
    2228             linkJumpT4(reinterpret_cast_ptr<uint16_t*>(from), fromInstruction, to);
     2230            linkJumpT4(reinterpret_cast_ptr<uint16_t*>(from), fromInstruction, to, copy);
    22292231            break;
    22302232        case LinkConditionalJumpT4:
    2231             linkConditionalJumpT4(record.condition(), reinterpret_cast_ptr<uint16_t*>(from), fromInstruction, to);
     2233            linkConditionalJumpT4(record.condition(), reinterpret_cast_ptr<uint16_t*>(from), fromInstruction, to, copy);
    22322234            break;
    22332235        case LinkConditionalBX:
    2234             linkConditionalBX(record.condition(), reinterpret_cast_ptr<uint16_t*>(from), fromInstruction, to);
     2236            linkConditionalBX(record.condition(), reinterpret_cast_ptr<uint16_t*>(from), fromInstruction, to, copy);
    22352237            break;
    22362238        case LinkBX:
    2237             linkBX(reinterpret_cast_ptr<uint16_t*>(from), fromInstruction, to);
     2239            linkBX(reinterpret_cast_ptr<uint16_t*>(from), fromInstruction, to, copy);
    22382240            break;
    22392241        default:
     
    26862688    }
    26872689   
    2688     static void linkJumpT1(Condition cond, uint16_t* writeTarget, const uint16_t* instruction, void* target)
     2690    static void linkJumpT1(Condition cond, uint16_t* writeTarget, const uint16_t* instruction, void* target, CopyFunction copy = performJITMemcpy)
    26892691    {
    26902692        // FIMXE: this should be up in the MacroAssembler layer. :-(       
     
    27022704        ASSERT(!(relative & 1));
    27032705        uint16_t newInstruction = OP_B_T1 | ((cond & 0xf) << 8) | ((relative & 0x1fe) >> 1);
    2704         performJITMemcpy(writeTarget - 1, &newInstruction, sizeof(uint16_t));
    2705     }
    2706    
    2707     static void linkJumpT2(uint16_t* writeTarget, const uint16_t* instruction, void* target)
     2706        copy(writeTarget - 1, &newInstruction, sizeof(uint16_t));
     2707    }
     2708   
     2709    static void linkJumpT2(uint16_t* writeTarget, const uint16_t* instruction, void* target, CopyFunction copy = performJITMemcpy)
    27082710    {
    27092711        // FIMXE: this should be up in the MacroAssembler layer. :-(       
     
    27212723        ASSERT(!(relative & 1));
    27222724        uint16_t newInstruction = OP_B_T2 | ((relative & 0xffe) >> 1);
    2723         performJITMemcpy(writeTarget - 1, &newInstruction, sizeof(uint16_t));
    2724     }
    2725    
    2726     static void linkJumpT3(Condition cond, uint16_t* writeTarget, const uint16_t* instruction, void* target)
     2725        copy(writeTarget - 1, &newInstruction, sizeof(uint16_t));
     2726    }
     2727   
     2728    static void linkJumpT3(Condition cond, uint16_t* writeTarget, const uint16_t* instruction, void* target, CopyFunction copy = performJITMemcpy)
    27272729    {
    27282730        // FIMXE: this should be up in the MacroAssembler layer. :-(
     
    27382740        instructions[0] = OP_B_T3a | ((relative & 0x100000) >> 10) | ((cond & 0xf) << 6) | ((relative & 0x3f000) >> 12);
    27392741        instructions[1] = OP_B_T3b | ((relative & 0x80000) >> 8) | ((relative & 0x40000) >> 5) | ((relative & 0xffe) >> 1);
    2740         performJITMemcpy(writeTarget - 2, instructions, 2 * sizeof(uint16_t));
    2741     }
    2742    
    2743     static void linkJumpT4(uint16_t* writeTarget, const uint16_t* instruction, void* target)
     2742        copy(writeTarget - 2, instructions, 2 * sizeof(uint16_t));
     2743    }
     2744   
     2745    static void linkJumpT4(uint16_t* writeTarget, const uint16_t* instruction, void* target, CopyFunction copy = performJITMemcpy)
    27442746    {
    27452747        // FIMXE: this should be up in the MacroAssembler layer. :-(       
     
    27582760        instructions[0] = OP_B_T4a | ((relative & 0x1000000) >> 14) | ((relative & 0x3ff000) >> 12);
    27592761        instructions[1] = OP_B_T4b | ((relative & 0x800000) >> 10) | ((relative & 0x400000) >> 11) | ((relative & 0xffe) >> 1);
    2760         performJITMemcpy(writeTarget - 2, instructions, 2 * sizeof(uint16_t));
    2761     }
    2762    
    2763     static void linkConditionalJumpT4(Condition cond, uint16_t* writeTarget, const uint16_t* instruction, void* target)
     2762        copy(writeTarget - 2, instructions, 2 * sizeof(uint16_t));
     2763    }
     2764   
     2765    static void linkConditionalJumpT4(Condition cond, uint16_t* writeTarget, const uint16_t* instruction, void* target, CopyFunction copy = performJITMemcpy)
    27642766    {
    27652767        // FIMXE: this should be up in the MacroAssembler layer. :-(       
     
    27682770       
    27692771        uint16_t newInstruction = ifThenElse(cond) | OP_IT;
    2770         performJITMemcpy(writeTarget - 3, &newInstruction, sizeof(uint16_t));
    2771         linkJumpT4(writeTarget, instruction, target);
    2772     }
    2773    
    2774     static void linkBX(uint16_t* writeTarget, const uint16_t* instruction, void* target)
     2772        copy(writeTarget - 3, &newInstruction, sizeof(uint16_t));
     2773        linkJumpT4(writeTarget, instruction, target, copy);
     2774    }
     2775   
     2776    static void linkBX(uint16_t* writeTarget, const uint16_t* instruction, void* target, CopyFunction copy = performJITMemcpy)
    27752777    {
    27762778        // FIMXE: this should be up in the MacroAssembler layer. :-(
     
    27892791        instructions[4] = OP_BX | (JUMP_TEMPORARY_REGISTER << 3);
    27902792
    2791         performJITMemcpy(writeTarget - 5, instructions, 5 * sizeof(uint16_t));
    2792     }
    2793    
    2794     static void linkConditionalBX(Condition cond, uint16_t* writeTarget, const uint16_t* instruction, void* target)
     2793        copy(writeTarget - 5, instructions, 5 * sizeof(uint16_t));
     2794    }
     2795   
     2796    static void linkConditionalBX(Condition cond, uint16_t* writeTarget, const uint16_t* instruction, void* target, CopyFunction copy = performJITMemcpy)
    27952797    {
    27962798        // FIMXE: this should be up in the MacroAssembler layer. :-(       
     
    28002802        linkBX(writeTarget, instruction, target);
    28012803        uint16_t newInstruction = ifThenElse(cond, true, true) | OP_IT;
    2802         performJITMemcpy(writeTarget - 6, &newInstruction, sizeof(uint16_t));
     2804        copy(writeTarget - 6, &newInstruction, sizeof(uint16_t));
    28032805    }
    28042806   
  • trunk/Source/JavaScriptCore/assembler/MacroAssemblerARMv7.h

    r236589 r236604  
    7070    static JumpLinkType computeJumpType(LinkRecord& record, const uint8_t* from, const uint8_t* to) { return ARMv7Assembler::computeJumpType(record, from, to); }
    7171    static int jumpSizeDelta(JumpType jumpType, JumpLinkType jumpLinkType) { return ARMv7Assembler::jumpSizeDelta(jumpType, jumpLinkType); }
    72     static void link(LinkRecord& record, uint8_t* from, const uint8_t* fromInstruction, uint8_t* to) { return ARMv7Assembler::link(record, from, fromInstruction, to); }
     72    template <typename CopyFunction>
     73    static void link(LinkRecord& record, uint8_t* from, const uint8_t* fromInstruction, uint8_t* to, CopyFunction copy) { return ARMv7Assembler::link(record, from, fromInstruction, to, copy); }
    7374
    7475    struct ArmAddress {
Note: See TracChangeset for help on using the changeset viewer.