Changeset 237439 in webkit
- Timestamp:
- Oct 25, 2018, 5:11:33 PM (8 years ago)
- Location:
- branches/safari-606-branch
- Files:
-
- 14 edited
-
JSTests/ChangeLog (modified) (1 diff)
-
Source/JavaScriptCore/ChangeLog (modified) (1 diff)
-
Source/JavaScriptCore/assembler/ARM64Assembler.h (modified) (13 diffs)
-
Source/JavaScriptCore/assembler/ARMAssembler.h (modified) (1 diff)
-
Source/JavaScriptCore/assembler/ARMv7Assembler.h (modified) (4 diffs)
-
Source/JavaScriptCore/assembler/AbstractMacroAssembler.h (modified) (4 diffs)
-
Source/JavaScriptCore/assembler/AssemblerBuffer.h (modified) (10 diffs)
-
Source/JavaScriptCore/assembler/LinkBuffer.cpp (modified) (3 diffs)
-
Source/JavaScriptCore/assembler/MIPSAssembler.h (modified) (1 diff)
-
Source/JavaScriptCore/assembler/MacroAssemblerARM64.h (modified) (1 diff)
-
Source/JavaScriptCore/assembler/MacroAssemblerARMv7.h (modified) (1 diff)
-
Source/JavaScriptCore/assembler/X86Assembler.h (modified) (1 diff)
-
Source/WTF/ChangeLog (modified) (1 diff)
-
Source/WTF/wtf/PtrTag.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-606-branch/JSTests/ChangeLog
r237373 r237439 1 2018-10-25 Kocsen Chung <kocsen_chung@apple.com> 2 3 Revert r237373. rdar://problem/45285669 4 1 5 2018-10-23 Kocsen Chung <kocsen_chung@apple.com> 2 6 -
branches/safari-606-branch/Source/JavaScriptCore/ChangeLog
r237438 r237439 1 2018-10-25 Kocsen Chung <kocsen_chung@apple.com> 2 3 Revert r237373. rdar://problem/45285669 4 1 5 2018-10-25 Kocsen Chung <kocsen_chung@apple.com> 2 6 -
branches/safari-606-branch/Source/JavaScriptCore/assembler/ARM64Assembler.h
r237373 r237439 319 319 320 320 public: 321 ARM64Assembler( 322 #if CPU(ARM64E) 323 unsigned randomNumber 324 #endif 325 ) 321 ARM64Assembler() 326 322 : m_indexOfLastWatchpoint(INT_MIN) 327 323 , m_indexOfTailOfLastWatchpoint(INT_MIN) 328 #if CPU(ARM64E)329 , m_buffer(randomNumber)330 #endif331 332 324 { 333 325 } … … 1563 1555 } 1564 1556 1565 template <typename CopyFunction> 1566 static void fillNops(void* base, size_t size, CopyFunction copy) 1557 static void fillNops(void* base, size_t size, bool isCopyingToExecutableMemory) 1567 1558 { 1568 1559 RELEASE_ASSERT(!(size % sizeof(int32_t))); … … 1570 1561 for (int32_t* ptr = static_cast<int32_t*>(base); n--;) { 1571 1562 int insn = nopPseudo(); 1572 copy(ptr++, &insn, sizeof(int)); 1563 if (isCopyingToExecutableMemory) 1564 performJITMemcpy(ptr++, &insn, sizeof(int)); 1565 else 1566 memcpy(ptr++, &insn, sizeof(int)); 1573 1567 } 1574 1568 } … … 2575 2569 } 2576 2570 2571 void* unlinkedCode() { return m_buffer.data(); } 2577 2572 size_t codeSize() const { return m_buffer.codeSize(); } 2578 2573 … … 2612 2607 } 2613 2608 2609 void linkJump(AssemblerLabel from, void* executableCode, AssemblerLabel to) 2610 { 2611 ASSERT(from.isSet()); 2612 ASSERT(to.isSet()); 2613 relinkJumpOrCall<false>(addressOf(from), addressOf(executableCode, from), addressOf(to)); 2614 } 2615 2614 2616 static void linkJump(void* code, AssemblerLabel from, void* to) 2615 2617 { … … 2964 2966 } 2965 2967 2966 typedef void* (*CopyFunction)(void*, const void*, size_t); 2967 2968 static void ALWAYS_INLINE link(LinkRecord& record, uint8_t* from, const uint8_t* fromInstruction8, uint8_t* to, CopyFunction copy) 2968 static void ALWAYS_INLINE link(LinkRecord& record, uint8_t* from, const uint8_t* fromInstruction8, uint8_t* to) 2969 2969 { 2970 2970 const int* fromInstruction = reinterpret_cast<const int*>(fromInstruction8); 2971 2971 switch (record.linkType()) { 2972 2972 case LinkJumpNoCondition: 2973 linkJumpOrCall<false>(reinterpret_cast<int*>(from), fromInstruction, to , copy);2973 linkJumpOrCall<false>(reinterpret_cast<int*>(from), fromInstruction, to); 2974 2974 break; 2975 2975 case LinkJumpConditionDirect: 2976 linkConditionalBranch<true>(record.condition(), reinterpret_cast<int*>(from), fromInstruction, to , copy);2976 linkConditionalBranch<true>(record.condition(), reinterpret_cast<int*>(from), fromInstruction, to); 2977 2977 break; 2978 2978 case LinkJumpCondition: 2979 linkConditionalBranch<false>(record.condition(), reinterpret_cast<int*>(from) - 1, fromInstruction - 1, to , copy);2979 linkConditionalBranch<false>(record.condition(), reinterpret_cast<int*>(from) - 1, fromInstruction - 1, to); 2980 2980 break; 2981 2981 case LinkJumpCompareAndBranchDirect: 2982 linkCompareAndBranch<true>(record.condition(), record.is64Bit(), record.compareRegister(), reinterpret_cast<int*>(from), fromInstruction, to , copy);2982 linkCompareAndBranch<true>(record.condition(), record.is64Bit(), record.compareRegister(), reinterpret_cast<int*>(from), fromInstruction, to); 2983 2983 break; 2984 2984 case LinkJumpCompareAndBranch: 2985 linkCompareAndBranch<false>(record.condition(), record.is64Bit(), record.compareRegister(), reinterpret_cast<int*>(from) - 1, fromInstruction - 1, to , copy);2985 linkCompareAndBranch<false>(record.condition(), record.is64Bit(), record.compareRegister(), reinterpret_cast<int*>(from) - 1, fromInstruction - 1, to); 2986 2986 break; 2987 2987 case LinkJumpTestBitDirect: 2988 linkTestAndBranch<true>(record.condition(), record.bitNumber(), record.compareRegister(), reinterpret_cast<int*>(from), fromInstruction, to , copy);2988 linkTestAndBranch<true>(record.condition(), record.bitNumber(), record.compareRegister(), reinterpret_cast<int*>(from), fromInstruction, to); 2989 2989 break; 2990 2990 case LinkJumpTestBit: 2991 linkTestAndBranch<false>(record.condition(), record.bitNumber(), record.compareRegister(), reinterpret_cast<int*>(from) - 1, fromInstruction - 1, to , copy);2991 linkTestAndBranch<false>(record.condition(), record.bitNumber(), record.compareRegister(), reinterpret_cast<int*>(from) - 1, fromInstruction - 1, to); 2992 2992 break; 2993 2993 default: … … 3031 3031 3032 3032 template<bool isCall> 3033 static void linkJumpOrCall(int* from, const int* fromInstruction, void* to , CopyFunction copy = performJITMemcpy)3033 static void linkJumpOrCall(int* from, const int* fromInstruction, void* to) 3034 3034 { 3035 3035 bool link; … … 3047 3047 3048 3048 int insn = unconditionalBranchImmediate(isCall, static_cast<int>(offset)); 3049 copy(from, &insn, sizeof(int));3049 performJITMemcpy(from, &insn, sizeof(int)); 3050 3050 } 3051 3051 3052 3052 template<bool isDirect> 3053 static void linkCompareAndBranch(Condition condition, bool is64Bit, RegisterID rt, int* from, const int* fromInstruction, void* to , CopyFunction copy = performJITMemcpy)3053 static void linkCompareAndBranch(Condition condition, bool is64Bit, RegisterID rt, int* from, const int* fromInstruction, void* to) 3054 3054 { 3055 3055 ASSERT(!(reinterpret_cast<intptr_t>(from) & 3)); … … 3063 3063 if (useDirect || isDirect) { 3064 3064 int insn = compareAndBranchImmediate(is64Bit ? Datasize_64 : Datasize_32, condition == ConditionNE, static_cast<int>(offset), rt); 3065 copy(from, &insn, sizeof(int));3065 performJITMemcpy(from, &insn, sizeof(int)); 3066 3066 if (!isDirect) { 3067 3067 insn = nopPseudo(); 3068 copy(from + 1, &insn, sizeof(int));3068 performJITMemcpy(from + 1, &insn, sizeof(int)); 3069 3069 } 3070 3070 } else { 3071 3071 int insn = compareAndBranchImmediate(is64Bit ? Datasize_64 : Datasize_32, invert(condition) == ConditionNE, 2, rt); 3072 copy(from, &insn, sizeof(int));3073 linkJumpOrCall<false>(from + 1, fromInstruction + 1, to , copy);3072 performJITMemcpy(from, &insn, sizeof(int)); 3073 linkJumpOrCall<false>(from + 1, fromInstruction + 1, to); 3074 3074 } 3075 3075 } 3076 3076 3077 3077 template<bool isDirect> 3078 static void linkConditionalBranch(Condition condition, int* from, const int* fromInstruction, void* to , CopyFunction copy = performJITMemcpy)3078 static void linkConditionalBranch(Condition condition, int* from, const int* fromInstruction, void* to) 3079 3079 { 3080 3080 ASSERT(!(reinterpret_cast<intptr_t>(from) & 3)); … … 3088 3088 if (useDirect || isDirect) { 3089 3089 int insn = conditionalBranchImmediate(static_cast<int>(offset), condition); 3090 copy(from, &insn, sizeof(int));3090 performJITMemcpy(from, &insn, sizeof(int)); 3091 3091 if (!isDirect) { 3092 3092 insn = nopPseudo(); 3093 copy(from + 1, &insn, sizeof(int));3093 performJITMemcpy(from + 1, &insn, sizeof(int)); 3094 3094 } 3095 3095 } else { 3096 3096 int insn = conditionalBranchImmediate(2, invert(condition)); 3097 copy(from, &insn, sizeof(int));3098 linkJumpOrCall<false>(from + 1, fromInstruction + 1, to , copy);3097 performJITMemcpy(from, &insn, sizeof(int)); 3098 linkJumpOrCall<false>(from + 1, fromInstruction + 1, to); 3099 3099 } 3100 3100 } 3101 3101 3102 3102 template<bool isDirect> 3103 static void linkTestAndBranch(Condition condition, unsigned bitNumber, RegisterID rt, int* from, const int* fromInstruction, void* to , CopyFunction copy = performJITMemcpy)3103 static void linkTestAndBranch(Condition condition, unsigned bitNumber, RegisterID rt, int* from, const int* fromInstruction, void* to) 3104 3104 { 3105 3105 ASSERT(!(reinterpret_cast<intptr_t>(from) & 3)); … … 3114 3114 if (useDirect || isDirect) { 3115 3115 int insn = testAndBranchImmediate(condition == ConditionNE, static_cast<int>(bitNumber), static_cast<int>(offset), rt); 3116 copy(from, &insn, sizeof(int));3116 performJITMemcpy(from, &insn, sizeof(int)); 3117 3117 if (!isDirect) { 3118 3118 insn = nopPseudo(); 3119 copy(from + 1, &insn, sizeof(int));3119 performJITMemcpy(from + 1, &insn, sizeof(int)); 3120 3120 } 3121 3121 } else { 3122 3122 int insn = testAndBranchImmediate(invert(condition) == ConditionNE, static_cast<int>(bitNumber), 2, rt); 3123 copy(from, &insn, sizeof(int));3124 linkJumpOrCall<false>(from + 1, fromInstruction + 1, to , copy);3123 performJITMemcpy(from, &insn, sizeof(int)); 3124 linkJumpOrCall<false>(from + 1, fromInstruction + 1, to); 3125 3125 } 3126 3126 } … … 3178 3178 { 3179 3179 return reinterpret_cast<int*>(static_cast<char*>(code) + label.m_offset); 3180 } 3181 3182 int* addressOf(AssemblerLabel label) 3183 { 3184 return addressOf(m_buffer.data(), label); 3180 3185 } 3181 3186 … … 3755 3760 } 3756 3761 3762 AssemblerBuffer m_buffer; 3757 3763 Vector<LinkRecord, 0, UnsafeVectorOverflow> m_jumpsToLink; 3758 3764 int m_indexOfLastWatchpoint; 3759 3765 int m_indexOfTailOfLastWatchpoint; 3760 AssemblerBuffer m_buffer;3761 3766 3762 3767 public: -
branches/safari-606-branch/Source/JavaScriptCore/assembler/ARMAssembler.h
r237373 r237439 751 751 } 752 752 753 template <typename CopyFunction> 754 static void fillNops(void* base, size_t size, CopyFunction copy) 755 { 756 UNUSED_PARAM(copy); 753 static void fillNops(void* base, size_t size, bool isCopyingToExecutableMemory) 754 { 755 UNUSED_PARAM(isCopyingToExecutableMemory); 757 756 RELEASE_ASSERT(!(size % sizeof(int32_t))); 758 757 -
branches/safari-606-branch/Source/JavaScriptCore/assembler/ARMv7Assembler.h
r237438 r237439 2056 2056 } 2057 2057 2058 template <typename CopyFunction> 2059 static void fillNops(void* base, size_t size, CopyFunction copy) 2058 static void fillNops(void* base, size_t size, bool isCopyingToExecutableMemory) 2060 2059 { 2061 2060 RELEASE_ASSERT(!(size % sizeof(int16_t))); … … 2065 2064 for (size_t i = 0; i < num32s; i++) { 2066 2065 const int32_t insn = nopPseudo32(); 2067 copy(ptr, &insn, sizeof(int32_t)); 2066 if (isCopyingToExecutableMemory) 2067 performJITMemcpy(ptr, &insn, sizeof(int32_t)); 2068 else 2069 memcpy(ptr, &insn, sizeof(int32_t)); 2068 2070 ptr += sizeof(int32_t); 2069 2071 } … … 2074 2076 if (num16s) { 2075 2077 const int16_t insn = nopPseudo16(); 2076 copy(ptr, &insn, sizeof(int16_t)); 2078 if (isCopyingToExecutableMemory) 2079 performJITMemcpy(ptr, &insn, sizeof(int16_t)); 2080 else 2081 memcpy(ptr, &insn, sizeof(int16_t)); 2077 2082 } 2078 2083 } … … 2241 2246 } 2242 2247 2248 void* unlinkedCode() { return m_formatter.data(); } 2243 2249 size_t codeSize() const { return m_formatter.codeSize(); } 2244 2250 -
branches/safari-606-branch/Source/JavaScriptCore/assembler/AbstractMacroAssembler.h
r237373 r237439 863 863 } 864 864 865 AssemblerType m_assembler; 866 865 867 template<PtrTag tag> 866 868 static void linkJump(void* code, Jump jump, CodeLocationLabel<tag> target) … … 961 963 void emitNops(size_t memoryToFillWithNopsInBytes) 962 964 { 963 #if CPU(ARM64)964 RELEASE_ASSERT(memoryToFillWithNopsInBytes % 4 == 0);965 for (unsigned i = 0; i < memoryToFillWithNopsInBytes / 4; ++i)966 m_assembler.nop();967 #else968 965 AssemblerBuffer& buffer = m_assembler.buffer(); 969 966 size_t startCodeSize = buffer.codeSize(); 970 967 size_t targetCodeSize = startCodeSize + memoryToFillWithNopsInBytes; 971 968 buffer.ensureSpace(memoryToFillWithNopsInBytes); 972 AssemblerType::fillNops(static_cast<char*>(buffer.data()) + startCodeSize, memoryToFillWithNopsInBytes, memcpy); 969 bool isCopyingToExecutableMemory = false; 970 AssemblerType::fillNops(static_cast<char*>(buffer.data()) + startCodeSize, memoryToFillWithNopsInBytes, isCopyingToExecutableMemory); 973 971 buffer.setCodeSize(targetCodeSize); 974 #endif975 972 } 976 973 … … 987 984 AbstractMacroAssembler() 988 985 : m_randomSource(0) 989 #if CPU(ARM64E)990 , m_assembler(random())991 #else992 , m_assembler()993 #endif994 986 { 995 987 invalidateAllTempRegisters(); … … 1007 999 bool m_randomSourceIsInitialized { false }; 1008 1000 WeakRandom m_randomSource; 1009 public:1010 AssemblerType m_assembler;1011 protected:1012 1001 1013 1002 #if ENABLE(DFG_REGISTER_ALLOCATION_VALIDATION) -
branches/safari-606-branch/Source/JavaScriptCore/assembler/AssemblerBuffer.h
r237373 r237439 34 34 #include <wtf/Assertions.h> 35 35 #include <wtf/FastMalloc.h> 36 #if CPU(ARM64E)37 #include <wtf/PtrTag.h>38 #endif39 36 #include <wtf/StdLibExtras.h> 40 37 41 38 namespace JSC { 42 43 class LinkBuffer;44 39 45 40 struct AssemblerLabel { … … 146 141 }; 147 142 148 #if CPU(ARM64E)149 class ARM64EHash {150 public:151 ARM64EHash(unsigned randomNumber)152 : m_hash(randomNumber)153 , m_randomSeed(randomNumber)154 { }155 ALWAYS_INLINE void update(unsigned value, uintptr_t index)156 {157 m_hash = tagInt((static_cast<uintptr_t>(value) + m_hash) ^ (m_hash >> 32), static_cast<PtrTag>(index));158 }159 uintptr_t hash() const { return m_hash; }160 unsigned randomSeed() const { return m_randomSeed; }161 private:162 uintptr_t m_hash;163 unsigned m_randomSeed;164 };165 #endif166 167 143 class AssemblerBuffer { 168 144 public: 169 AssemblerBuffer( 170 #if CPU(ARM64E) 171 unsigned randomNumber 172 #endif 173 ) 145 AssemblerBuffer() 174 146 : m_storage() 175 147 , m_index(0) 176 #if CPU(ARM64E)177 , m_hash(randomNumber)178 #endif179 148 { 180 149 } … … 196 165 } 197 166 198 #if !CPU(ARM64)199 167 void putByteUnchecked(int8_t value) { putIntegralUnchecked(value); } 200 168 void putByte(int8_t value) { putIntegral(value); } 201 169 void putShortUnchecked(int16_t value) { putIntegralUnchecked(value); } 202 170 void putShort(int16_t value) { putIntegral(value); } 171 void putIntUnchecked(int32_t value) { putIntegralUnchecked(value); } 172 void putInt(int32_t value) { putIntegral(value); } 203 173 void putInt64Unchecked(int64_t value) { putIntegralUnchecked(value); } 204 174 void putInt64(int64_t value) { putIntegral(value); } 205 #endif 206 void putIntUnchecked(int32_t value) { putIntegralUnchecked(value); } 207 void putInt(int32_t value) { putIntegral(value); } 175 176 void* data() const 177 { 178 return m_storage.buffer(); 179 } 208 180 209 181 size_t codeSize() const … … 212 184 } 213 185 214 #if !CPU(ARM64)215 186 void setCodeSize(size_t index) 216 187 { … … 221 192 ASSERT(m_index <= m_storage.capacity()); 222 193 } 223 #endif224 194 225 195 AssemblerLabel label() const … … 239 209 // LocalWriter *CANNOT* be mixed with other types of access to AssemblerBuffer. 240 210 // AssemblerBuffer cannot be used until its LocalWriter goes out of scope. 241 #if !CPU(ARM64) // If we ever need to use this on arm64e, we would need to make the checksum aware of this.242 211 class LocalWriter { 243 212 public: … … 282 251 #endif 283 252 }; 284 #endif // !CPU(ARM64)285 286 #if CPU(ARM64E)287 ARM64EHash hash() const { return m_hash; }288 #endif289 290 #if !CPU(ARM64) // If we were to define this on arm64e, we'd need a way to update the hash as we write directly into the buffer.291 void* data() const { return m_storage.buffer(); }292 #endif293 294 253 295 254 protected: … … 308 267 void putIntegralUnchecked(IntegralType value) 309 268 { 310 #if CPU(ARM64)311 static_assert(sizeof(value) == 4, "");312 #if CPU(ARM64E)313 m_hash.update(value, m_index);314 #endif315 #endif316 269 ASSERT(isAvailable(sizeof(IntegralType))); 317 270 *reinterpret_cast_ptr<IntegralType*>(m_storage.buffer() + m_index) = value; … … 319 272 } 320 273 274 void append(const char* data, int size) 275 { 276 if (!isAvailable(size)) 277 grow(size); 278 279 memcpy(m_storage.buffer() + m_index, data, size); 280 m_index += size; 281 } 282 283 void grow(int extraCapacity = 0) 284 { 285 m_storage.grow(extraCapacity); 286 } 287 321 288 private: 322 void grow(int extraCapacity = 0)323 {324 m_storage.grow(extraCapacity);325 }326 327 289 NEVER_INLINE void outOfLineGrow() 328 290 { … … 330 292 } 331 293 332 #if !CPU(ARM64)333 294 friend LocalWriter; 334 #endif335 friend LinkBuffer;336 295 337 296 AssemblerData m_storage; 338 297 unsigned m_index; 339 #if CPU(ARM64E)340 ARM64EHash m_hash;341 #endif342 298 }; 343 299 -
branches/safari-606-branch/Source/JavaScriptCore/assembler/LinkBuffer.cpp
r237437 r237439 110 110 uint8_t* inData = reinterpret_cast<uint8_t*>(m_assemblerStorage.buffer()); 111 111 112 AssemblerData outBuffer(m_size); 113 114 uint8_t* outData = reinterpret_cast<uint8_t*>(outBuffer.buffer()); 112 115 uint8_t* codeOutData = m_code.dataLocation<uint8_t*>(); 113 #if CPU(ARM64E)114 const ARM64EHash assemblerBufferHash = macroAssembler.m_assembler.buffer().hash();115 ARM64EHash verifyUncompactedHash(assemblerBufferHash.randomSeed());116 uint8_t* outData = codeOutData;117 #else118 AssemblerData outBuffer(m_size);119 uint8_t* outData = reinterpret_cast<uint8_t*>(outBuffer.buffer());120 #endif121 116 122 117 int readPtr = 0; 123 118 int writePtr = 0; 124 119 unsigned jumpCount = jumpsToLink.size(); 125 126 #if CPU(ARM64E)127 os_thread_self_restrict_rwx_to_rw();128 #endif129 130 120 if (m_shouldPerformBranchCompaction) { 131 121 for (unsigned i = 0; i < jumpCount; ++i) { … … 141 131 ASSERT(!(readPtr % 2)); 142 132 ASSERT(!(writePtr % 2)); 143 #if CPU(ARM64E) 144 unsigned index = readPtr; 145 #endif 146 while (copySource != copyEnd) { 147 InstructionType insn = *copySource++; 148 #if CPU(ARM64E) 149 static_assert(sizeof(InstructionType) == 4, ""); 150 verifyUncompactedHash.update(insn, index); 151 index += sizeof(InstructionType); 152 #endif 153 *copyDst++ = insn; 154 } 133 while (copySource != copyEnd) 134 *copyDst++ = *copySource++; 155 135 recordLinkOffsets(m_assemblerStorage, readPtr, jumpsToLink[i].from(), offset); 156 136 readPtr += regionSize; … … 183 163 } 184 164 } 185 186 165 // Copy everything after the last jump 187 { 188 InstructionType* dst = bitwise_cast<InstructionType*>(outData + writePtr); 189 InstructionType* src = bitwise_cast<InstructionType*>(inData + readPtr); 190 size_t bytes = initialSize - readPtr; 191 192 RELEASE_ASSERT(bitwise_cast<uintptr_t>(dst) % sizeof(InstructionType) == 0); 193 RELEASE_ASSERT(bitwise_cast<uintptr_t>(src) % sizeof(InstructionType) == 0); 194 RELEASE_ASSERT(bytes % sizeof(InstructionType) == 0); 195 196 #if CPU(ARM64E) 197 unsigned index = readPtr; 198 #endif 199 200 for (size_t i = 0; i < bytes; i += sizeof(InstructionType)) { 201 InstructionType insn = *src++; 202 #if CPU(ARM64E) 203 verifyUncompactedHash.update(insn, index); 204 index += sizeof(InstructionType); 205 #endif 206 *dst++ = insn; 207 } 208 } 209 210 #if CPU(ARM64E) 211 if (verifyUncompactedHash.hash() != assemblerBufferHash.hash()) { 212 dataLogLn("Hashes don't match: ", RawPointer(bitwise_cast<void*>(verifyUncompactedHash.hash())), " ", RawPointer(bitwise_cast<void*>(assemblerBufferHash.hash()))); 213 dataLogLn("Crashing!"); 214 CRASH(); 215 } 216 #endif 217 166 memcpy(outData + writePtr, inData + readPtr, initialSize - readPtr); 218 167 recordLinkOffsets(m_assemblerStorage, readPtr, initialSize, readPtr - writePtr); 219 168 220 169 for (unsigned i = 0; i < jumpCount; ++i) { 221 #if CPU(ARM64E)222 auto memcpyFunction = memcpy;223 #else224 auto memcpyFunction = performJITMemcpy;225 #endif226 227 170 uint8_t* location = codeOutData + jumpsToLink[i].from(); 228 171 uint8_t* target = codeOutData + jumpsToLink[i].to() - executableOffsetFor(jumpsToLink[i].to()); 229 MacroAssembler::link(jumpsToLink[i], outData + jumpsToLink[i].from(), location, target, memcpyFunction); 230 } 172 MacroAssembler::link(jumpsToLink[i], outData + jumpsToLink[i].from(), location, target); 173 } 174 175 jumpsToLink.clear(); 231 176 232 177 size_t compactSize = writePtr + initialSize - readPtr; 233 if (!m_executableMemory) {234 size_t nopSizeInBytes = initialSize - compactSize;235 MacroAssembler::AssemblerType_T::fillNops(outData + compactSize, nopSizeInBytes, memcpy);236 }237 238 #if CPU(ARM64E)239 os_thread_self_restrict_rwx_to_rx();240 #endif241 242 178 if (m_executableMemory) { 243 179 m_size = compactSize; 244 180 m_executableMemory->shrink(m_size); 245 } 246 247 #if !CPU(ARM64E) 248 ASSERT(codeOutData != outData); 181 } else { 182 size_t nopSizeInBytes = initialSize - compactSize; 183 bool isCopyingToExecutableMemory = false; 184 MacroAssembler::AssemblerType_T::fillNops(outData + compactSize, nopSizeInBytes, isCopyingToExecutableMemory); 185 } 186 249 187 performJITMemcpy(codeOutData, outData, m_size); 250 #else251 ASSERT(codeOutData == outData);252 #endif253 254 jumpsToLink.clear();255 188 256 189 #if DUMP_LINK_STATISTICS -
branches/safari-606-branch/Source/JavaScriptCore/assembler/MIPSAssembler.h
r237373 r237439 265 265 } 266 266 267 template <typename CopyFunction> 268 static void fillNops(void* base, size_t size, CopyFunction copy) 269 { 270 UNUSED_PARAM(copy); 267 static void fillNops(void* base, size_t size, bool isCopyingToExecutableMemory) 268 { 269 UNUSED_PARAM(isCopyingToExecutableMemory); 271 270 RELEASE_ASSERT(!(size % sizeof(int32_t))); 272 271 -
branches/safari-606-branch/Source/JavaScriptCore/assembler/MacroAssemblerARM64.h
r237373 r237439 80 80 81 81 Vector<LinkRecord, 0, UnsafeVectorOverflow>& jumpsToLink() { return m_assembler.jumpsToLink(); } 82 void* unlinkedCode() { return m_assembler.unlinkedCode(); } 82 83 static bool canCompact(JumpType jumpType) { return Assembler::canCompact(jumpType); } 83 84 static JumpLinkType computeJumpType(JumpType jumpType, const uint8_t* from, const uint8_t* to) { return Assembler::computeJumpType(jumpType, from, to); } 84 85 static JumpLinkType computeJumpType(LinkRecord& record, const uint8_t* from, const uint8_t* to) { return Assembler::computeJumpType(record, from, to); } 85 86 static int jumpSizeDelta(JumpType jumpType, JumpLinkType jumpLinkType) { return Assembler::jumpSizeDelta(jumpType, jumpLinkType); } 86 template <typename CopyFunction> 87 static void link(LinkRecord& record, uint8_t* from, const uint8_t* fromInstruction, uint8_t* to, CopyFunction copy) { return Assembler::link(record, from, fromInstruction, to, copy); } 87 static void link(LinkRecord& record, uint8_t* from, const uint8_t* fromInstruction, uint8_t* to) { return Assembler::link(record, from, fromInstruction, to); } 88 88 89 89 static const Scale ScalePtr = TimesEight; -
branches/safari-606-branch/Source/JavaScriptCore/assembler/MacroAssemblerARMv7.h
r237438 r237439 66 66 67 67 Vector<LinkRecord, 0, UnsafeVectorOverflow>& jumpsToLink() { return m_assembler.jumpsToLink(); } 68 void* unlinkedCode() { return m_assembler.unlinkedCode(); } 68 69 static bool canCompact(JumpType jumpType) { return ARMv7Assembler::canCompact(jumpType); } 69 70 static JumpLinkType computeJumpType(JumpType jumpType, const uint8_t* from, const uint8_t* to) { return ARMv7Assembler::computeJumpType(jumpType, from, to); } -
branches/safari-606-branch/Source/JavaScriptCore/assembler/X86Assembler.h
r237373 r237439 3903 3903 } 3904 3904 3905 template <typename CopyFunction> 3906 static void fillNops(void* base, size_t size, CopyFunction copy) 3907 { 3908 UNUSED_PARAM(copy); 3905 static void fillNops(void* base, size_t size, bool isCopyingToExecutableMemory) 3906 { 3907 UNUSED_PARAM(isCopyingToExecutableMemory); 3909 3908 #if CPU(X86_64) 3910 3909 static const uint8_t nops[10][10] = { -
branches/safari-606-branch/Source/WTF/ChangeLog
r237373 r237439 1 2018-10-25 Kocsen Chung <kocsen_chung@apple.com> 2 3 Revert r237373. rdar://problem/45285669 4 1 5 2018-10-23 Kocsen Chung <kocsen_chung@apple.com> 2 6 -
branches/safari-606-branch/Source/WTF/wtf/PtrTag.h
r237373 r237439 148 148 inline PtrType untagCFunctionPtr(PtrType ptr) { return ptr; } 149 149 150 template <typename IntType>151 inline IntType tagInt(IntType ptrInt, PtrTag)152 {153 static_assert(sizeof(IntType) == sizeof(uintptr_t), "");154 return ptrInt;155 }156 157 150 template<typename PtrType> void assertIsCFunctionPtr(PtrType) { } 158 151 template<typename PtrType> void assertIsNullOrCFunctionPtr(PtrType) { } … … 192 185 using WTF::tagCFunctionPtr; 193 186 using WTF::untagCFunctionPtr; 194 using WTF::tagInt;195 187 196 188 using WTF::assertIsCFunctionPtr;
Note:
See TracChangeset
for help on using the changeset viewer.