| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/3rdparty/masm/assembler/AbstractMacroAssembler.h |
| Source code | Switch to Preprocessed file |
| Line | Source | Count | ||||||
|---|---|---|---|---|---|---|---|---|
| 1 | /* | - | ||||||
| 2 | * Copyright (C) 2008, 2012 Apple Inc. All rights reserved. | - | ||||||
| 3 | * | - | ||||||
| 4 | * Redistribution and use in source and binary forms, with or without | - | ||||||
| 5 | * modification, are permitted provided that the following conditions | - | ||||||
| 6 | * are met: | - | ||||||
| 7 | * 1. Redistributions of source code must retain the above copyright | - | ||||||
| 8 | * notice, this list of conditions and the following disclaimer. | - | ||||||
| 9 | * 2. Redistributions in binary form must reproduce the above copyright | - | ||||||
| 10 | * notice, this list of conditions and the following disclaimer in the | - | ||||||
| 11 | * documentation and/or other materials provided with the distribution. | - | ||||||
| 12 | * | - | ||||||
| 13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY | - | ||||||
| 14 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | - | ||||||
| 15 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | - | ||||||
| 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR | - | ||||||
| 17 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | - | ||||||
| 18 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | - | ||||||
| 19 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | - | ||||||
| 20 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | - | ||||||
| 21 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | - | ||||||
| 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | - | ||||||
| 23 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | - | ||||||
| 24 | */ | - | ||||||
| 25 | - | |||||||
| 26 | #ifndef AbstractMacroAssembler_h | - | ||||||
| 27 | #define AbstractMacroAssembler_h | - | ||||||
| 28 | - | |||||||
| 29 | #include "AssemblerBuffer.h" | - | ||||||
| 30 | #include "CodeLocation.h" | - | ||||||
| 31 | #include "MacroAssemblerCodeRef.h" | - | ||||||
| 32 | #include <wtf/CryptographicallyRandomNumber.h> | - | ||||||
| 33 | #include <wtf/Noncopyable.h> | - | ||||||
| 34 | #include <wtf/UnusedParam.h> | - | ||||||
| 35 | - | |||||||
| 36 | #if ENABLE(ASSEMBLER) | - | ||||||
| 37 | - | |||||||
| 38 | - | |||||||
| 39 | #if PLATFORM(QT) | - | ||||||
| 40 | #define ENABLE_JIT_CONSTANT_BLINDING 0 | - | ||||||
| 41 | #endif | - | ||||||
| 42 | - | |||||||
| 43 | #ifndef ENABLE_JIT_CONSTANT_BLINDING | - | ||||||
| 44 | #define ENABLE_JIT_CONSTANT_BLINDING 1 | - | ||||||
| 45 | #endif | - | ||||||
| 46 | - | |||||||
| 47 | namespace JSC { | - | ||||||
| 48 | - | |||||||
| 49 | class JumpReplacementWatchpoint; | - | ||||||
| 50 | template <typename, template <typename> class> | - | ||||||
| 51 | class LinkBufferBase; | - | ||||||
| 52 | template <typename> | - | ||||||
| 53 | class BranchCompactingLinkBuffer; | - | ||||||
| 54 | class RepatchBuffer; | - | ||||||
| 55 | class Watchpoint; | - | ||||||
| 56 | namespace DFG { | - | ||||||
| 57 | struct OSRExit; | - | ||||||
| 58 | } | - | ||||||
| 59 | - | |||||||
| 60 | template <class AssemblerType> | - | ||||||
| 61 | class AbstractMacroAssembler { | - | ||||||
| 62 | public: | - | ||||||
| 63 | friend class JITWriteBarrierBase; | - | ||||||
| 64 | typedef AssemblerType AssemblerType_T; | - | ||||||
| 65 | - | |||||||
| 66 | typedef MacroAssemblerCodePtr CodePtr; | - | ||||||
| 67 | typedef MacroAssemblerCodeRef CodeRef; | - | ||||||
| 68 | - | |||||||
| 69 | #if !CPU(ARM_THUMB2) && !CPU(ARM64) && !defined(V4_BOOTSTRAP) | - | ||||||
| 70 | class Jump; | - | ||||||
| 71 | #endif | - | ||||||
| 72 | - | |||||||
| 73 | typedef typename AssemblerType::RegisterID RegisterID; | - | ||||||
| 74 | typedef typename AssemblerType::FPRegisterID FPRegisterID; | - | ||||||
| 75 | - | |||||||
| 76 | // Section 1: MacroAssembler operand types | - | ||||||
| 77 | // | - | ||||||
| 78 | // The following types are used as operands to MacroAssembler operations, | - | ||||||
| 79 | // describing immediate and memory operands to the instructions to be planted. | - | ||||||
| 80 | - | |||||||
| 81 | enum Scale { | - | ||||||
| 82 | TimesOne, | - | ||||||
| 83 | TimesTwo, | - | ||||||
| 84 | TimesFour, | - | ||||||
| 85 | TimesEight, | - | ||||||
| 86 | }; | - | ||||||
| 87 | - | |||||||
| 88 | // Address: | - | ||||||
| 89 | // | - | ||||||
| 90 | // Describes a simple base-offset address. | - | ||||||
| 91 | struct Address { | - | ||||||
| 92 | explicit Address(RegisterID base, int32_t offset = 0) | - | ||||||
| 93 | : base(base) | - | ||||||
| 94 | , offset(offset) | - | ||||||
| 95 | { | - | ||||||
| 96 | } executed 2547284 times by 153 tests: end of blockExecuted by:
| 2547284 | ||||||
| 97 | - | |||||||
| 98 | RegisterID base; | - | ||||||
| 99 | int32_t offset; | - | ||||||
| 100 | }; | - | ||||||
| 101 | - | |||||||
| 102 | struct ExtendedAddress { | - | ||||||
| 103 | explicit ExtendedAddress(RegisterID base, intptr_t offset = 0) | - | ||||||
| 104 | : base(base) | - | ||||||
| 105 | , offset(offset) | - | ||||||
| 106 | { | - | ||||||
| 107 | } executed 3755 times by 3 tests: end of blockExecuted by:
| 3755 | ||||||
| 108 | - | |||||||
| 109 | RegisterID base; | - | ||||||
| 110 | intptr_t offset; | - | ||||||
| 111 | }; | - | ||||||
| 112 | - | |||||||
| 113 | // ImplicitAddress: | - | ||||||
| 114 | // | - | ||||||
| 115 | // This class is used for explicit 'load' and 'store' operations | - | ||||||
| 116 | // (as opposed to situations in which a memory operand is provided | - | ||||||
| 117 | // to a generic operation, such as an integer arithmetic instruction). | - | ||||||
| 118 | // | - | ||||||
| 119 | // In the case of a load (or store) operation we want to permit | - | ||||||
| 120 | // addresses to be implicitly constructed, e.g. the two calls: | - | ||||||
| 121 | // | - | ||||||
| 122 | // load32(Address(addrReg), destReg); | - | ||||||
| 123 | // load32(addrReg, destReg); | - | ||||||
| 124 | // | - | ||||||
| 125 | // Are equivalent, and the explicit wrapping of the Address in the former | - | ||||||
| 126 | // is unnecessary. | - | ||||||
| 127 | struct ImplicitAddress { | - | ||||||
| 128 | ImplicitAddress(RegisterID base) | - | ||||||
| 129 | : base(base) | - | ||||||
| 130 | , offset(0) | - | ||||||
| 131 | { | - | ||||||
| 132 | } executed 1153229 times by 153 tests: end of blockExecuted by:
| 1153229 | ||||||
| 133 | - | |||||||
| 134 | ImplicitAddress(Address address) | - | ||||||
| 135 | : base(address.base) | - | ||||||
| 136 | , offset(address.offset) | - | ||||||
| 137 | { | - | ||||||
| 138 | } executed 2495741 times by 153 tests: end of blockExecuted by:
| 2495741 | ||||||
| 139 | - | |||||||
| 140 | RegisterID base; | - | ||||||
| 141 | int32_t offset; | - | ||||||
| 142 | }; | - | ||||||
| 143 | - | |||||||
| 144 | // BaseIndex: | - | ||||||
| 145 | // | - | ||||||
| 146 | // Describes a complex addressing mode. | - | ||||||
| 147 | struct BaseIndex { | - | ||||||
| 148 | BaseIndex(RegisterID base, RegisterID index, Scale scale, int32_t offset = 0) | - | ||||||
| 149 | : base(base) | - | ||||||
| 150 | , index(index) | - | ||||||
| 151 | , scale(scale) | - | ||||||
| 152 | , offset(offset) | - | ||||||
| 153 | { | - | ||||||
| 154 | } executed 1589277 times by 9 tests: end of blockExecuted by:
| 1589277 | ||||||
| 155 | - | |||||||
| 156 | RegisterID base; | - | ||||||
| 157 | RegisterID index; | - | ||||||
| 158 | Scale scale; | - | ||||||
| 159 | int32_t offset; | - | ||||||
| 160 | }; | - | ||||||
| 161 | - | |||||||
| 162 | // AbsoluteAddress: | - | ||||||
| 163 | // | - | ||||||
| 164 | // Describes an memory operand given by a pointer. For regular load & store | - | ||||||
| 165 | // operations an unwrapped void* will be used, rather than using this. | - | ||||||
| 166 | struct AbsoluteAddress { | - | ||||||
| 167 | explicit AbsoluteAddress(const void* ptr) | - | ||||||
| 168 | : m_ptr(ptr) | - | ||||||
| 169 | { | - | ||||||
| 170 | } never executed: end of block | 0 | ||||||
| 171 | - | |||||||
| 172 | const void* m_ptr; | - | ||||||
| 173 | }; | - | ||||||
| 174 | - | |||||||
| 175 | // TrustedImmPtr: | - | ||||||
| 176 | // | - | ||||||
| 177 | // A pointer sized immediate operand to an instruction - this is wrapped | - | ||||||
| 178 | // in a class requiring explicit construction in order to differentiate | - | ||||||
| 179 | // from pointers used as absolute addresses to memory operations | - | ||||||
| 180 | struct TrustedImmPtr { | - | ||||||
| 181 | TrustedImmPtr() { } | - | ||||||
| 182 | - | |||||||
| 183 | explicit TrustedImmPtr(const void* value) | - | ||||||
| 184 | : m_value(value) | - | ||||||
| 185 | { | - | ||||||
| 186 | } executed 2398277 times by 153 tests: end of blockExecuted by:
| 2398277 | ||||||
| 187 | - | |||||||
| 188 | // This is only here so that TrustedImmPtr(0) does not confuse the C++ | - | ||||||
| 189 | // overload handling rules. | - | ||||||
| 190 | explicit TrustedImmPtr(int value) | - | ||||||
| 191 | : m_value(0) | - | ||||||
| 192 | { | - | ||||||
| 193 | ASSERT_UNUSED(value, !value); | - | ||||||
| 194 | } executed 13697 times by 65 tests: end of blockExecuted by:
| 13697 | ||||||
| 195 | - | |||||||
| 196 | explicit TrustedImmPtr(size_t value) | - | ||||||
| 197 | : m_value(reinterpret_cast<void*>(value)) | - | ||||||
| 198 | { | - | ||||||
| 199 | } never executed: end of block | 0 | ||||||
| 200 | - | |||||||
| 201 | intptr_t asIntptr() | - | ||||||
| 202 | { | - | ||||||
| 203 | return reinterpret_cast<intptr_t>(m_value); executed 2411803 times by 153 tests: return reinterpret_cast<intptr_t>(m_value);Executed by:
| 2411803 | ||||||
| 204 | } | - | ||||||
| 205 | - | |||||||
| 206 | const void* m_value; | - | ||||||
| 207 | }; | - | ||||||
| 208 | - | |||||||
| 209 | struct ImmPtr : | - | ||||||
| 210 | #if ENABLE(JIT_CONSTANT_BLINDING) | - | ||||||
| 211 | private TrustedImmPtr | - | ||||||
| 212 | #else | - | ||||||
| 213 | public TrustedImmPtr | - | ||||||
| 214 | #endif | - | ||||||
| 215 | { | - | ||||||
| 216 | explicit ImmPtr(const void* value) | - | ||||||
| 217 | : TrustedImmPtr(value) | - | ||||||
| 218 | { | - | ||||||
| 219 | } never executed: end of block | 0 | ||||||
| 220 | - | |||||||
| 221 | TrustedImmPtr asTrustedImmPtr() { return *this; } never executed: return *this; | 0 | ||||||
| 222 | }; | - | ||||||
| 223 | - | |||||||
| 224 | // TrustedImm32: | - | ||||||
| 225 | // | - | ||||||
| 226 | // A 32bit immediate operand to an instruction - this is wrapped in a | - | ||||||
| 227 | // class requiring explicit construction in order to prevent RegisterIDs | - | ||||||
| 228 | // (which are implemented as an enum) from accidentally being passed as | - | ||||||
| 229 | // immediate values. | - | ||||||
| 230 | struct TrustedImm32 { | - | ||||||
| 231 | TrustedImm32() { } | - | ||||||
| 232 | - | |||||||
| 233 | explicit TrustedImm32(int32_t value) | - | ||||||
| 234 | : m_value(value) | - | ||||||
| 235 | { | - | ||||||
| 236 | } executed 9765570 times by 153 tests: end of blockExecuted by:
| 9765570 | ||||||
| 237 | - | |||||||
| 238 | #if !CPU(X86_64) | - | ||||||
| 239 | explicit TrustedImm32(TrustedImmPtr ptr) | - | ||||||
| 240 | : m_value(ptr.asIntptr()) | - | ||||||
| 241 | { | - | ||||||
| 242 | } | - | ||||||
| 243 | #endif | - | ||||||
| 244 | - | |||||||
| 245 | int32_t m_value; | - | ||||||
| 246 | }; | - | ||||||
| 247 | - | |||||||
| 248 | - | |||||||
| 249 | struct Imm32 : | - | ||||||
| 250 | #if ENABLE(JIT_CONSTANT_BLINDING) | - | ||||||
| 251 | private TrustedImm32 | - | ||||||
| 252 | #else | - | ||||||
| 253 | public TrustedImm32 | - | ||||||
| 254 | #endif | - | ||||||
| 255 | { | - | ||||||
| 256 | explicit Imm32(int32_t value) | - | ||||||
| 257 | : TrustedImm32(value) | - | ||||||
| 258 | { | - | ||||||
| 259 | } executed 4887487 times by 153 tests: end of blockExecuted by:
| 4887487 | ||||||
| 260 | #if !CPU(X86_64) | - | ||||||
| 261 | explicit Imm32(TrustedImmPtr ptr) | - | ||||||
| 262 | : TrustedImm32(ptr) | - | ||||||
| 263 | { | - | ||||||
| 264 | } | - | ||||||
| 265 | #endif | - | ||||||
| 266 | const TrustedImm32& asTrustedImm32() const { return *this; } never executed: return *this; | 0 | ||||||
| 267 | - | |||||||
| 268 | }; | - | ||||||
| 269 | - | |||||||
| 270 | // TrustedImm64: | - | ||||||
| 271 | // | - | ||||||
| 272 | // A 64bit immediate operand to an instruction - this is wrapped in a | - | ||||||
| 273 | // class requiring explicit construction in order to prevent RegisterIDs | - | ||||||
| 274 | // (which are implemented as an enum) from accidentally being passed as | - | ||||||
| 275 | // immediate values. | - | ||||||
| 276 | struct TrustedImm64 { | - | ||||||
| 277 | TrustedImm64() { } | - | ||||||
| 278 | - | |||||||
| 279 | explicit TrustedImm64(int64_t value) | - | ||||||
| 280 | : m_value(value) | - | ||||||
| 281 | { | - | ||||||
| 282 | } executed 27294 times by 64 tests: end of blockExecuted by:
| 27294 | ||||||
| 283 | - | |||||||
| 284 | #if CPU(X86_64) || CPU(ARM64) | - | ||||||
| 285 | explicit TrustedImm64(TrustedImmPtr ptr) | - | ||||||
| 286 | : m_value(ptr.asIntptr()) | - | ||||||
| 287 | { | - | ||||||
| 288 | } executed 13246 times by 64 tests: end of blockExecuted by:
| 13246 | ||||||
| 289 | #endif | - | ||||||
| 290 | - | |||||||
| 291 | int64_t m_value; | - | ||||||
| 292 | }; | - | ||||||
| 293 | - | |||||||
| 294 | struct Imm64 : | - | ||||||
| 295 | #if ENABLE(JIT_CONSTANT_BLINDING) | - | ||||||
| 296 | private TrustedImm64 | - | ||||||
| 297 | #else | - | ||||||
| 298 | public TrustedImm64 | - | ||||||
| 299 | #endif | - | ||||||
| 300 | { | - | ||||||
| 301 | explicit Imm64(int64_t value) | - | ||||||
| 302 | : TrustedImm64(value) | - | ||||||
| 303 | { | - | ||||||
| 304 | } never executed: end of block | 0 | ||||||
| 305 | #if CPU(X86_64) || CPU(ARM64) | - | ||||||
| 306 | explicit Imm64(TrustedImmPtr ptr) | - | ||||||
| 307 | : TrustedImm64(ptr) | - | ||||||
| 308 | { | - | ||||||
| 309 | } never executed: end of block | 0 | ||||||
| 310 | #endif | - | ||||||
| 311 | const TrustedImm64& asTrustedImm64() const { return *this; } never executed: return *this; | 0 | ||||||
| 312 | }; | - | ||||||
| 313 | - | |||||||
| 314 | // Section 2: MacroAssembler code buffer handles | - | ||||||
| 315 | // | - | ||||||
| 316 | // The following types are used to reference items in the code buffer | - | ||||||
| 317 | // during JIT code generation. For example, the type Jump is used to | - | ||||||
| 318 | // track the location of a jump instruction so that it may later be | - | ||||||
| 319 | // linked to a label marking its destination. | - | ||||||
| 320 | - | |||||||
| 321 | - | |||||||
| 322 | // Label: | - | ||||||
| 323 | // | - | ||||||
| 324 | // A Label records a point in the generated instruction stream, typically such that | - | ||||||
| 325 | // it may be used as a destination for a jump. | - | ||||||
| 326 | class Label { | - | ||||||
| 327 | template<class TemplateAssemblerType> | - | ||||||
| 328 | friend class AbstractMacroAssembler; | - | ||||||
| 329 | friend struct DFG::OSRExit; | - | ||||||
| 330 | - | |||||||
| 331 | #if CPU(ARM_THUMB2) || CPU(ARM64) || defined(V4_BOOTSTRAP) | - | ||||||
| 332 | using Jump = typename AssemblerType::template Jump<Label>; | - | ||||||
| 333 | friend Jump; | - | ||||||
| 334 | #else | - | ||||||
| 335 | friend class Jump; | - | ||||||
| 336 | #endif | - | ||||||
| 337 | friend class JumpReplacementWatchpoint; | - | ||||||
| 338 | friend class MacroAssemblerCodeRef; | - | ||||||
| 339 | template <typename, template <typename> class> friend class LinkBufferBase; | - | ||||||
| 340 | friend class Watchpoint; | - | ||||||
| 341 | - | |||||||
| 342 | public: | - | ||||||
| 343 | Label() | - | ||||||
| 344 | { | - | ||||||
| 345 | } | - | ||||||
| 346 | - | |||||||
| 347 | Label(AbstractMacroAssembler<AssemblerType>* masm) | - | ||||||
| 348 | : m_label(masm->m_assembler.label()) | - | ||||||
| 349 | { | - | ||||||
| 350 | } executed 2324432 times by 153 tests: end of blockExecuted by:
| 2324432 | ||||||
| 351 | - | |||||||
| 352 | bool isSet() const { return m_label.isSet(); } executed 26592 times by 64 tests: return m_label.isSet();Executed by:
| 26592 | ||||||
| 353 | - | |||||||
| 354 | const AssemblerLabel &label() const { return m_label; } never executed: return m_label; | 0 | ||||||
| 355 | private: | - | ||||||
| 356 | AssemblerLabel m_label; | - | ||||||
| 357 | }; | - | ||||||
| 358 | - | |||||||
| 359 | // ConvertibleLoadLabel: | - | ||||||
| 360 | // | - | ||||||
| 361 | // A ConvertibleLoadLabel records a loadPtr instruction that can be patched to an addPtr | - | ||||||
| 362 | // so that: | - | ||||||
| 363 | // | - | ||||||
| 364 | // loadPtr(Address(a, i), b) | - | ||||||
| 365 | // | - | ||||||
| 366 | // becomes: | - | ||||||
| 367 | // | - | ||||||
| 368 | // addPtr(TrustedImmPtr(i), a, b) | - | ||||||
| 369 | class ConvertibleLoadLabel { | - | ||||||
| 370 | template<class TemplateAssemblerType> | - | ||||||
| 371 | friend class AbstractMacroAssembler; | - | ||||||
| 372 | template <typename, template <typename> class> friend class LinkBufferBase; | - | ||||||
| 373 | - | |||||||
| 374 | public: | - | ||||||
| 375 | ConvertibleLoadLabel() | - | ||||||
| 376 | { | - | ||||||
| 377 | } | - | ||||||
| 378 | - | |||||||
| 379 | ConvertibleLoadLabel(AbstractMacroAssembler<AssemblerType>* masm) | - | ||||||
| 380 | : m_label(masm->m_assembler.labelIgnoringWatchpoints()) | - | ||||||
| 381 | { | - | ||||||
| 382 | } never executed: end of block | 0 | ||||||
| 383 | - | |||||||
| 384 | bool isSet() const { return m_label.isSet(); } never executed: return m_label.isSet(); | 0 | ||||||
| 385 | private: | - | ||||||
| 386 | AssemblerLabel m_label; | - | ||||||
| 387 | }; | - | ||||||
| 388 | - | |||||||
| 389 | // DataLabelPtr: | - | ||||||
| 390 | // | - | ||||||
| 391 | // A DataLabelPtr is used to refer to a location in the code containing a pointer to be | - | ||||||
| 392 | // patched after the code has been generated. | - | ||||||
| 393 | class DataLabelPtr { | - | ||||||
| 394 | template<class TemplateAssemblerType> | - | ||||||
| 395 | friend class AbstractMacroAssembler; | - | ||||||
| 396 | template <typename, template <typename> class> friend class LinkBufferBase; | - | ||||||
| 397 | public: | - | ||||||
| 398 | DataLabelPtr() | - | ||||||
| 399 | { | - | ||||||
| 400 | } | - | ||||||
| 401 | - | |||||||
| 402 | DataLabelPtr(AbstractMacroAssembler<AssemblerType>* masm) | - | ||||||
| 403 | : m_label(masm->m_assembler.label()) | - | ||||||
| 404 | { | - | ||||||
| 405 | } executed 610 times by 10 tests: end of blockExecuted by:
| 610 | ||||||
| 406 | - | |||||||
| 407 | bool isSet() const { return m_label.isSet(); } never executed: return m_label.isSet(); | 0 | ||||||
| 408 | - | |||||||
| 409 | private: | - | ||||||
| 410 | AssemblerLabel m_label; | - | ||||||
| 411 | }; | - | ||||||
| 412 | - | |||||||
| 413 | // DataLabel32: | - | ||||||
| 414 | // | - | ||||||
| 415 | // A DataLabelPtr is used to refer to a location in the code containing a pointer to be | - | ||||||
| 416 | // patched after the code has been generated. | - | ||||||
| 417 | class DataLabel32 { | - | ||||||
| 418 | template<class TemplateAssemblerType> | - | ||||||
| 419 | friend class AbstractMacroAssembler; | - | ||||||
| 420 | template <typename, template <typename> class> friend class LinkBufferBase; | - | ||||||
| 421 | public: | - | ||||||
| 422 | DataLabel32() | - | ||||||
| 423 | { | - | ||||||
| 424 | } | - | ||||||
| 425 | - | |||||||
| 426 | DataLabel32(AbstractMacroAssembler<AssemblerType>* masm) | - | ||||||
| 427 | : m_label(masm->m_assembler.label()) | - | ||||||
| 428 | { | - | ||||||
| 429 | } never executed: end of block | 0 | ||||||
| 430 | - | |||||||
| 431 | AssemblerLabel label() const { return m_label; } never executed: return m_label; | 0 | ||||||
| 432 | - | |||||||
| 433 | private: | - | ||||||
| 434 | AssemblerLabel m_label; | - | ||||||
| 435 | }; | - | ||||||
| 436 | - | |||||||
| 437 | // DataLabelCompact: | - | ||||||
| 438 | // | - | ||||||
| 439 | // A DataLabelCompact is used to refer to a location in the code containing a | - | ||||||
| 440 | // compact immediate to be patched after the code has been generated. | - | ||||||
| 441 | class DataLabelCompact { | - | ||||||
| 442 | template<class TemplateAssemblerType> | - | ||||||
| 443 | friend class AbstractMacroAssembler; | - | ||||||
| 444 | template <typename, template <typename> class> friend class LinkBufferBase; | - | ||||||
| 445 | public: | - | ||||||
| 446 | DataLabelCompact() | - | ||||||
| 447 | { | - | ||||||
| 448 | } | - | ||||||
| 449 | - | |||||||
| 450 | DataLabelCompact(AbstractMacroAssembler<AssemblerType>* masm) | - | ||||||
| 451 | : m_label(masm->m_assembler.label()) | - | ||||||
| 452 | { | - | ||||||
| 453 | } never executed: end of block | 0 | ||||||
| 454 | - | |||||||
| 455 | DataLabelCompact(AssemblerLabel label) | - | ||||||
| 456 | : m_label(label) | - | ||||||
| 457 | { | - | ||||||
| 458 | } never executed: end of block | 0 | ||||||
| 459 | - | |||||||
| 460 | private: | - | ||||||
| 461 | AssemblerLabel m_label; | - | ||||||
| 462 | }; | - | ||||||
| 463 | - | |||||||
| 464 | #if CPU(ARM_THUMB2) || CPU(ARM64) || defined(V4_BOOTSTRAP) | - | ||||||
| 465 | using Jump = typename AssemblerType::template Jump<Label>; | - | ||||||
| 466 | friend Jump; | - | ||||||
| 467 | #endif | - | ||||||
| 468 | - | |||||||
| 469 | // Call: | - | ||||||
| 470 | // | - | ||||||
| 471 | // A Call object is a reference to a call instruction that has been planted | - | ||||||
| 472 | // into the code buffer - it is typically used to link the call, setting the | - | ||||||
| 473 | // relative offset such that when executed it will call to the desired | - | ||||||
| 474 | // destination. | - | ||||||
| 475 | class Call { | - | ||||||
| 476 | template<class TemplateAssemblerType> | - | ||||||
| 477 | friend class AbstractMacroAssembler; | - | ||||||
| 478 | - | |||||||
| 479 | public: | - | ||||||
| 480 | enum Flags { | - | ||||||
| 481 | None = 0x0, | - | ||||||
| 482 | Linkable = 0x1, | - | ||||||
| 483 | Near = 0x2, | - | ||||||
| 484 | LinkableNear = 0x3, | - | ||||||
| 485 | }; | - | ||||||
| 486 | - | |||||||
| 487 | Call() | - | ||||||
| 488 | : m_flags(None) | - | ||||||
| 489 | { | - | ||||||
| 490 | } never executed: end of block | 0 | ||||||
| 491 | - | |||||||
| 492 | Call(AssemblerLabel jmp, Flags flags) | - | ||||||
| 493 | : m_label(jmp) | - | ||||||
| 494 | , m_flags(flags) | - | ||||||
| 495 | { | - | ||||||
| 496 | } executed 83222 times by 64 tests: end of blockExecuted by:
| 83222 | ||||||
| 497 | - | |||||||
| 498 | bool isFlagSet(Flags flag) | - | ||||||
| 499 | { | - | ||||||
| 500 | return m_flags & flag; never executed: return m_flags & flag; | 0 | ||||||
| 501 | } | - | ||||||
| 502 | - | |||||||
| 503 | static Call fromTailJump(Jump jump) | - | ||||||
| 504 | { | - | ||||||
| 505 | return Call(jump.m_label, Linkable); never executed: return Call(jump.m_label, Linkable); | 0 | ||||||
| 506 | } | - | ||||||
| 507 | - | |||||||
| 508 | AssemblerLabel m_label; | - | ||||||
| 509 | private: | - | ||||||
| 510 | Flags m_flags; | - | ||||||
| 511 | }; | - | ||||||
| 512 | - | |||||||
| 513 | // Jump: | - | ||||||
| 514 | // | - | ||||||
| 515 | // A jump object is a reference to a jump instruction that has been planted | - | ||||||
| 516 | // into the code buffer - it is typically used to link the jump, setting the | - | ||||||
| 517 | // relative offset such that when executed it will jump to the desired | - | ||||||
| 518 | // destination. | - | ||||||
| 519 | #if !CPU(ARM_THUMB2) && !CPU(ARM64) && !defined(V4_BOOTSTRAP) | - | ||||||
| 520 | class Jump { | - | ||||||
| 521 | template<class TemplateAssemblerType> | - | ||||||
| 522 | friend class AbstractMacroAssembler; | - | ||||||
| 523 | friend class Call; | - | ||||||
| 524 | friend struct DFG::OSRExit; | - | ||||||
| 525 | template <typename, template <typename> class> friend class LinkBufferBase; | - | ||||||
| 526 | public: | - | ||||||
| 527 | Jump() | - | ||||||
| 528 | { | - | ||||||
| 529 | } | - | ||||||
| 530 | - | |||||||
| 531 | #if CPU(ARM_THUMB2) || defined(V4_BOOTSTRAP) | - | ||||||
| 532 | // Fixme: this information should be stored in the instruction stream, not in the Jump object. | - | ||||||
| 533 | Jump(AssemblerLabel jmp, ARMv7Assembler::JumpType type = ARMv7Assembler::JumpNoCondition, ARMv7Assembler::Condition condition = ARMv7Assembler::ConditionInvalid) | - | ||||||
| 534 | : m_label(jmp) | - | ||||||
| 535 | , m_type(type) | - | ||||||
| 536 | , m_condition(condition) | - | ||||||
| 537 | { | - | ||||||
| 538 | } | - | ||||||
| 539 | #elif CPU(ARM64) | - | ||||||
| 540 | Jump(AssemblerLabel jmp, ARM64Assembler::JumpType type = ARM64Assembler::JumpNoCondition, ARM64Assembler::Condition condition = ARM64Assembler::ConditionInvalid) | - | ||||||
| 541 | : m_label(jmp) | - | ||||||
| 542 | , m_type(type) | - | ||||||
| 543 | , m_condition(condition) | - | ||||||
| 544 | { | - | ||||||
| 545 | } | - | ||||||
| 546 | - | |||||||
| 547 | Jump(AssemblerLabel jmp, ARM64Assembler::JumpType type, ARM64Assembler::Condition condition, bool is64Bit, ARM64Assembler::RegisterID compareRegister) | - | ||||||
| 548 | : m_label(jmp) | - | ||||||
| 549 | , m_type(type) | - | ||||||
| 550 | , m_condition(condition) | - | ||||||
| 551 | , m_is64Bit(is64Bit) | - | ||||||
| 552 | , m_compareRegister(compareRegister) | - | ||||||
| 553 | { | - | ||||||
| 554 | ASSERT((type == ARM64Assembler::JumpCompareAndBranch) || (type == ARM64Assembler::JumpCompareAndBranchFixedSize)); | - | ||||||
| 555 | } | - | ||||||
| 556 | - | |||||||
| 557 | Jump(AssemblerLabel jmp, ARM64Assembler::JumpType type, ARM64Assembler::Condition condition, unsigned bitNumber, ARM64Assembler::RegisterID compareRegister) | - | ||||||
| 558 | : m_label(jmp) | - | ||||||
| 559 | , m_type(type) | - | ||||||
| 560 | , m_condition(condition) | - | ||||||
| 561 | , m_bitNumber(bitNumber) | - | ||||||
| 562 | , m_compareRegister(compareRegister) | - | ||||||
| 563 | { | - | ||||||
| 564 | ASSERT((type == ARM64Assembler::JumpTestBit) || (type == ARM64Assembler::JumpTestBitFixedSize)); | - | ||||||
| 565 | } | - | ||||||
| 566 | #elif CPU(SH4) | - | ||||||
| 567 | Jump(AssemblerLabel jmp, SH4Assembler::JumpType type = SH4Assembler::JumpFar) | - | ||||||
| 568 | : m_label(jmp) | - | ||||||
| 569 | , m_type(type) | - | ||||||
| 570 | { | - | ||||||
| 571 | } | - | ||||||
| 572 | #else | - | ||||||
| 573 | Jump(AssemblerLabel jmp) | - | ||||||
| 574 | : m_label(jmp) | - | ||||||
| 575 | { | - | ||||||
| 576 | } executed 7520831 times by 153 tests: end of blockExecuted by:
| 7520831 | ||||||
| 577 | #endif | - | ||||||
| 578 | - | |||||||
| 579 | Label label() const | - | ||||||
| 580 | { | - | ||||||
| 581 | Label result; | - | ||||||
| 582 | result.m_label = m_label; | - | ||||||
| 583 | return result; never executed: return result; | 0 | ||||||
| 584 | } | - | ||||||
| 585 | - | |||||||
| 586 | void link(AbstractMacroAssembler<AssemblerType>* masm) const | - | ||||||
| 587 | { | - | ||||||
| 588 | #if ENABLE(DFG_REGISTER_ALLOCATION_VALIDATION) | - | ||||||
| 589 | masm->checkRegisterAllocationAgainstBranchRange(m_label.m_offset, masm->debugOffset()); | - | ||||||
| 590 | #endif | - | ||||||
| 591 | - | |||||||
| 592 | #if CPU(ARM_THUMB2) | - | ||||||
| 593 | masm->m_assembler.linkJump(m_label, masm->m_assembler.label(), m_type, m_condition); | - | ||||||
| 594 | #elif CPU(ARM64) | - | ||||||
| 595 | if ((m_type == ARM64Assembler::JumpCompareAndBranch) || (m_type == ARM64Assembler::JumpCompareAndBranchFixedSize)) | - | ||||||
| 596 | masm->m_assembler.linkJump(m_label, masm->m_assembler.label(), m_type, m_condition, m_is64Bit, m_compareRegister); | - | ||||||
| 597 | else if ((m_type == ARM64Assembler::JumpTestBit) || (m_type == ARM64Assembler::JumpTestBitFixedSize)) | - | ||||||
| 598 | masm->m_assembler.linkJump(m_label, masm->m_assembler.label(), m_type, m_condition, m_bitNumber, m_compareRegister); | - | ||||||
| 599 | else | - | ||||||
| 600 | masm->m_assembler.linkJump(m_label, masm->m_assembler.label(), m_type, m_condition); | - | ||||||
| 601 | #elif CPU(SH4) | - | ||||||
| 602 | masm->m_assembler.linkJump(m_label, masm->m_assembler.label(), m_type); | - | ||||||
| 603 | #else | - | ||||||
| 604 | masm->m_assembler.linkJump(m_label, masm->m_assembler.label()); | - | ||||||
| 605 | #endif | - | ||||||
| 606 | } executed 5196730 times by 153 tests: end of blockExecuted by:
| 5196730 | ||||||
| 607 | - | |||||||
| 608 | void linkTo(Label label, AbstractMacroAssembler<AssemblerType>* masm) const | - | ||||||
| 609 | { | - | ||||||
| 610 | #if ENABLE(DFG_REGISTER_ALLOCATION_VALIDATION) | - | ||||||
| 611 | masm->checkRegisterAllocationAgainstBranchRange(label.m_label.m_offset, m_label.m_offset); | - | ||||||
| 612 | #endif | - | ||||||
| 613 | - | |||||||
| 614 | #if CPU(ARM_THUMB2) | - | ||||||
| 615 | masm->m_assembler.linkJump(m_label, label.m_label, m_type, m_condition); | - | ||||||
| 616 | #elif CPU(ARM64) | - | ||||||
| 617 | if ((m_type == ARM64Assembler::JumpCompareAndBranch) || (m_type == ARM64Assembler::JumpCompareAndBranchFixedSize)) | - | ||||||
| 618 | masm->m_assembler.linkJump(m_label, label.m_label, m_type, m_condition, m_is64Bit, m_compareRegister); | - | ||||||
| 619 | else if ((m_type == ARM64Assembler::JumpTestBit) || (m_type == ARM64Assembler::JumpTestBitFixedSize)) | - | ||||||
| 620 | masm->m_assembler.linkJump(m_label, label.m_label, m_type, m_condition, m_bitNumber, m_compareRegister); | - | ||||||
| 621 | else | - | ||||||
| 622 | masm->m_assembler.linkJump(m_label, label.m_label, m_type, m_condition); | - | ||||||
| 623 | #else | - | ||||||
| 624 | masm->m_assembler.linkJump(m_label, label.m_label); | - | ||||||
| 625 | #endif | - | ||||||
| 626 | } executed 2330423 times by 153 tests: end of blockExecuted by:
| 2330423 | ||||||
| 627 | - | |||||||
| 628 | bool isSet() const { return m_label.isSet(); } executed 64678 times by 64 tests: return m_label.isSet();Executed by:
| 64678 | ||||||
| 629 | - | |||||||
| 630 | private: | - | ||||||
| 631 | AssemblerLabel m_label; | - | ||||||
| 632 | #if CPU(ARM_THUMB2) || defined(V4_BOOTSTRAP) | - | ||||||
| 633 | ARMv7Assembler::JumpType m_type; | - | ||||||
| 634 | ARMv7Assembler::Condition m_condition; | - | ||||||
| 635 | #endif | - | ||||||
| 636 | #if CPU(ARM64) | - | ||||||
| 637 | ARM64Assembler::JumpType m_type; | - | ||||||
| 638 | ARM64Assembler::Condition m_condition; | - | ||||||
| 639 | bool m_is64Bit; | - | ||||||
| 640 | unsigned m_bitNumber; | - | ||||||
| 641 | ARM64Assembler::RegisterID m_compareRegister; | - | ||||||
| 642 | #endif | - | ||||||
| 643 | #if CPU(SH4) | - | ||||||
| 644 | SH4Assembler::JumpType m_type; | - | ||||||
| 645 | #endif | - | ||||||
| 646 | }; | - | ||||||
| 647 | #endif | - | ||||||
| 648 | - | |||||||
| 649 | struct PatchableJump { | - | ||||||
| 650 | PatchableJump() | - | ||||||
| 651 | { | - | ||||||
| 652 | } | - | ||||||
| 653 | - | |||||||
| 654 | explicit PatchableJump(Jump jump) | - | ||||||
| 655 | : m_jump(jump) | - | ||||||
| 656 | { | - | ||||||
| 657 | } never executed: end of block | 0 | ||||||
| 658 | - | |||||||
| 659 | operator Jump&() { return m_jump; } never executed: return m_jump; | 0 | ||||||
| 660 | - | |||||||
| 661 | Jump m_jump; | - | ||||||
| 662 | }; | - | ||||||
| 663 | - | |||||||
| 664 | // JumpList: | - | ||||||
| 665 | // | - | ||||||
| 666 | // A JumpList is a set of Jump objects. | - | ||||||
| 667 | // All jumps in the set will be linked to the same destination. | - | ||||||
| 668 | class JumpList { | - | ||||||
| 669 | template <typename, template <typename> class> friend class LinkBufferBase; | - | ||||||
| 670 | - | |||||||
| 671 | public: | - | ||||||
| 672 | typedef Vector<Jump, 2> JumpVector; | - | ||||||
| 673 | - | |||||||
| 674 | JumpList() { } | - | ||||||
| 675 | - | |||||||
| 676 | JumpList(Jump jump) | - | ||||||
| 677 | { | - | ||||||
| 678 | append(jump); | - | ||||||
| 679 | } never executed: end of block | 0 | ||||||
| 680 | - | |||||||
| 681 | void link(AbstractMacroAssembler<AssemblerType>* masm) | - | ||||||
| 682 | { | - | ||||||
| 683 | size_t size = m_jumps.size(); | - | ||||||
| 684 | for (size_t i = 0; i < size; ++i)
| 2318643-2777913 | ||||||
| 685 | m_jumps[i].link(masm); executed 2778363 times by 153 tests: m_jumps[i].link(masm);Executed by:
| 2778363 | ||||||
| 686 | m_jumps.clear(); | - | ||||||
| 687 | } executed 2317694 times by 153 tests: end of blockExecuted by:
| 2317694 | ||||||
| 688 | - | |||||||
| 689 | void linkTo(Label label, AbstractMacroAssembler<AssemblerType>* masm) | - | ||||||
| 690 | { | - | ||||||
| 691 | size_t size = m_jumps.size(); | - | ||||||
| 692 | for (size_t i = 0; i < size; ++i)
| 800-1210 | ||||||
| 693 | m_jumps[i].linkTo(label, masm); executed 1209 times by 5 tests: m_jumps[i].linkTo(label, masm);Executed by:
| 1209 | ||||||
| 694 | m_jumps.clear(); | - | ||||||
| 695 | } executed 800 times by 5 tests: end of blockExecuted by:
| 800 | ||||||
| 696 | - | |||||||
| 697 | void append(Jump jump) | - | ||||||
| 698 | { | - | ||||||
| 699 | m_jumps.append(jump); | - | ||||||
| 700 | } executed 2781479 times by 153 tests: end of blockExecuted by:
| 2781479 | ||||||
| 701 | - | |||||||
| 702 | void append(const JumpList& other) | - | ||||||
| 703 | { | - | ||||||
| 704 | m_jumps.append(other.m_jumps.begin(), other.m_jumps.size()); | - | ||||||
| 705 | } executed 2382740 times by 9 tests: end of blockExecuted by:
| 2382740 | ||||||
| 706 | - | |||||||
| 707 | bool empty() | - | ||||||
| 708 | { | - | ||||||
| 709 | return !m_jumps.size(); executed 2298520 times by 153 tests: return !m_jumps.size();Executed by:
| 2298520 | ||||||
| 710 | } | - | ||||||
| 711 | - | |||||||
| 712 | void clear() | - | ||||||
| 713 | { | - | ||||||
| 714 | m_jumps.clear(); | - | ||||||
| 715 | } executed 1158343 times by 153 tests: end of blockExecuted by:
| 1158343 | ||||||
| 716 | - | |||||||
| 717 | const JumpVector& jumps() const { return m_jumps; } never executed: return m_jumps; | 0 | ||||||
| 718 | - | |||||||
| 719 | private: | - | ||||||
| 720 | JumpVector m_jumps; | - | ||||||
| 721 | }; | - | ||||||
| 722 | - | |||||||
| 723 | - | |||||||
| 724 | // Section 3: Misc admin methods | - | ||||||
| 725 | #if ENABLE(DFG_JIT) | - | ||||||
| 726 | Label labelIgnoringWatchpoints() | - | ||||||
| 727 | { | - | ||||||
| 728 | Label result; | - | ||||||
| 729 | result.m_label = m_assembler.labelIgnoringWatchpoints(); | - | ||||||
| 730 | return result; | - | ||||||
| 731 | } | - | ||||||
| 732 | #else | - | ||||||
| 733 | Label labelIgnoringWatchpoints() | - | ||||||
| 734 | { | - | ||||||
| 735 | return label(); never executed: return label(); | 0 | ||||||
| 736 | } | - | ||||||
| 737 | #endif | - | ||||||
| 738 | - | |||||||
| 739 | Label label() | - | ||||||
| 740 | { | - | ||||||
| 741 | return Label(this); executed 1170130 times by 153 tests: return Label(this);Executed by:
| 1170130 | ||||||
| 742 | } | - | ||||||
| 743 | - | |||||||
| 744 | void padBeforePatch() | - | ||||||
| 745 | { | - | ||||||
| 746 | // Rely on the fact that asking for a label already does the padding. | - | ||||||
| 747 | (void)label(); | - | ||||||
| 748 | } executed 610 times by 10 tests: end of blockExecuted by:
| 610 | ||||||
| 749 | - | |||||||
| 750 | Label watchpointLabel() | - | ||||||
| 751 | { | - | ||||||
| 752 | Label result; | - | ||||||
| 753 | result.m_label = m_assembler.labelForWatchpoint(); | - | ||||||
| 754 | return result; never executed: return result; | 0 | ||||||
| 755 | } | - | ||||||
| 756 | - | |||||||
| 757 | Label align() | - | ||||||
| 758 | { | - | ||||||
| 759 | m_assembler.align(16); | - | ||||||
| 760 | return Label(this); never executed: return Label(this); | 0 | ||||||
| 761 | } | - | ||||||
| 762 | - | |||||||
| 763 | #if ENABLE(DFG_REGISTER_ALLOCATION_VALIDATION) | - | ||||||
| 764 | class RegisterAllocationOffset { | - | ||||||
| 765 | public: | - | ||||||
| 766 | RegisterAllocationOffset(unsigned offset) | - | ||||||
| 767 | : m_offset(offset) | - | ||||||
| 768 | { | - | ||||||
| 769 | } | - | ||||||
| 770 | - | |||||||
| 771 | void check(unsigned low, unsigned high) | - | ||||||
| 772 | { | - | ||||||
| 773 | RELEASE_ASSERT_WITH_MESSAGE(!(low <= m_offset && m_offset <= high), "Unsafe branch over register allocation at instruction offset %u in jump offset range %u..%u", m_offset, low, high); | - | ||||||
| 774 | } | - | ||||||
| 775 | - | |||||||
| 776 | private: | - | ||||||
| 777 | unsigned m_offset; | - | ||||||
| 778 | }; | - | ||||||
| 779 | - | |||||||
| 780 | void addRegisterAllocationAtOffset(unsigned offset) | - | ||||||
| 781 | { | - | ||||||
| 782 | m_registerAllocationForOffsets.append(RegisterAllocationOffset(offset)); | - | ||||||
| 783 | } | - | ||||||
| 784 | - | |||||||
| 785 | void clearRegisterAllocationOffsets() | - | ||||||
| 786 | { | - | ||||||
| 787 | m_registerAllocationForOffsets.clear(); | - | ||||||
| 788 | } | - | ||||||
| 789 | - | |||||||
| 790 | void checkRegisterAllocationAgainstBranchRange(unsigned offset1, unsigned offset2) | - | ||||||
| 791 | { | - | ||||||
| 792 | if (offset1 > offset2) | - | ||||||
| 793 | std::swap(offset1, offset2); | - | ||||||
| 794 | - | |||||||
| 795 | size_t size = m_registerAllocationForOffsets.size(); | - | ||||||
| 796 | for (size_t i = 0; i < size; ++i) | - | ||||||
| 797 | m_registerAllocationForOffsets[i].check(offset1, offset2); | - | ||||||
| 798 | } | - | ||||||
| 799 | #endif | - | ||||||
| 800 | - | |||||||
| 801 | template<typename T, typename U> | - | ||||||
| 802 | static ptrdiff_t differenceBetween(T from, U to) | - | ||||||
| 803 | { | - | ||||||
| 804 | return AssemblerType::getDifferenceBetweenLabels(from.m_label, to.m_label); never executed: return AssemblerType::getDifferenceBetweenLabels(from.m_label, to.m_label); | 0 | ||||||
| 805 | } | - | ||||||
| 806 | - | |||||||
| 807 | static ptrdiff_t differenceBetweenCodePtr(const MacroAssemblerCodePtr& a, const MacroAssemblerCodePtr& b) | - | ||||||
| 808 | { | - | ||||||
| 809 | return reinterpret_cast<ptrdiff_t>(b.executableAddress()) - reinterpret_cast<ptrdiff_t>(a.executableAddress()); never executed: return reinterpret_cast<ptrdiff_t>(b.executableAddress()) - reinterpret_cast<ptrdiff_t>(a.executableAddress()); | 0 | ||||||
| 810 | } | - | ||||||
| 811 | - | |||||||
| 812 | unsigned debugOffset() { return m_assembler.debugOffset(); } never executed: return m_assembler.debugOffset(); | 0 | ||||||
| 813 | - | |||||||
| 814 | ALWAYS_INLINE static void cacheFlush(void* code, size_t size) | - | ||||||
| 815 | { | - | ||||||
| 816 | AssemblerType::cacheFlush(code, size); | - | ||||||
| 817 | } executed 1163856 times by 153 tests: end of blockExecuted by:
| 1163856 | ||||||
| 818 | protected: | - | ||||||
| 819 | AbstractMacroAssembler() | - | ||||||
| 820 | : m_randomSource(cryptographicallyRandomNumber()) | - | ||||||
| 821 | { | - | ||||||
| 822 | } executed 1162652 times by 153 tests: end of blockExecuted by:
| 1162652 | ||||||
| 823 | - | |||||||
| 824 | AssemblerType m_assembler; | - | ||||||
| 825 | - | |||||||
| 826 | uint32_t random() | - | ||||||
| 827 | { | - | ||||||
| 828 | return m_randomSource.getUint32(); never executed: return m_randomSource.getUint32(); | 0 | ||||||
| 829 | } | - | ||||||
| 830 | - | |||||||
| 831 | WeakRandom m_randomSource; | - | ||||||
| 832 | - | |||||||
| 833 | #if ENABLE(DFG_REGISTER_ALLOCATION_VALIDATION) | - | ||||||
| 834 | Vector<RegisterAllocationOffset, 10> m_registerAllocationForOffsets; | - | ||||||
| 835 | #endif | - | ||||||
| 836 | - | |||||||
| 837 | #if ENABLE(JIT_CONSTANT_BLINDING) | - | ||||||
| 838 | static bool scratchRegisterForBlinding() { return false; } | - | ||||||
| 839 | static bool shouldBlindForSpecificArch(uint32_t) { return true; } | - | ||||||
| 840 | static bool shouldBlindForSpecificArch(uint64_t) { return true; } | - | ||||||
| 841 | #endif | - | ||||||
| 842 | - | |||||||
| 843 | template <typename, template <typename> class> friend class LinkBufferBase; | - | ||||||
| 844 | template <typename> friend class BranchCompactingLinkBuffer; | - | ||||||
| 845 | friend class RepatchBuffer; | - | ||||||
| 846 | - | |||||||
| 847 | static void linkJump(void* code, Jump jump, CodeLocationLabel target) | - | ||||||
| 848 | { | - | ||||||
| 849 | AssemblerType::linkJump(code, jump.m_label, target.dataLocation()); | - | ||||||
| 850 | } never executed: end of block | 0 | ||||||
| 851 | - | |||||||
| 852 | static void linkPointer(void* code, AssemblerLabel label, void* value) | - | ||||||
| 853 | { | - | ||||||
| 854 | AssemblerType::linkPointer(code, label, value); | - | ||||||
| 855 | } executed 612 times by 10 tests: end of blockExecuted by:
| 612 | ||||||
| 856 | - | |||||||
| 857 | static void* getLinkerAddress(void* code, AssemblerLabel label) | - | ||||||
| 858 | { | - | ||||||
| 859 | return AssemblerType::getRelocatedAddress(code, label); executed 612 times by 10 tests: return AssemblerType::getRelocatedAddress(code, label);Executed by:
| 612 | ||||||
| 860 | } | - | ||||||
| 861 | - | |||||||
| 862 | static unsigned getLinkerCallReturnOffset(Call call) | - | ||||||
| 863 | { | - | ||||||
| 864 | return AssemblerType::getCallReturnOffset(call.m_label); never executed: return AssemblerType::getCallReturnOffset(call.m_label); | 0 | ||||||
| 865 | } | - | ||||||
| 866 | - | |||||||
| 867 | static void repatchJump(CodeLocationJump jump, CodeLocationLabel destination) | - | ||||||
| 868 | { | - | ||||||
| 869 | AssemblerType::relinkJump(jump.dataLocation(), destination.dataLocation()); | - | ||||||
| 870 | } never executed: end of block | 0 | ||||||
| 871 | - | |||||||
| 872 | static void repatchNearCall(CodeLocationNearCall nearCall, CodeLocationLabel destination) | - | ||||||
| 873 | { | - | ||||||
| 874 | AssemblerType::relinkCall(nearCall.dataLocation(), destination.executableAddress()); | - | ||||||
| 875 | } never executed: end of block | 0 | ||||||
| 876 | - | |||||||
| 877 | static void repatchCompact(CodeLocationDataLabelCompact dataLabelCompact, int32_t value) | - | ||||||
| 878 | { | - | ||||||
| 879 | AssemblerType::repatchCompact(dataLabelCompact.dataLocation(), value); | - | ||||||
| 880 | } never executed: end of block | 0 | ||||||
| 881 | - | |||||||
| 882 | static void repatchInt32(CodeLocationDataLabel32 dataLabel32, int32_t value) | - | ||||||
| 883 | { | - | ||||||
| 884 | AssemblerType::repatchInt32(dataLabel32.dataLocation(), value); | - | ||||||
| 885 | } never executed: end of block | 0 | ||||||
| 886 | - | |||||||
| 887 | static void repatchPointer(CodeLocationDataLabelPtr dataLabelPtr, void* value) | - | ||||||
| 888 | { | - | ||||||
| 889 | AssemblerType::repatchPointer(dataLabelPtr.dataLocation(), value); | - | ||||||
| 890 | } never executed: end of block | 0 | ||||||
| 891 | - | |||||||
| 892 | #if !defined(V4_BOOTSTRAP) | - | ||||||
| 893 | static void* readPointer(CodeLocationDataLabelPtr dataLabelPtr) | - | ||||||
| 894 | { | - | ||||||
| 895 | return AssemblerType::readPointer(dataLabelPtr.dataLocation()); never executed: return AssemblerType::readPointer(dataLabelPtr.dataLocation()); | 0 | ||||||
| 896 | } | - | ||||||
| 897 | #endif | - | ||||||
| 898 | - | |||||||
| 899 | static void replaceWithLoad(CodeLocationConvertibleLoad label) | - | ||||||
| 900 | { | - | ||||||
| 901 | AssemblerType::replaceWithLoad(label.dataLocation()); | - | ||||||
| 902 | } never executed: end of block | 0 | ||||||
| 903 | - | |||||||
| 904 | static void replaceWithAddressComputation(CodeLocationConvertibleLoad label) | - | ||||||
| 905 | { | - | ||||||
| 906 | AssemblerType::replaceWithAddressComputation(label.dataLocation()); | - | ||||||
| 907 | } never executed: end of block | 0 | ||||||
| 908 | }; | - | ||||||
| 909 | - | |||||||
| 910 | } // namespace JSC | - | ||||||
| 911 | - | |||||||
| 912 | #endif // ENABLE(ASSEMBLER) | - | ||||||
| 913 | - | |||||||
| 914 | #endif // AbstractMacroAssembler_h | - | ||||||
| Source code | Switch to Preprocessed file |