Changeset 236604 in webkit
- Timestamp:
- Sep 28, 2018 11:18:14 AM (6 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r236589 r236604 1 2018-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 1 20 2018-09-27 Saam barati <sbarati@apple.com> 2 21 -
trunk/Source/JavaScriptCore/assembler/ARMv7Assembler.h
r236589 r236604 2212 2212 } 2213 2213 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) 2215 2217 { 2216 2218 const uint16_t* fromInstruction = reinterpret_cast_ptr<const uint16_t*>(fromInstruction8); 2217 2219 switch (record.linkType()) { 2218 2220 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); 2220 2222 break; 2221 2223 case LinkJumpT2: 2222 linkJumpT2(reinterpret_cast_ptr<uint16_t*>(from), fromInstruction, to );2224 linkJumpT2(reinterpret_cast_ptr<uint16_t*>(from), fromInstruction, to, copy); 2223 2225 break; 2224 2226 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); 2226 2228 break; 2227 2229 case LinkJumpT4: 2228 linkJumpT4(reinterpret_cast_ptr<uint16_t*>(from), fromInstruction, to );2230 linkJumpT4(reinterpret_cast_ptr<uint16_t*>(from), fromInstruction, to, copy); 2229 2231 break; 2230 2232 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); 2232 2234 break; 2233 2235 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); 2235 2237 break; 2236 2238 case LinkBX: 2237 linkBX(reinterpret_cast_ptr<uint16_t*>(from), fromInstruction, to );2239 linkBX(reinterpret_cast_ptr<uint16_t*>(from), fromInstruction, to, copy); 2238 2240 break; 2239 2241 default: … … 2686 2688 } 2687 2689 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) 2689 2691 { 2690 2692 // FIMXE: this should be up in the MacroAssembler layer. :-( … … 2702 2704 ASSERT(!(relative & 1)); 2703 2705 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) 2708 2710 { 2709 2711 // FIMXE: this should be up in the MacroAssembler layer. :-( … … 2721 2723 ASSERT(!(relative & 1)); 2722 2724 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) 2727 2729 { 2728 2730 // FIMXE: this should be up in the MacroAssembler layer. :-( … … 2738 2740 instructions[0] = OP_B_T3a | ((relative & 0x100000) >> 10) | ((cond & 0xf) << 6) | ((relative & 0x3f000) >> 12); 2739 2741 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) 2744 2746 { 2745 2747 // FIMXE: this should be up in the MacroAssembler layer. :-( … … 2758 2760 instructions[0] = OP_B_T4a | ((relative & 0x1000000) >> 14) | ((relative & 0x3ff000) >> 12); 2759 2761 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) 2764 2766 { 2765 2767 // FIMXE: this should be up in the MacroAssembler layer. :-( … … 2768 2770 2769 2771 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) 2775 2777 { 2776 2778 // FIMXE: this should be up in the MacroAssembler layer. :-( … … 2789 2791 instructions[4] = OP_BX | (JUMP_TEMPORARY_REGISTER << 3); 2790 2792 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) 2795 2797 { 2796 2798 // FIMXE: this should be up in the MacroAssembler layer. :-( … … 2800 2802 linkBX(writeTarget, instruction, target); 2801 2803 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)); 2803 2805 } 2804 2806 -
trunk/Source/JavaScriptCore/assembler/MacroAssemblerARMv7.h
r236589 r236604 70 70 static JumpLinkType computeJumpType(LinkRecord& record, const uint8_t* from, const uint8_t* to) { return ARMv7Assembler::computeJumpType(record, from, to); } 71 71 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); } 73 74 74 75 struct ArmAddress {
Note: See TracChangeset
for help on using the changeset viewer.