| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/3rdparty/masm/assembler/MacroAssemblerX86Common.h |
| Source code | Switch to Preprocessed file |
| Line | Source | Count | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | /* | - | ||||||||||||||||||
| 2 | * Copyright (C) 2008 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 MacroAssemblerX86Common_h | - | ||||||||||||||||||
| 27 | #define MacroAssemblerX86Common_h | - | ||||||||||||||||||
| 28 | - | |||||||||||||||||||
| 29 | #if ENABLE(ASSEMBLER) | - | ||||||||||||||||||
| 30 | - | |||||||||||||||||||
| 31 | #include "X86Assembler.h" | - | ||||||||||||||||||
| 32 | #include "AbstractMacroAssembler.h" | - | ||||||||||||||||||
| 33 | - | |||||||||||||||||||
| 34 | namespace JSC { | - | ||||||||||||||||||
| 35 | - | |||||||||||||||||||
| 36 | class MacroAssemblerX86Common : public AbstractMacroAssembler<X86Assembler> { | - | ||||||||||||||||||
| 37 | protected: | - | ||||||||||||||||||
| 38 | #if CPU(X86_64) | - | ||||||||||||||||||
| 39 | static const X86Registers::RegisterID scratchRegister = X86Registers::r11; | - | ||||||||||||||||||
| 40 | #endif | - | ||||||||||||||||||
| 41 | - | |||||||||||||||||||
| 42 | static const int DoubleConditionBitInvert = 0x10; | - | ||||||||||||||||||
| 43 | static const int DoubleConditionBitSpecial = 0x20; | - | ||||||||||||||||||
| 44 | static const int DoubleConditionBits = DoubleConditionBitInvert | DoubleConditionBitSpecial; | - | ||||||||||||||||||
| 45 | - | |||||||||||||||||||
| 46 | public: | - | ||||||||||||||||||
| 47 | typedef X86Assembler::FPRegisterID FPRegisterID; | - | ||||||||||||||||||
| 48 | typedef X86Assembler::XMMRegisterID XMMRegisterID; | - | ||||||||||||||||||
| 49 | - | |||||||||||||||||||
| 50 | static bool isCompactPtrAlignedAddressOffset(ptrdiff_t value) | - | ||||||||||||||||||
| 51 | { | - | ||||||||||||||||||
| 52 | return value >= -128 && value <= 127; never executed: return value >= -128 && value <= 127; | 0 | ||||||||||||||||||
| 53 | } | - | ||||||||||||||||||
| 54 | - | |||||||||||||||||||
| 55 | enum RelationalCondition { | - | ||||||||||||||||||
| 56 | Equal = X86Assembler::ConditionE, | - | ||||||||||||||||||
| 57 | NotEqual = X86Assembler::ConditionNE, | - | ||||||||||||||||||
| 58 | Above = X86Assembler::ConditionA, | - | ||||||||||||||||||
| 59 | AboveOrEqual = X86Assembler::ConditionAE, | - | ||||||||||||||||||
| 60 | Below = X86Assembler::ConditionB, | - | ||||||||||||||||||
| 61 | BelowOrEqual = X86Assembler::ConditionBE, | - | ||||||||||||||||||
| 62 | GreaterThan = X86Assembler::ConditionG, | - | ||||||||||||||||||
| 63 | GreaterThanOrEqual = X86Assembler::ConditionGE, | - | ||||||||||||||||||
| 64 | LessThan = X86Assembler::ConditionL, | - | ||||||||||||||||||
| 65 | LessThanOrEqual = X86Assembler::ConditionLE | - | ||||||||||||||||||
| 66 | }; | - | ||||||||||||||||||
| 67 | - | |||||||||||||||||||
| 68 | enum ResultCondition { | - | ||||||||||||||||||
| 69 | Overflow = X86Assembler::ConditionO, | - | ||||||||||||||||||
| 70 | Signed = X86Assembler::ConditionS, | - | ||||||||||||||||||
| 71 | Zero = X86Assembler::ConditionE, | - | ||||||||||||||||||
| 72 | NonZero = X86Assembler::ConditionNE | - | ||||||||||||||||||
| 73 | }; | - | ||||||||||||||||||
| 74 | - | |||||||||||||||||||
| 75 | enum DoubleCondition { | - | ||||||||||||||||||
| 76 | // These conditions will only evaluate to true if the comparison is ordered - i.e. neither operand is NaN. | - | ||||||||||||||||||
| 77 | DoubleEqual = X86Assembler::ConditionE | DoubleConditionBitSpecial, | - | ||||||||||||||||||
| 78 | DoubleNotEqual = X86Assembler::ConditionNE, | - | ||||||||||||||||||
| 79 | DoubleGreaterThan = X86Assembler::ConditionA, | - | ||||||||||||||||||
| 80 | DoubleGreaterThanOrEqual = X86Assembler::ConditionAE, | - | ||||||||||||||||||
| 81 | DoubleLessThan = X86Assembler::ConditionA | DoubleConditionBitInvert, | - | ||||||||||||||||||
| 82 | DoubleLessThanOrEqual = X86Assembler::ConditionAE | DoubleConditionBitInvert, | - | ||||||||||||||||||
| 83 | // If either operand is NaN, these conditions always evaluate to true. | - | ||||||||||||||||||
| 84 | DoubleEqualOrUnordered = X86Assembler::ConditionE, | - | ||||||||||||||||||
| 85 | DoubleNotEqualOrUnordered = X86Assembler::ConditionNE | DoubleConditionBitSpecial, | - | ||||||||||||||||||
| 86 | DoubleGreaterThanOrUnordered = X86Assembler::ConditionB | DoubleConditionBitInvert, | - | ||||||||||||||||||
| 87 | DoubleGreaterThanOrEqualOrUnordered = X86Assembler::ConditionBE | DoubleConditionBitInvert, | - | ||||||||||||||||||
| 88 | DoubleLessThanOrUnordered = X86Assembler::ConditionB, | - | ||||||||||||||||||
| 89 | DoubleLessThanOrEqualOrUnordered = X86Assembler::ConditionBE, | - | ||||||||||||||||||
| 90 | }; | - | ||||||||||||||||||
| 91 | COMPILE_ASSERT( | - | ||||||||||||||||||
| 92 | !((X86Assembler::ConditionE | X86Assembler::ConditionNE | X86Assembler::ConditionA | X86Assembler::ConditionAE | X86Assembler::ConditionB | X86Assembler::ConditionBE) & DoubleConditionBits), | - | ||||||||||||||||||
| 93 | DoubleConditionBits_should_not_interfere_with_X86Assembler_Condition_codes); | - | ||||||||||||||||||
| 94 | - | |||||||||||||||||||
| 95 | static const RegisterID stackPointerRegister = X86Registers::esp; | - | ||||||||||||||||||
| 96 | - | |||||||||||||||||||
| 97 | #if ENABLE(JIT_CONSTANT_BLINDING) | - | ||||||||||||||||||
| 98 | static bool shouldBlindForSpecificArch(uint32_t value) { return value >= 0x00ffffff; } | - | ||||||||||||||||||
| 99 | #if CPU(X86_64) | - | ||||||||||||||||||
| 100 | static bool shouldBlindForSpecificArch(uint64_t value) { return value >= 0x00ffffff; } | - | ||||||||||||||||||
| 101 | #if OS(DARWIN) // On 64-bit systems other than DARWIN uint64_t and uintptr_t are the same type so overload is prohibited. | - | ||||||||||||||||||
| 102 | static bool shouldBlindForSpecificArch(uintptr_t value) { return value >= 0x00ffffff; } | - | ||||||||||||||||||
| 103 | #endif | - | ||||||||||||||||||
| 104 | #endif | - | ||||||||||||||||||
| 105 | #endif | - | ||||||||||||||||||
| 106 | - | |||||||||||||||||||
| 107 | // Integer arithmetic operations: | - | ||||||||||||||||||
| 108 | // | - | ||||||||||||||||||
| 109 | // Operations are typically two operand - operation(source, srcDst) | - | ||||||||||||||||||
| 110 | // For many operations the source may be an TrustedImm32, the srcDst operand | - | ||||||||||||||||||
| 111 | // may often be a memory location (explictly described using an Address | - | ||||||||||||||||||
| 112 | // object). | - | ||||||||||||||||||
| 113 | - | |||||||||||||||||||
| 114 | void add32(RegisterID src, RegisterID dest) | - | ||||||||||||||||||
| 115 | { | - | ||||||||||||||||||
| 116 | m_assembler.addl_rr(src, dest); | - | ||||||||||||||||||
| 117 | } executed 2130 times by 29 tests: end of blockExecuted by:
| 2130 | ||||||||||||||||||
| 118 | - | |||||||||||||||||||
| 119 | void add32(TrustedImm32 imm, Address address) | - | ||||||||||||||||||
| 120 | { | - | ||||||||||||||||||
| 121 | m_assembler.addl_im(imm.m_value, address.offset, address.base); | - | ||||||||||||||||||
| 122 | } never executed: end of block | 0 | ||||||||||||||||||
| 123 | - | |||||||||||||||||||
| 124 | void add32(TrustedImm32 imm, RegisterID dest) | - | ||||||||||||||||||
| 125 | { | - | ||||||||||||||||||
| 126 | m_assembler.addl_ir(imm.m_value, dest); | - | ||||||||||||||||||
| 127 | } executed 3358766 times by 153 tests: end of blockExecuted by:
| 3358766 | ||||||||||||||||||
| 128 | - | |||||||||||||||||||
| 129 | void add32(Address src, RegisterID dest) | - | ||||||||||||||||||
| 130 | { | - | ||||||||||||||||||
| 131 | m_assembler.addl_mr(src.offset, src.base, dest); | - | ||||||||||||||||||
| 132 | } never executed: end of block | 0 | ||||||||||||||||||
| 133 | - | |||||||||||||||||||
| 134 | void add32(RegisterID src, Address dest) | - | ||||||||||||||||||
| 135 | { | - | ||||||||||||||||||
| 136 | m_assembler.addl_rm(src, dest.offset, dest.base); | - | ||||||||||||||||||
| 137 | } never executed: end of block | 0 | ||||||||||||||||||
| 138 | - | |||||||||||||||||||
| 139 | void add32(TrustedImm32 imm, RegisterID src, RegisterID dest) | - | ||||||||||||||||||
| 140 | { | - | ||||||||||||||||||
| 141 | m_assembler.leal_mr(imm.m_value, src, dest); | - | ||||||||||||||||||
| 142 | } never executed: end of block | 0 | ||||||||||||||||||
| 143 | - | |||||||||||||||||||
| 144 | void and32(RegisterID src, RegisterID dest) | - | ||||||||||||||||||
| 145 | { | - | ||||||||||||||||||
| 146 | m_assembler.andl_rr(src, dest); | - | ||||||||||||||||||
| 147 | } never executed: end of block | 0 | ||||||||||||||||||
| 148 | - | |||||||||||||||||||
| 149 | void add32(RegisterID op1, RegisterID op2, RegisterID dest) | - | ||||||||||||||||||
| 150 | { | - | ||||||||||||||||||
| 151 | if (op2 == dest) {
| 0 | ||||||||||||||||||
| 152 | add32(op1, dest); | - | ||||||||||||||||||
| 153 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 154 | move(op1, dest); | - | ||||||||||||||||||
| 155 | add32(op2, dest); | - | ||||||||||||||||||
| 156 | } never executed: end of block | 0 | ||||||||||||||||||
| 157 | } | - | ||||||||||||||||||
| 158 | - | |||||||||||||||||||
| 159 | void and32(TrustedImm32 imm, RegisterID dest) | - | ||||||||||||||||||
| 160 | { | - | ||||||||||||||||||
| 161 | m_assembler.andl_ir(imm.m_value, dest); | - | ||||||||||||||||||
| 162 | } executed 3812 times by 38 tests: end of blockExecuted by:
| 3812 | ||||||||||||||||||
| 163 | - | |||||||||||||||||||
| 164 | void and32(RegisterID src, Address dest) | - | ||||||||||||||||||
| 165 | { | - | ||||||||||||||||||
| 166 | m_assembler.andl_rm(src, dest.offset, dest.base); | - | ||||||||||||||||||
| 167 | } never executed: end of block | 0 | ||||||||||||||||||
| 168 | - | |||||||||||||||||||
| 169 | void and32(Address src, RegisterID dest) | - | ||||||||||||||||||
| 170 | { | - | ||||||||||||||||||
| 171 | m_assembler.andl_mr(src.offset, src.base, dest); | - | ||||||||||||||||||
| 172 | } never executed: end of block | 0 | ||||||||||||||||||
| 173 | - | |||||||||||||||||||
| 174 | void and32(TrustedImm32 imm, Address address) | - | ||||||||||||||||||
| 175 | { | - | ||||||||||||||||||
| 176 | m_assembler.andl_im(imm.m_value, address.offset, address.base); | - | ||||||||||||||||||
| 177 | } never executed: end of block | 0 | ||||||||||||||||||
| 178 | - | |||||||||||||||||||
| 179 | void and32(RegisterID op1, RegisterID op2, RegisterID dest) | - | ||||||||||||||||||
| 180 | { | - | ||||||||||||||||||
| 181 | if (op1 == op2)
| 0 | ||||||||||||||||||
| 182 | zeroExtend32ToPtr(op1, dest); never executed: zeroExtend32ToPtr(op1, dest); | 0 | ||||||||||||||||||
| 183 | else if (op1 == dest)
| 0 | ||||||||||||||||||
| 184 | and32(op2, dest); never executed: and32(op2, dest); | 0 | ||||||||||||||||||
| 185 | else { | - | ||||||||||||||||||
| 186 | move(op2, dest); | - | ||||||||||||||||||
| 187 | and32(op1, dest); | - | ||||||||||||||||||
| 188 | } never executed: end of block | 0 | ||||||||||||||||||
| 189 | } | - | ||||||||||||||||||
| 190 | - | |||||||||||||||||||
| 191 | void and32(TrustedImm32 imm, RegisterID src, RegisterID dest) | - | ||||||||||||||||||
| 192 | { | - | ||||||||||||||||||
| 193 | move(src, dest); | - | ||||||||||||||||||
| 194 | and32(imm, dest); | - | ||||||||||||||||||
| 195 | } executed 3808 times by 38 tests: end of blockExecuted by:
| 3808 | ||||||||||||||||||
| 196 | - | |||||||||||||||||||
| 197 | void lshift32(RegisterID shift_amount, RegisterID dest) | - | ||||||||||||||||||
| 198 | { | - | ||||||||||||||||||
| 199 | ASSERT(shift_amount != dest); | - | ||||||||||||||||||
| 200 | - | |||||||||||||||||||
| 201 | if (shift_amount == X86Registers::ecx)
| 0 | ||||||||||||||||||
| 202 | m_assembler.shll_CLr(dest); never executed: m_assembler.shll_CLr(dest); | 0 | ||||||||||||||||||
| 203 | else { | - | ||||||||||||||||||
| 204 | // On x86 we can only shift by ecx; if asked to shift by another register we'll | - | ||||||||||||||||||
| 205 | // need rejig the shift amount into ecx first, and restore the registers afterwards. | - | ||||||||||||||||||
| 206 | // If we dest is ecx, then shift the swapped register! | - | ||||||||||||||||||
| 207 | swap(shift_amount, X86Registers::ecx); | - | ||||||||||||||||||
| 208 | m_assembler.shll_CLr(dest == X86Registers::ecx ? shift_amount : dest); | - | ||||||||||||||||||
| 209 | swap(shift_amount, X86Registers::ecx); | - | ||||||||||||||||||
| 210 | } never executed: end of block | 0 | ||||||||||||||||||
| 211 | } | - | ||||||||||||||||||
| 212 | - | |||||||||||||||||||
| 213 | void lshift32(RegisterID src, RegisterID shift_amount, RegisterID dest) | - | ||||||||||||||||||
| 214 | { | - | ||||||||||||||||||
| 215 | ASSERT(shift_amount != dest); | - | ||||||||||||||||||
| 216 | - | |||||||||||||||||||
| 217 | if (src != dest)
| 0 | ||||||||||||||||||
| 218 | move(src, dest); never executed: move(src, dest); | 0 | ||||||||||||||||||
| 219 | lshift32(shift_amount, dest); | - | ||||||||||||||||||
| 220 | } never executed: end of block | 0 | ||||||||||||||||||
| 221 | - | |||||||||||||||||||
| 222 | void lshift32(TrustedImm32 imm, RegisterID dest) | - | ||||||||||||||||||
| 223 | { | - | ||||||||||||||||||
| 224 | m_assembler.shll_i8r(imm.m_value, dest); | - | ||||||||||||||||||
| 225 | } never executed: end of block | 0 | ||||||||||||||||||
| 226 | - | |||||||||||||||||||
| 227 | void lshift32(RegisterID src, TrustedImm32 imm, RegisterID dest) | - | ||||||||||||||||||
| 228 | { | - | ||||||||||||||||||
| 229 | if (src != dest)
| 0 | ||||||||||||||||||
| 230 | move(src, dest); never executed: move(src, dest); | 0 | ||||||||||||||||||
| 231 | lshift32(imm, dest); | - | ||||||||||||||||||
| 232 | } never executed: end of block | 0 | ||||||||||||||||||
| 233 | - | |||||||||||||||||||
| 234 | void mul32(RegisterID src, RegisterID dest) | - | ||||||||||||||||||
| 235 | { | - | ||||||||||||||||||
| 236 | m_assembler.imull_rr(src, dest); | - | ||||||||||||||||||
| 237 | } executed 896 times by 13 tests: end of blockExecuted by:
| 896 | ||||||||||||||||||
| 238 | - | |||||||||||||||||||
| 239 | void mul32(RegisterID op1, RegisterID op2, RegisterID dest) | - | ||||||||||||||||||
| 240 | { | - | ||||||||||||||||||
| 241 | if (op2 == dest) {
| 0 | ||||||||||||||||||
| 242 | mul32(op1, dest); | - | ||||||||||||||||||
| 243 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 244 | move(op1, dest); | - | ||||||||||||||||||
| 245 | mul32(op2, dest); | - | ||||||||||||||||||
| 246 | } never executed: end of block | 0 | ||||||||||||||||||
| 247 | } | - | ||||||||||||||||||
| 248 | - | |||||||||||||||||||
| 249 | void mul32(Address src, RegisterID dest) | - | ||||||||||||||||||
| 250 | { | - | ||||||||||||||||||
| 251 | m_assembler.imull_mr(src.offset, src.base, dest); | - | ||||||||||||||||||
| 252 | } never executed: end of block | 0 | ||||||||||||||||||
| 253 | - | |||||||||||||||||||
| 254 | void mul32(TrustedImm32 imm, RegisterID src, RegisterID dest) | - | ||||||||||||||||||
| 255 | { | - | ||||||||||||||||||
| 256 | m_assembler.imull_i32r(src, imm.m_value, dest); | - | ||||||||||||||||||
| 257 | } never executed: end of block | 0 | ||||||||||||||||||
| 258 | - | |||||||||||||||||||
| 259 | void neg32(RegisterID srcDest) | - | ||||||||||||||||||
| 260 | { | - | ||||||||||||||||||
| 261 | m_assembler.negl_r(srcDest); | - | ||||||||||||||||||
| 262 | } never executed: end of block | 0 | ||||||||||||||||||
| 263 | - | |||||||||||||||||||
| 264 | void neg32(Address srcDest) | - | ||||||||||||||||||
| 265 | { | - | ||||||||||||||||||
| 266 | m_assembler.negl_m(srcDest.offset, srcDest.base); | - | ||||||||||||||||||
| 267 | } never executed: end of block | 0 | ||||||||||||||||||
| 268 | - | |||||||||||||||||||
| 269 | void or32(RegisterID src, RegisterID dest) | - | ||||||||||||||||||
| 270 | { | - | ||||||||||||||||||
| 271 | m_assembler.orl_rr(src, dest); | - | ||||||||||||||||||
| 272 | } executed 14 times by 1 test: end of blockExecuted by:
| 14 | ||||||||||||||||||
| 273 | - | |||||||||||||||||||
| 274 | void or32(TrustedImm32 imm, RegisterID dest) | - | ||||||||||||||||||
| 275 | { | - | ||||||||||||||||||
| 276 | m_assembler.orl_ir(imm.m_value, dest); | - | ||||||||||||||||||
| 277 | } executed 229 times by 3 tests: end of blockExecuted by:
| 229 | ||||||||||||||||||
| 278 | - | |||||||||||||||||||
| 279 | void or32(RegisterID src, Address dest) | - | ||||||||||||||||||
| 280 | { | - | ||||||||||||||||||
| 281 | m_assembler.orl_rm(src, dest.offset, dest.base); | - | ||||||||||||||||||
| 282 | } never executed: end of block | 0 | ||||||||||||||||||
| 283 | - | |||||||||||||||||||
| 284 | void or32(Address src, RegisterID dest) | - | ||||||||||||||||||
| 285 | { | - | ||||||||||||||||||
| 286 | m_assembler.orl_mr(src.offset, src.base, dest); | - | ||||||||||||||||||
| 287 | } never executed: end of block | 0 | ||||||||||||||||||
| 288 | - | |||||||||||||||||||
| 289 | void or32(TrustedImm32 imm, Address address) | - | ||||||||||||||||||
| 290 | { | - | ||||||||||||||||||
| 291 | m_assembler.orl_im(imm.m_value, address.offset, address.base); | - | ||||||||||||||||||
| 292 | } never executed: end of block | 0 | ||||||||||||||||||
| 293 | - | |||||||||||||||||||
| 294 | void or32(RegisterID op1, RegisterID op2, RegisterID dest) | - | ||||||||||||||||||
| 295 | { | - | ||||||||||||||||||
| 296 | if (op1 == op2)
| 0 | ||||||||||||||||||
| 297 | zeroExtend32ToPtr(op1, dest); never executed: zeroExtend32ToPtr(op1, dest); | 0 | ||||||||||||||||||
| 298 | else if (op1 == dest)
| 0 | ||||||||||||||||||
| 299 | or32(op2, dest); never executed: or32(op2, dest); | 0 | ||||||||||||||||||
| 300 | else { | - | ||||||||||||||||||
| 301 | move(op2, dest); | - | ||||||||||||||||||
| 302 | or32(op1, dest); | - | ||||||||||||||||||
| 303 | } never executed: end of block | 0 | ||||||||||||||||||
| 304 | } | - | ||||||||||||||||||
| 305 | - | |||||||||||||||||||
| 306 | void or32(TrustedImm32 imm, RegisterID src, RegisterID dest) | - | ||||||||||||||||||
| 307 | { | - | ||||||||||||||||||
| 308 | move(src, dest); | - | ||||||||||||||||||
| 309 | or32(imm, dest); | - | ||||||||||||||||||
| 310 | } never executed: end of block | 0 | ||||||||||||||||||
| 311 | - | |||||||||||||||||||
| 312 | void rshift32(RegisterID shift_amount, RegisterID dest) | - | ||||||||||||||||||
| 313 | { | - | ||||||||||||||||||
| 314 | ASSERT(shift_amount != dest); | - | ||||||||||||||||||
| 315 | - | |||||||||||||||||||
| 316 | if (shift_amount == X86Registers::ecx)
| 0 | ||||||||||||||||||
| 317 | m_assembler.sarl_CLr(dest); never executed: m_assembler.sarl_CLr(dest); | 0 | ||||||||||||||||||
| 318 | else { | - | ||||||||||||||||||
| 319 | // On x86 we can only shift by ecx; if asked to shift by another register we'll | - | ||||||||||||||||||
| 320 | // need rejig the shift amount into ecx first, and restore the registers afterwards. | - | ||||||||||||||||||
| 321 | // If we dest is ecx, then shift the swapped register! | - | ||||||||||||||||||
| 322 | swap(shift_amount, X86Registers::ecx); | - | ||||||||||||||||||
| 323 | m_assembler.sarl_CLr(dest == X86Registers::ecx ? shift_amount : dest); | - | ||||||||||||||||||
| 324 | swap(shift_amount, X86Registers::ecx); | - | ||||||||||||||||||
| 325 | } never executed: end of block | 0 | ||||||||||||||||||
| 326 | } | - | ||||||||||||||||||
| 327 | - | |||||||||||||||||||
| 328 | void rshift32(RegisterID src, RegisterID shift_amount, RegisterID dest) | - | ||||||||||||||||||
| 329 | { | - | ||||||||||||||||||
| 330 | ASSERT(shift_amount != dest); | - | ||||||||||||||||||
| 331 | - | |||||||||||||||||||
| 332 | if (src != dest)
| 0 | ||||||||||||||||||
| 333 | move(src, dest); never executed: move(src, dest); | 0 | ||||||||||||||||||
| 334 | rshift32(shift_amount, dest); | - | ||||||||||||||||||
| 335 | } never executed: end of block | 0 | ||||||||||||||||||
| 336 | - | |||||||||||||||||||
| 337 | void rshift32(TrustedImm32 imm, RegisterID dest) | - | ||||||||||||||||||
| 338 | { | - | ||||||||||||||||||
| 339 | m_assembler.sarl_i8r(imm.m_value, dest); | - | ||||||||||||||||||
| 340 | } never executed: end of block | 0 | ||||||||||||||||||
| 341 | - | |||||||||||||||||||
| 342 | void rshift32(RegisterID src, TrustedImm32 imm, RegisterID dest) | - | ||||||||||||||||||
| 343 | { | - | ||||||||||||||||||
| 344 | if (src != dest)
| 0 | ||||||||||||||||||
| 345 | move(src, dest); never executed: move(src, dest); | 0 | ||||||||||||||||||
| 346 | rshift32(imm, dest); | - | ||||||||||||||||||
| 347 | } never executed: end of block | 0 | ||||||||||||||||||
| 348 | - | |||||||||||||||||||
| 349 | void urshift32(RegisterID shift_amount, RegisterID dest) | - | ||||||||||||||||||
| 350 | { | - | ||||||||||||||||||
| 351 | ASSERT(shift_amount != dest); | - | ||||||||||||||||||
| 352 | - | |||||||||||||||||||
| 353 | if (shift_amount == X86Registers::ecx)
| 0 | ||||||||||||||||||
| 354 | m_assembler.shrl_CLr(dest); never executed: m_assembler.shrl_CLr(dest); | 0 | ||||||||||||||||||
| 355 | else { | - | ||||||||||||||||||
| 356 | // On x86 we can only shift by ecx; if asked to shift by another register we'll | - | ||||||||||||||||||
| 357 | // need rejig the shift amount into ecx first, and restore the registers afterwards. | - | ||||||||||||||||||
| 358 | // If we dest is ecx, then shift the swapped register! | - | ||||||||||||||||||
| 359 | swap(shift_amount, X86Registers::ecx); | - | ||||||||||||||||||
| 360 | m_assembler.shrl_CLr(dest == X86Registers::ecx ? shift_amount : dest); | - | ||||||||||||||||||
| 361 | swap(shift_amount, X86Registers::ecx); | - | ||||||||||||||||||
| 362 | } never executed: end of block | 0 | ||||||||||||||||||
| 363 | } | - | ||||||||||||||||||
| 364 | - | |||||||||||||||||||
| 365 | void urshift32(RegisterID src, RegisterID shift_amount, RegisterID dest) | - | ||||||||||||||||||
| 366 | { | - | ||||||||||||||||||
| 367 | ASSERT(shift_amount != dest); | - | ||||||||||||||||||
| 368 | - | |||||||||||||||||||
| 369 | if (src != dest)
| 0 | ||||||||||||||||||
| 370 | move(src, dest); never executed: move(src, dest); | 0 | ||||||||||||||||||
| 371 | urshift32(shift_amount, dest); | - | ||||||||||||||||||
| 372 | } never executed: end of block | 0 | ||||||||||||||||||
| 373 | - | |||||||||||||||||||
| 374 | void urshift32(TrustedImm32 imm, RegisterID dest) | - | ||||||||||||||||||
| 375 | { | - | ||||||||||||||||||
| 376 | m_assembler.shrl_i8r(imm.m_value, dest); | - | ||||||||||||||||||
| 377 | } never executed: end of block | 0 | ||||||||||||||||||
| 378 | - | |||||||||||||||||||
| 379 | void urshift32(RegisterID src, TrustedImm32 imm, RegisterID dest) | - | ||||||||||||||||||
| 380 | { | - | ||||||||||||||||||
| 381 | if (src != dest)
| 0 | ||||||||||||||||||
| 382 | move(src, dest); never executed: move(src, dest); | 0 | ||||||||||||||||||
| 383 | urshift32(imm, dest); | - | ||||||||||||||||||
| 384 | } never executed: end of block | 0 | ||||||||||||||||||
| 385 | - | |||||||||||||||||||
| 386 | void sub32(RegisterID src, RegisterID dest) | - | ||||||||||||||||||
| 387 | { | - | ||||||||||||||||||
| 388 | m_assembler.subl_rr(src, dest); | - | ||||||||||||||||||
| 389 | } executed 720 times by 22 tests: end of blockExecuted by:
| 720 | ||||||||||||||||||
| 390 | - | |||||||||||||||||||
| 391 | void sub32(TrustedImm32 imm, RegisterID dest) | - | ||||||||||||||||||
| 392 | { | - | ||||||||||||||||||
| 393 | m_assembler.subl_ir(imm.m_value, dest); | - | ||||||||||||||||||
| 394 | } executed 1057302 times by 16 tests: end of blockExecuted by:
| 1057302 | ||||||||||||||||||
| 395 | - | |||||||||||||||||||
| 396 | void sub32(TrustedImm32 imm, Address address) | - | ||||||||||||||||||
| 397 | { | - | ||||||||||||||||||
| 398 | m_assembler.subl_im(imm.m_value, address.offset, address.base); | - | ||||||||||||||||||
| 399 | } never executed: end of block | 0 | ||||||||||||||||||
| 400 | - | |||||||||||||||||||
| 401 | void sub32(Address src, RegisterID dest) | - | ||||||||||||||||||
| 402 | { | - | ||||||||||||||||||
| 403 | m_assembler.subl_mr(src.offset, src.base, dest); | - | ||||||||||||||||||
| 404 | } never executed: end of block | 0 | ||||||||||||||||||
| 405 | - | |||||||||||||||||||
| 406 | void sub32(RegisterID src, Address dest) | - | ||||||||||||||||||
| 407 | { | - | ||||||||||||||||||
| 408 | m_assembler.subl_rm(src, dest.offset, dest.base); | - | ||||||||||||||||||
| 409 | } never executed: end of block | 0 | ||||||||||||||||||
| 410 | - | |||||||||||||||||||
| 411 | void xor32(RegisterID src, RegisterID dest) | - | ||||||||||||||||||
| 412 | { | - | ||||||||||||||||||
| 413 | m_assembler.xorl_rr(src, dest); | - | ||||||||||||||||||
| 414 | } never executed: end of block | 0 | ||||||||||||||||||
| 415 | - | |||||||||||||||||||
| 416 | void xor32(TrustedImm32 imm, Address dest) | - | ||||||||||||||||||
| 417 | { | - | ||||||||||||||||||
| 418 | if (imm.m_value == -1)
| 0 | ||||||||||||||||||
| 419 | m_assembler.notl_m(dest.offset, dest.base); never executed: m_assembler.notl_m(dest.offset, dest.base); | 0 | ||||||||||||||||||
| 420 | else | - | ||||||||||||||||||
| 421 | m_assembler.xorl_im(imm.m_value, dest.offset, dest.base); never executed: m_assembler.xorl_im(imm.m_value, dest.offset, dest.base); | 0 | ||||||||||||||||||
| 422 | } | - | ||||||||||||||||||
| 423 | - | |||||||||||||||||||
| 424 | void xor32(TrustedImm32 imm, RegisterID dest) | - | ||||||||||||||||||
| 425 | { | - | ||||||||||||||||||
| 426 | if (imm.m_value == -1)
| 0-56 | ||||||||||||||||||
| 427 | m_assembler.notl_r(dest); never executed: m_assembler.notl_r(dest); | 0 | ||||||||||||||||||
| 428 | else | - | ||||||||||||||||||
| 429 | m_assembler.xorl_ir(imm.m_value, dest); executed 56 times by 6 tests: m_assembler.xorl_ir(imm.m_value, dest);Executed by:
| 56 | ||||||||||||||||||
| 430 | } | - | ||||||||||||||||||
| 431 | - | |||||||||||||||||||
| 432 | void xor32(RegisterID src, Address dest) | - | ||||||||||||||||||
| 433 | { | - | ||||||||||||||||||
| 434 | m_assembler.xorl_rm(src, dest.offset, dest.base); | - | ||||||||||||||||||
| 435 | } never executed: end of block | 0 | ||||||||||||||||||
| 436 | - | |||||||||||||||||||
| 437 | void xor32(Address src, RegisterID dest) | - | ||||||||||||||||||
| 438 | { | - | ||||||||||||||||||
| 439 | m_assembler.xorl_mr(src.offset, src.base, dest); | - | ||||||||||||||||||
| 440 | } never executed: end of block | 0 | ||||||||||||||||||
| 441 | - | |||||||||||||||||||
| 442 | void xor32(RegisterID op1, RegisterID op2, RegisterID dest) | - | ||||||||||||||||||
| 443 | { | - | ||||||||||||||||||
| 444 | if (op1 == op2)
| 0 | ||||||||||||||||||
| 445 | move(TrustedImm32(0), dest); never executed: move(TrustedImm32(0), dest); | 0 | ||||||||||||||||||
| 446 | else if (op1 == dest)
| 0 | ||||||||||||||||||
| 447 | xor32(op2, dest); never executed: xor32(op2, dest); | 0 | ||||||||||||||||||
| 448 | else { | - | ||||||||||||||||||
| 449 | move(op2, dest); | - | ||||||||||||||||||
| 450 | xor32(op1, dest); | - | ||||||||||||||||||
| 451 | } never executed: end of block | 0 | ||||||||||||||||||
| 452 | } | - | ||||||||||||||||||
| 453 | - | |||||||||||||||||||
| 454 | void xor32(TrustedImm32 imm, RegisterID src, RegisterID dest) | - | ||||||||||||||||||
| 455 | { | - | ||||||||||||||||||
| 456 | move(src, dest); | - | ||||||||||||||||||
| 457 | xor32(imm, dest); | - | ||||||||||||||||||
| 458 | } never executed: end of block | 0 | ||||||||||||||||||
| 459 | - | |||||||||||||||||||
| 460 | void sqrtDouble(FPRegisterID src, FPRegisterID dst) | - | ||||||||||||||||||
| 461 | { | - | ||||||||||||||||||
| 462 | m_assembler.sqrtsd_rr(src, dst); | - | ||||||||||||||||||
| 463 | } never executed: end of block | 0 | ||||||||||||||||||
| 464 | - | |||||||||||||||||||
| 465 | void absDouble(FPRegisterID src, FPRegisterID dst) | - | ||||||||||||||||||
| 466 | { | - | ||||||||||||||||||
| 467 | ASSERT(src != dst); | - | ||||||||||||||||||
| 468 | static const double negativeZeroConstant = -0.0; | - | ||||||||||||||||||
| 469 | loadDouble(&negativeZeroConstant, dst); | - | ||||||||||||||||||
| 470 | m_assembler.andnpd_rr(src, dst); | - | ||||||||||||||||||
| 471 | } never executed: end of block | 0 | ||||||||||||||||||
| 472 | - | |||||||||||||||||||
| 473 | void negateDouble(FPRegisterID src, FPRegisterID dst) | - | ||||||||||||||||||
| 474 | { | - | ||||||||||||||||||
| 475 | ASSERT(src != dst); | - | ||||||||||||||||||
| 476 | static const double negativeZeroConstant = -0.0; | - | ||||||||||||||||||
| 477 | loadDouble(&negativeZeroConstant, dst); | - | ||||||||||||||||||
| 478 | m_assembler.xorpd_rr(src, dst); | - | ||||||||||||||||||
| 479 | } never executed: end of block | 0 | ||||||||||||||||||
| 480 | - | |||||||||||||||||||
| 481 | - | |||||||||||||||||||
| 482 | // Memory access operations: | - | ||||||||||||||||||
| 483 | // | - | ||||||||||||||||||
| 484 | // Loads are of the form load(address, destination) and stores of the form | - | ||||||||||||||||||
| 485 | // store(source, address). The source for a store may be an TrustedImm32. Address | - | ||||||||||||||||||
| 486 | // operand objects to loads and store will be implicitly constructed if a | - | ||||||||||||||||||
| 487 | // register is passed. | - | ||||||||||||||||||
| 488 | - | |||||||||||||||||||
| 489 | void load32(ImplicitAddress address, RegisterID dest) | - | ||||||||||||||||||
| 490 | { | - | ||||||||||||||||||
| 491 | m_assembler.movl_mr(address.offset, address.base, dest); | - | ||||||||||||||||||
| 492 | } executed 1244 times by 13 tests: end of blockExecuted by:
| 1244 | ||||||||||||||||||
| 493 | - | |||||||||||||||||||
| 494 | void load32(BaseIndex address, RegisterID dest) | - | ||||||||||||||||||
| 495 | { | - | ||||||||||||||||||
| 496 | m_assembler.movl_mr(address.offset, address.base, address.index, address.scale, dest); | - | ||||||||||||||||||
| 497 | } executed 788658 times by 5 tests: end of blockExecuted by:
| 788658 | ||||||||||||||||||
| 498 | - | |||||||||||||||||||
| 499 | void load32WithUnalignedHalfWords(BaseIndex address, RegisterID dest) | - | ||||||||||||||||||
| 500 | { | - | ||||||||||||||||||
| 501 | load32(address, dest); | - | ||||||||||||||||||
| 502 | } executed 789288 times by 5 tests: end of blockExecuted by:
| 789288 | ||||||||||||||||||
| 503 | - | |||||||||||||||||||
| 504 | void load16Unaligned(BaseIndex address, RegisterID dest) | - | ||||||||||||||||||
| 505 | { | - | ||||||||||||||||||
| 506 | load16(address, dest); | - | ||||||||||||||||||
| 507 | } never executed: end of block | 0 | ||||||||||||||||||
| 508 | - | |||||||||||||||||||
| 509 | DataLabel32 load32WithAddressOffsetPatch(Address address, RegisterID dest) | - | ||||||||||||||||||
| 510 | { | - | ||||||||||||||||||
| 511 | padBeforePatch(); | - | ||||||||||||||||||
| 512 | m_assembler.movl_mr_disp32(address.offset, address.base, dest); | - | ||||||||||||||||||
| 513 | return DataLabel32(this); never executed: return DataLabel32(this); | 0 | ||||||||||||||||||
| 514 | } | - | ||||||||||||||||||
| 515 | - | |||||||||||||||||||
| 516 | DataLabelCompact load32WithCompactAddressOffsetPatch(Address address, RegisterID dest) | - | ||||||||||||||||||
| 517 | { | - | ||||||||||||||||||
| 518 | padBeforePatch(); | - | ||||||||||||||||||
| 519 | m_assembler.movl_mr_disp8(address.offset, address.base, dest); | - | ||||||||||||||||||
| 520 | return DataLabelCompact(this); never executed: return DataLabelCompact(this); | 0 | ||||||||||||||||||
| 521 | } | - | ||||||||||||||||||
| 522 | - | |||||||||||||||||||
| 523 | static void repatchCompact(CodeLocationDataLabelCompact dataLabelCompact, int32_t value) | - | ||||||||||||||||||
| 524 | { | - | ||||||||||||||||||
| 525 | ASSERT(isCompactPtrAlignedAddressOffset(value)); | - | ||||||||||||||||||
| 526 | AssemblerType_T::repatchCompact(dataLabelCompact.dataLocation(), value); | - | ||||||||||||||||||
| 527 | } never executed: end of block | 0 | ||||||||||||||||||
| 528 | - | |||||||||||||||||||
| 529 | DataLabelCompact loadCompactWithAddressOffsetPatch(Address address, RegisterID dest) | - | ||||||||||||||||||
| 530 | { | - | ||||||||||||||||||
| 531 | padBeforePatch(); | - | ||||||||||||||||||
| 532 | m_assembler.movl_mr_disp8(address.offset, address.base, dest); | - | ||||||||||||||||||
| 533 | return DataLabelCompact(this); never executed: return DataLabelCompact(this); | 0 | ||||||||||||||||||
| 534 | } | - | ||||||||||||||||||
| 535 | - | |||||||||||||||||||
| 536 | void load8(BaseIndex address, RegisterID dest) | - | ||||||||||||||||||
| 537 | { | - | ||||||||||||||||||
| 538 | m_assembler.movzbl_mr(address.offset, address.base, address.index, address.scale, dest); | - | ||||||||||||||||||
| 539 | } never executed: end of block | 0 | ||||||||||||||||||
| 540 | - | |||||||||||||||||||
| 541 | void load8(ImplicitAddress address, RegisterID dest) | - | ||||||||||||||||||
| 542 | { | - | ||||||||||||||||||
| 543 | m_assembler.movzbl_mr(address.offset, address.base, dest); | - | ||||||||||||||||||
| 544 | } never executed: end of block | 0 | ||||||||||||||||||
| 545 | - | |||||||||||||||||||
| 546 | void load8Signed(BaseIndex address, RegisterID dest) | - | ||||||||||||||||||
| 547 | { | - | ||||||||||||||||||
| 548 | m_assembler.movsbl_mr(address.offset, address.base, address.index, address.scale, dest); | - | ||||||||||||||||||
| 549 | } never executed: end of block | 0 | ||||||||||||||||||
| 550 | - | |||||||||||||||||||
| 551 | void load8Signed(ImplicitAddress address, RegisterID dest) | - | ||||||||||||||||||
| 552 | { | - | ||||||||||||||||||
| 553 | m_assembler.movsbl_mr(address.offset, address.base, dest); | - | ||||||||||||||||||
| 554 | } never executed: end of block | 0 | ||||||||||||||||||
| 555 | - | |||||||||||||||||||
| 556 | void load16(BaseIndex address, RegisterID dest) | - | ||||||||||||||||||
| 557 | { | - | ||||||||||||||||||
| 558 | m_assembler.movzwl_mr(address.offset, address.base, address.index, address.scale, dest); | - | ||||||||||||||||||
| 559 | } executed 796989 times by 9 tests: end of blockExecuted by:
| 796989 | ||||||||||||||||||
| 560 | - | |||||||||||||||||||
| 561 | void load16(Address address, RegisterID dest) | - | ||||||||||||||||||
| 562 | { | - | ||||||||||||||||||
| 563 | m_assembler.movzwl_mr(address.offset, address.base, dest); | - | ||||||||||||||||||
| 564 | } never executed: end of block | 0 | ||||||||||||||||||
| 565 | - | |||||||||||||||||||
| 566 | void load16Signed(BaseIndex address, RegisterID dest) | - | ||||||||||||||||||
| 567 | { | - | ||||||||||||||||||
| 568 | m_assembler.movswl_mr(address.offset, address.base, address.index, address.scale, dest); | - | ||||||||||||||||||
| 569 | } never executed: end of block | 0 | ||||||||||||||||||
| 570 | - | |||||||||||||||||||
| 571 | void load16Signed(Address address, RegisterID dest) | - | ||||||||||||||||||
| 572 | { | - | ||||||||||||||||||
| 573 | m_assembler.movswl_mr(address.offset, address.base, dest); | - | ||||||||||||||||||
| 574 | } never executed: end of block | 0 | ||||||||||||||||||
| 575 | - | |||||||||||||||||||
| 576 | DataLabel32 store32WithAddressOffsetPatch(RegisterID src, Address address) | - | ||||||||||||||||||
| 577 | { | - | ||||||||||||||||||
| 578 | padBeforePatch(); | - | ||||||||||||||||||
| 579 | m_assembler.movl_rm_disp32(src, address.offset, address.base); | - | ||||||||||||||||||
| 580 | return DataLabel32(this); never executed: return DataLabel32(this); | 0 | ||||||||||||||||||
| 581 | } | - | ||||||||||||||||||
| 582 | - | |||||||||||||||||||
| 583 | void store32(RegisterID src, ImplicitAddress address) | - | ||||||||||||||||||
| 584 | { | - | ||||||||||||||||||
| 585 | m_assembler.movl_rm(src, address.offset, address.base); | - | ||||||||||||||||||
| 586 | } executed 2307046 times by 153 tests: end of blockExecuted by:
| 2307046 | ||||||||||||||||||
| 587 | - | |||||||||||||||||||
| 588 | void store32(RegisterID src, BaseIndex address) | - | ||||||||||||||||||
| 589 | { | - | ||||||||||||||||||
| 590 | m_assembler.movl_rm(src, address.offset, address.base, address.index, address.scale); | - | ||||||||||||||||||
| 591 | } never executed: end of block | 0 | ||||||||||||||||||
| 592 | - | |||||||||||||||||||
| 593 | void store32(TrustedImm32 imm, ImplicitAddress address) | - | ||||||||||||||||||
| 594 | { | - | ||||||||||||||||||
| 595 | m_assembler.movl_i32m(imm.m_value, address.offset, address.base); | - | ||||||||||||||||||
| 596 | } executed 1197378 times by 153 tests: end of blockExecuted by:
| 1197378 | ||||||||||||||||||
| 597 | - | |||||||||||||||||||
| 598 | void store32(TrustedImm32 imm, BaseIndex address) | - | ||||||||||||||||||
| 599 | { | - | ||||||||||||||||||
| 600 | m_assembler.movl_i32m(imm.m_value, address.offset, address.base, address.index, address.scale); | - | ||||||||||||||||||
| 601 | } never executed: end of block | 0 | ||||||||||||||||||
| 602 | - | |||||||||||||||||||
| 603 | void store8(TrustedImm32 imm, Address address) | - | ||||||||||||||||||
| 604 | { | - | ||||||||||||||||||
| 605 | ASSERT(-128 <= imm.m_value && imm.m_value < 128); | - | ||||||||||||||||||
| 606 | m_assembler.movb_i8m(imm.m_value, address.offset, address.base); | - | ||||||||||||||||||
| 607 | } never executed: end of block | 0 | ||||||||||||||||||
| 608 | - | |||||||||||||||||||
| 609 | void store8(TrustedImm32 imm, BaseIndex address) | - | ||||||||||||||||||
| 610 | { | - | ||||||||||||||||||
| 611 | ASSERT(-128 <= imm.m_value && imm.m_value < 128); | - | ||||||||||||||||||
| 612 | m_assembler.movb_i8m(imm.m_value, address.offset, address.base, address.index, address.scale); | - | ||||||||||||||||||
| 613 | } never executed: end of block | 0 | ||||||||||||||||||
| 614 | - | |||||||||||||||||||
| 615 | void store8(RegisterID src, BaseIndex address) | - | ||||||||||||||||||
| 616 | { | - | ||||||||||||||||||
| 617 | #if CPU(X86) | - | ||||||||||||||||||
| 618 | // On 32-bit x86 we can only store from the first 4 registers; | - | ||||||||||||||||||
| 619 | // esp..edi are mapped to the 'h' registers! | - | ||||||||||||||||||
| 620 | if (src >= 4) { | - | ||||||||||||||||||
| 621 | // Pick a temporary register. | - | ||||||||||||||||||
| 622 | RegisterID temp; | - | ||||||||||||||||||
| 623 | if (address.base != X86Registers::eax && address.index != X86Registers::eax) | - | ||||||||||||||||||
| 624 | temp = X86Registers::eax; | - | ||||||||||||||||||
| 625 | else if (address.base != X86Registers::ebx && address.index != X86Registers::ebx) | - | ||||||||||||||||||
| 626 | temp = X86Registers::ebx; | - | ||||||||||||||||||
| 627 | else { | - | ||||||||||||||||||
| 628 | ASSERT(address.base != X86Registers::ecx && address.index != X86Registers::ecx); | - | ||||||||||||||||||
| 629 | temp = X86Registers::ecx; | - | ||||||||||||||||||
| 630 | } | - | ||||||||||||||||||
| 631 | - | |||||||||||||||||||
| 632 | // Swap to the temporary register to perform the store. | - | ||||||||||||||||||
| 633 | swap(src, temp); | - | ||||||||||||||||||
| 634 | m_assembler.movb_rm(temp, address.offset, address.base, address.index, address.scale); | - | ||||||||||||||||||
| 635 | swap(src, temp); | - | ||||||||||||||||||
| 636 | return; | - | ||||||||||||||||||
| 637 | } | - | ||||||||||||||||||
| 638 | #endif | - | ||||||||||||||||||
| 639 | m_assembler.movb_rm(src, address.offset, address.base, address.index, address.scale); | - | ||||||||||||||||||
| 640 | } never executed: end of block | 0 | ||||||||||||||||||
| 641 | - | |||||||||||||||||||
| 642 | void store16(RegisterID src, BaseIndex address) | - | ||||||||||||||||||
| 643 | { | - | ||||||||||||||||||
| 644 | #if CPU(X86) | - | ||||||||||||||||||
| 645 | // On 32-bit x86 we can only store from the first 4 registers; | - | ||||||||||||||||||
| 646 | // esp..edi are mapped to the 'h' registers! | - | ||||||||||||||||||
| 647 | if (src >= 4) { | - | ||||||||||||||||||
| 648 | // Pick a temporary register. | - | ||||||||||||||||||
| 649 | RegisterID temp; | - | ||||||||||||||||||
| 650 | if (address.base != X86Registers::eax && address.index != X86Registers::eax) | - | ||||||||||||||||||
| 651 | temp = X86Registers::eax; | - | ||||||||||||||||||
| 652 | else if (address.base != X86Registers::ebx && address.index != X86Registers::ebx) | - | ||||||||||||||||||
| 653 | temp = X86Registers::ebx; | - | ||||||||||||||||||
| 654 | else { | - | ||||||||||||||||||
| 655 | ASSERT(address.base != X86Registers::ecx && address.index != X86Registers::ecx); | - | ||||||||||||||||||
| 656 | temp = X86Registers::ecx; | - | ||||||||||||||||||
| 657 | } | - | ||||||||||||||||||
| 658 | - | |||||||||||||||||||
| 659 | // Swap to the temporary register to perform the store. | - | ||||||||||||||||||
| 660 | swap(src, temp); | - | ||||||||||||||||||
| 661 | m_assembler.movw_rm(temp, address.offset, address.base, address.index, address.scale); | - | ||||||||||||||||||
| 662 | swap(src, temp); | - | ||||||||||||||||||
| 663 | return; | - | ||||||||||||||||||
| 664 | } | - | ||||||||||||||||||
| 665 | #endif | - | ||||||||||||||||||
| 666 | m_assembler.movw_rm(src, address.offset, address.base, address.index, address.scale); | - | ||||||||||||||||||
| 667 | } never executed: end of block | 0 | ||||||||||||||||||
| 668 | - | |||||||||||||||||||
| 669 | - | |||||||||||||||||||
| 670 | // Floating-point operation: | - | ||||||||||||||||||
| 671 | // | - | ||||||||||||||||||
| 672 | // Presently only supports SSE, not x87 floating point. | - | ||||||||||||||||||
| 673 | - | |||||||||||||||||||
| 674 | void moveDouble(FPRegisterID src, FPRegisterID dest) | - | ||||||||||||||||||
| 675 | { | - | ||||||||||||||||||
| 676 | ASSERT(isSSE2Present()); | - | ||||||||||||||||||
| 677 | if (src != dest)
| 0 | ||||||||||||||||||
| 678 | m_assembler.movsd_rr(src, dest); never executed: m_assembler.movsd_rr(src, dest); | 0 | ||||||||||||||||||
| 679 | } never executed: end of block | 0 | ||||||||||||||||||
| 680 | - | |||||||||||||||||||
| 681 | void loadDouble(const void* address, FPRegisterID dest) | - | ||||||||||||||||||
| 682 | { | - | ||||||||||||||||||
| 683 | #if CPU(X86) | - | ||||||||||||||||||
| 684 | ASSERT(isSSE2Present()); | - | ||||||||||||||||||
| 685 | m_assembler.movsd_mr(address, dest); | - | ||||||||||||||||||
| 686 | #else | - | ||||||||||||||||||
| 687 | move(TrustedImmPtr(address), scratchRegister); | - | ||||||||||||||||||
| 688 | loadDouble(scratchRegister, dest); | - | ||||||||||||||||||
| 689 | #endif | - | ||||||||||||||||||
| 690 | } never executed: end of block | 0 | ||||||||||||||||||
| 691 | - | |||||||||||||||||||
| 692 | void loadDouble(ImplicitAddress address, FPRegisterID dest) | - | ||||||||||||||||||
| 693 | { | - | ||||||||||||||||||
| 694 | ASSERT(isSSE2Present()); | - | ||||||||||||||||||
| 695 | m_assembler.movsd_mr(address.offset, address.base, dest); | - | ||||||||||||||||||
| 696 | } never executed: end of block | 0 | ||||||||||||||||||
| 697 | - | |||||||||||||||||||
| 698 | void loadDouble(BaseIndex address, FPRegisterID dest) | - | ||||||||||||||||||
| 699 | { | - | ||||||||||||||||||
| 700 | ASSERT(isSSE2Present()); | - | ||||||||||||||||||
| 701 | m_assembler.movsd_mr(address.offset, address.base, address.index, address.scale, dest); | - | ||||||||||||||||||
| 702 | } never executed: end of block | 0 | ||||||||||||||||||
| 703 | void loadFloat(BaseIndex address, FPRegisterID dest) | - | ||||||||||||||||||
| 704 | { | - | ||||||||||||||||||
| 705 | ASSERT(isSSE2Present()); | - | ||||||||||||||||||
| 706 | m_assembler.movss_mr(address.offset, address.base, address.index, address.scale, dest); | - | ||||||||||||||||||
| 707 | } never executed: end of block | 0 | ||||||||||||||||||
| 708 | - | |||||||||||||||||||
| 709 | void storeDouble(FPRegisterID src, ImplicitAddress address) | - | ||||||||||||||||||
| 710 | { | - | ||||||||||||||||||
| 711 | ASSERT(isSSE2Present()); | - | ||||||||||||||||||
| 712 | m_assembler.movsd_rm(src, address.offset, address.base); | - | ||||||||||||||||||
| 713 | } never executed: end of block | 0 | ||||||||||||||||||
| 714 | - | |||||||||||||||||||
| 715 | void storeDouble(FPRegisterID src, BaseIndex address) | - | ||||||||||||||||||
| 716 | { | - | ||||||||||||||||||
| 717 | ASSERT(isSSE2Present()); | - | ||||||||||||||||||
| 718 | m_assembler.movsd_rm(src, address.offset, address.base, address.index, address.scale); | - | ||||||||||||||||||
| 719 | } never executed: end of block | 0 | ||||||||||||||||||
| 720 | - | |||||||||||||||||||
| 721 | void storeFloat(FPRegisterID src, BaseIndex address) | - | ||||||||||||||||||
| 722 | { | - | ||||||||||||||||||
| 723 | ASSERT(isSSE2Present()); | - | ||||||||||||||||||
| 724 | m_assembler.movss_rm(src, address.offset, address.base, address.index, address.scale); | - | ||||||||||||||||||
| 725 | } never executed: end of block | 0 | ||||||||||||||||||
| 726 | - | |||||||||||||||||||
| 727 | void convertDoubleToFloat(FPRegisterID src, FPRegisterID dst) | - | ||||||||||||||||||
| 728 | { | - | ||||||||||||||||||
| 729 | ASSERT(isSSE2Present()); | - | ||||||||||||||||||
| 730 | m_assembler.cvtsd2ss_rr(src, dst); | - | ||||||||||||||||||
| 731 | } never executed: end of block | 0 | ||||||||||||||||||
| 732 | - | |||||||||||||||||||
| 733 | void convertFloatToDouble(FPRegisterID src, FPRegisterID dst) | - | ||||||||||||||||||
| 734 | { | - | ||||||||||||||||||
| 735 | ASSERT(isSSE2Present()); | - | ||||||||||||||||||
| 736 | m_assembler.cvtss2sd_rr(src, dst); | - | ||||||||||||||||||
| 737 | } never executed: end of block | 0 | ||||||||||||||||||
| 738 | - | |||||||||||||||||||
| 739 | void addDouble(FPRegisterID src, FPRegisterID dest) | - | ||||||||||||||||||
| 740 | { | - | ||||||||||||||||||
| 741 | ASSERT(isSSE2Present()); | - | ||||||||||||||||||
| 742 | m_assembler.addsd_rr(src, dest); | - | ||||||||||||||||||
| 743 | } never executed: end of block | 0 | ||||||||||||||||||
| 744 | - | |||||||||||||||||||
| 745 | void addDouble(FPRegisterID op1, FPRegisterID op2, FPRegisterID dest) | - | ||||||||||||||||||
| 746 | { | - | ||||||||||||||||||
| 747 | ASSERT(isSSE2Present()); | - | ||||||||||||||||||
| 748 | if (op1 == dest)
| 0 | ||||||||||||||||||
| 749 | addDouble(op2, dest); never executed: addDouble(op2, dest); | 0 | ||||||||||||||||||
| 750 | else { | - | ||||||||||||||||||
| 751 | moveDouble(op2, dest); | - | ||||||||||||||||||
| 752 | addDouble(op1, dest); | - | ||||||||||||||||||
| 753 | } never executed: end of block | 0 | ||||||||||||||||||
| 754 | } | - | ||||||||||||||||||
| 755 | - | |||||||||||||||||||
| 756 | void addDouble(Address src, FPRegisterID dest) | - | ||||||||||||||||||
| 757 | { | - | ||||||||||||||||||
| 758 | ASSERT(isSSE2Present()); | - | ||||||||||||||||||
| 759 | m_assembler.addsd_mr(src.offset, src.base, dest); | - | ||||||||||||||||||
| 760 | } never executed: end of block | 0 | ||||||||||||||||||
| 761 | - | |||||||||||||||||||
| 762 | void divDouble(FPRegisterID src, FPRegisterID dest) | - | ||||||||||||||||||
| 763 | { | - | ||||||||||||||||||
| 764 | ASSERT(isSSE2Present()); | - | ||||||||||||||||||
| 765 | m_assembler.divsd_rr(src, dest); | - | ||||||||||||||||||
| 766 | } never executed: end of block | 0 | ||||||||||||||||||
| 767 | - | |||||||||||||||||||
| 768 | void divDouble(FPRegisterID op1, FPRegisterID op2, FPRegisterID dest) | - | ||||||||||||||||||
| 769 | { | - | ||||||||||||||||||
| 770 | // B := A / B is invalid. | - | ||||||||||||||||||
| 771 | ASSERT(op1 == dest || op2 != dest); | - | ||||||||||||||||||
| 772 | - | |||||||||||||||||||
| 773 | moveDouble(op1, dest); | - | ||||||||||||||||||
| 774 | divDouble(op2, dest); | - | ||||||||||||||||||
| 775 | } never executed: end of block | 0 | ||||||||||||||||||
| 776 | - | |||||||||||||||||||
| 777 | void divDouble(Address src, FPRegisterID dest) | - | ||||||||||||||||||
| 778 | { | - | ||||||||||||||||||
| 779 | ASSERT(isSSE2Present()); | - | ||||||||||||||||||
| 780 | m_assembler.divsd_mr(src.offset, src.base, dest); | - | ||||||||||||||||||
| 781 | } never executed: end of block | 0 | ||||||||||||||||||
| 782 | - | |||||||||||||||||||
| 783 | void subDouble(FPRegisterID src, FPRegisterID dest) | - | ||||||||||||||||||
| 784 | { | - | ||||||||||||||||||
| 785 | ASSERT(isSSE2Present()); | - | ||||||||||||||||||
| 786 | m_assembler.subsd_rr(src, dest); | - | ||||||||||||||||||
| 787 | } never executed: end of block | 0 | ||||||||||||||||||
| 788 | - | |||||||||||||||||||
| 789 | void subDouble(FPRegisterID op1, FPRegisterID op2, FPRegisterID dest) | - | ||||||||||||||||||
| 790 | { | - | ||||||||||||||||||
| 791 | // B := A - B is invalid. | - | ||||||||||||||||||
| 792 | ASSERT(op1 == dest || op2 != dest); | - | ||||||||||||||||||
| 793 | - | |||||||||||||||||||
| 794 | moveDouble(op1, dest); | - | ||||||||||||||||||
| 795 | subDouble(op2, dest); | - | ||||||||||||||||||
| 796 | } never executed: end of block | 0 | ||||||||||||||||||
| 797 | - | |||||||||||||||||||
| 798 | void subDouble(Address src, FPRegisterID dest) | - | ||||||||||||||||||
| 799 | { | - | ||||||||||||||||||
| 800 | ASSERT(isSSE2Present()); | - | ||||||||||||||||||
| 801 | m_assembler.subsd_mr(src.offset, src.base, dest); | - | ||||||||||||||||||
| 802 | } never executed: end of block | 0 | ||||||||||||||||||
| 803 | - | |||||||||||||||||||
| 804 | void mulDouble(FPRegisterID src, FPRegisterID dest) | - | ||||||||||||||||||
| 805 | { | - | ||||||||||||||||||
| 806 | ASSERT(isSSE2Present()); | - | ||||||||||||||||||
| 807 | m_assembler.mulsd_rr(src, dest); | - | ||||||||||||||||||
| 808 | } never executed: end of block | 0 | ||||||||||||||||||
| 809 | - | |||||||||||||||||||
| 810 | void mulDouble(FPRegisterID op1, FPRegisterID op2, FPRegisterID dest) | - | ||||||||||||||||||
| 811 | { | - | ||||||||||||||||||
| 812 | ASSERT(isSSE2Present()); | - | ||||||||||||||||||
| 813 | if (op1 == dest)
| 0 | ||||||||||||||||||
| 814 | mulDouble(op2, dest); never executed: mulDouble(op2, dest); | 0 | ||||||||||||||||||
| 815 | else { | - | ||||||||||||||||||
| 816 | moveDouble(op2, dest); | - | ||||||||||||||||||
| 817 | mulDouble(op1, dest); | - | ||||||||||||||||||
| 818 | } never executed: end of block | 0 | ||||||||||||||||||
| 819 | } | - | ||||||||||||||||||
| 820 | - | |||||||||||||||||||
| 821 | void mulDouble(Address src, FPRegisterID dest) | - | ||||||||||||||||||
| 822 | { | - | ||||||||||||||||||
| 823 | ASSERT(isSSE2Present()); | - | ||||||||||||||||||
| 824 | m_assembler.mulsd_mr(src.offset, src.base, dest); | - | ||||||||||||||||||
| 825 | } never executed: end of block | 0 | ||||||||||||||||||
| 826 | - | |||||||||||||||||||
| 827 | void convertInt32ToDouble(RegisterID src, FPRegisterID dest) | - | ||||||||||||||||||
| 828 | { | - | ||||||||||||||||||
| 829 | ASSERT(isSSE2Present()); | - | ||||||||||||||||||
| 830 | m_assembler.cvtsi2sd_rr(src, dest); | - | ||||||||||||||||||
| 831 | } never executed: end of block | 0 | ||||||||||||||||||
| 832 | - | |||||||||||||||||||
| 833 | void convertInt32ToDouble(Address src, FPRegisterID dest) | - | ||||||||||||||||||
| 834 | { | - | ||||||||||||||||||
| 835 | ASSERT(isSSE2Present()); | - | ||||||||||||||||||
| 836 | m_assembler.cvtsi2sd_mr(src.offset, src.base, dest); | - | ||||||||||||||||||
| 837 | } never executed: end of block | 0 | ||||||||||||||||||
| 838 | - | |||||||||||||||||||
| 839 | Jump branchDouble(DoubleCondition cond, FPRegisterID left, FPRegisterID right) | - | ||||||||||||||||||
| 840 | { | - | ||||||||||||||||||
| 841 | ASSERT(isSSE2Present()); | - | ||||||||||||||||||
| 842 | - | |||||||||||||||||||
| 843 | if (cond & DoubleConditionBitInvert)
| 0 | ||||||||||||||||||
| 844 | m_assembler.ucomisd_rr(left, right); never executed: m_assembler.ucomisd_rr(left, right); | 0 | ||||||||||||||||||
| 845 | else | - | ||||||||||||||||||
| 846 | m_assembler.ucomisd_rr(right, left); never executed: m_assembler.ucomisd_rr(right, left); | 0 | ||||||||||||||||||
| 847 | - | |||||||||||||||||||
| 848 | if (cond == DoubleEqual) {
| 0 | ||||||||||||||||||
| 849 | if (left == right)
| 0 | ||||||||||||||||||
| 850 | return Jump(m_assembler.jnp()); never executed: return Jump(m_assembler.jnp()); | 0 | ||||||||||||||||||
| 851 | Jump isUnordered(m_assembler.jp()); | - | ||||||||||||||||||
| 852 | Jump result = Jump(m_assembler.je()); | - | ||||||||||||||||||
| 853 | isUnordered.link(this); | - | ||||||||||||||||||
| 854 | return result; never executed: return result; | 0 | ||||||||||||||||||
| 855 | } else if (cond == DoubleNotEqualOrUnordered) {
| 0 | ||||||||||||||||||
| 856 | if (left == right)
| 0 | ||||||||||||||||||
| 857 | return Jump(m_assembler.jp()); never executed: return Jump(m_assembler.jp()); | 0 | ||||||||||||||||||
| 858 | Jump isUnordered(m_assembler.jp()); | - | ||||||||||||||||||
| 859 | Jump isEqual(m_assembler.je()); | - | ||||||||||||||||||
| 860 | isUnordered.link(this); | - | ||||||||||||||||||
| 861 | Jump result = jump(); | - | ||||||||||||||||||
| 862 | isEqual.link(this); | - | ||||||||||||||||||
| 863 | return result; never executed: return result; | 0 | ||||||||||||||||||
| 864 | } | - | ||||||||||||||||||
| 865 | - | |||||||||||||||||||
| 866 | ASSERT(!(cond & DoubleConditionBitSpecial)); | - | ||||||||||||||||||
| 867 | return Jump(m_assembler.jCC(static_cast<X86Assembler::Condition>(cond & ~DoubleConditionBits))); never executed: return Jump(m_assembler.jCC(static_cast<X86Assembler::Condition>(cond & ~DoubleConditionBits))); | 0 | ||||||||||||||||||
| 868 | } | - | ||||||||||||||||||
| 869 | - | |||||||||||||||||||
| 870 | // Truncates 'src' to an integer, and places the resulting 'dest'. | - | ||||||||||||||||||
| 871 | // If the result is not representable as a 32 bit value, branch. | - | ||||||||||||||||||
| 872 | // May also branch for some values that are representable in 32 bits | - | ||||||||||||||||||
| 873 | // (specifically, in this case, INT_MIN). | - | ||||||||||||||||||
| 874 | enum BranchTruncateType { BranchIfTruncateFailed, BranchIfTruncateSuccessful }; | - | ||||||||||||||||||
| 875 | Jump branchTruncateDoubleToInt32(FPRegisterID src, RegisterID dest, BranchTruncateType branchType = BranchIfTruncateFailed) | - | ||||||||||||||||||
| 876 | { | - | ||||||||||||||||||
| 877 | ASSERT(isSSE2Present()); | - | ||||||||||||||||||
| 878 | m_assembler.cvttsd2si_rr(src, dest); | - | ||||||||||||||||||
| 879 | return branch32(branchType ? NotEqual : Equal, dest, TrustedImm32(0x80000000)); never executed: return branch32(branchType ? NotEqual : Equal, dest, TrustedImm32(0x80000000)); | 0 | ||||||||||||||||||
| 880 | } | - | ||||||||||||||||||
| 881 | - | |||||||||||||||||||
| 882 | Jump branchTruncateDoubleToUint32(FPRegisterID src, RegisterID dest, BranchTruncateType branchType = BranchIfTruncateFailed) | - | ||||||||||||||||||
| 883 | { | - | ||||||||||||||||||
| 884 | ASSERT(isSSE2Present()); | - | ||||||||||||||||||
| 885 | m_assembler.cvttsd2si_rr(src, dest); | - | ||||||||||||||||||
| 886 | return branch32(branchType ? GreaterThanOrEqual : LessThan, dest, TrustedImm32(0)); never executed: return branch32(branchType ? GreaterThanOrEqual : LessThan, dest, TrustedImm32(0)); | 0 | ||||||||||||||||||
| 887 | } | - | ||||||||||||||||||
| 888 | - | |||||||||||||||||||
| 889 | void truncateDoubleToInt32(FPRegisterID src, RegisterID dest) | - | ||||||||||||||||||
| 890 | { | - | ||||||||||||||||||
| 891 | ASSERT(isSSE2Present()); | - | ||||||||||||||||||
| 892 | m_assembler.cvttsd2si_rr(src, dest); | - | ||||||||||||||||||
| 893 | } never executed: end of block | 0 | ||||||||||||||||||
| 894 | - | |||||||||||||||||||
| 895 | #if CPU(X86_64) | - | ||||||||||||||||||
| 896 | void truncateDoubleToUint32(FPRegisterID src, RegisterID dest) | - | ||||||||||||||||||
| 897 | { | - | ||||||||||||||||||
| 898 | ASSERT(isSSE2Present()); | - | ||||||||||||||||||
| 899 | m_assembler.cvttsd2siq_rr(src, dest); | - | ||||||||||||||||||
| 900 | } never executed: end of block | 0 | ||||||||||||||||||
| 901 | #endif | - | ||||||||||||||||||
| 902 | - | |||||||||||||||||||
| 903 | // Convert 'src' to an integer, and places the resulting 'dest'. | - | ||||||||||||||||||
| 904 | // If the result is not representable as a 32 bit value, branch. | - | ||||||||||||||||||
| 905 | // May also branch for some values that are representable in 32 bits | - | ||||||||||||||||||
| 906 | // (specifically, in this case, 0). | - | ||||||||||||||||||
| 907 | void branchConvertDoubleToInt32(FPRegisterID src, RegisterID dest, JumpList& failureCases, FPRegisterID fpTemp) | - | ||||||||||||||||||
| 908 | { | - | ||||||||||||||||||
| 909 | ASSERT(isSSE2Present()); | - | ||||||||||||||||||
| 910 | m_assembler.cvttsd2si_rr(src, dest); | - | ||||||||||||||||||
| 911 | - | |||||||||||||||||||
| 912 | // If the result is zero, it might have been -0.0, and the double comparison won't catch this! | - | ||||||||||||||||||
| 913 | failureCases.append(branchTest32(Zero, dest)); | - | ||||||||||||||||||
| 914 | - | |||||||||||||||||||
| 915 | // Convert the integer result back to float & compare to the original value - if not equal or unordered (NaN) then jump. | - | ||||||||||||||||||
| 916 | convertInt32ToDouble(dest, fpTemp); | - | ||||||||||||||||||
| 917 | m_assembler.ucomisd_rr(fpTemp, src); | - | ||||||||||||||||||
| 918 | failureCases.append(m_assembler.jp()); | - | ||||||||||||||||||
| 919 | failureCases.append(m_assembler.jne()); | - | ||||||||||||||||||
| 920 | } never executed: end of block | 0 | ||||||||||||||||||
| 921 | - | |||||||||||||||||||
| 922 | Jump branchDoubleNonZero(FPRegisterID reg, FPRegisterID scratch) | - | ||||||||||||||||||
| 923 | { | - | ||||||||||||||||||
| 924 | ASSERT(isSSE2Present()); | - | ||||||||||||||||||
| 925 | m_assembler.xorpd_rr(scratch, scratch); | - | ||||||||||||||||||
| 926 | return branchDouble(DoubleNotEqual, reg, scratch); never executed: return branchDouble(DoubleNotEqual, reg, scratch); | 0 | ||||||||||||||||||
| 927 | } | - | ||||||||||||||||||
| 928 | - | |||||||||||||||||||
| 929 | Jump branchDoubleZeroOrNaN(FPRegisterID reg, FPRegisterID scratch) | - | ||||||||||||||||||
| 930 | { | - | ||||||||||||||||||
| 931 | ASSERT(isSSE2Present()); | - | ||||||||||||||||||
| 932 | m_assembler.xorpd_rr(scratch, scratch); | - | ||||||||||||||||||
| 933 | return branchDouble(DoubleEqualOrUnordered, reg, scratch); never executed: return branchDouble(DoubleEqualOrUnordered, reg, scratch); | 0 | ||||||||||||||||||
| 934 | } | - | ||||||||||||||||||
| 935 | - | |||||||||||||||||||
| 936 | void lshiftPacked(TrustedImm32 imm, XMMRegisterID reg) | - | ||||||||||||||||||
| 937 | { | - | ||||||||||||||||||
| 938 | ASSERT(isSSE2Present()); | - | ||||||||||||||||||
| 939 | m_assembler.psllq_i8r(imm.m_value, reg); | - | ||||||||||||||||||
| 940 | } never executed: end of block | 0 | ||||||||||||||||||
| 941 | - | |||||||||||||||||||
| 942 | void rshiftPacked(TrustedImm32 imm, XMMRegisterID reg) | - | ||||||||||||||||||
| 943 | { | - | ||||||||||||||||||
| 944 | ASSERT(isSSE2Present()); | - | ||||||||||||||||||
| 945 | m_assembler.psrlq_i8r(imm.m_value, reg); | - | ||||||||||||||||||
| 946 | } never executed: end of block | 0 | ||||||||||||||||||
| 947 | - | |||||||||||||||||||
| 948 | void orPacked(XMMRegisterID src, XMMRegisterID dst) | - | ||||||||||||||||||
| 949 | { | - | ||||||||||||||||||
| 950 | ASSERT(isSSE2Present()); | - | ||||||||||||||||||
| 951 | m_assembler.por_rr(src, dst); | - | ||||||||||||||||||
| 952 | } never executed: end of block | 0 | ||||||||||||||||||
| 953 | - | |||||||||||||||||||
| 954 | void moveInt32ToPacked(RegisterID src, XMMRegisterID dst) | - | ||||||||||||||||||
| 955 | { | - | ||||||||||||||||||
| 956 | ASSERT(isSSE2Present()); | - | ||||||||||||||||||
| 957 | m_assembler.movd_rr(src, dst); | - | ||||||||||||||||||
| 958 | } never executed: end of block | 0 | ||||||||||||||||||
| 959 | - | |||||||||||||||||||
| 960 | void movePackedToInt32(XMMRegisterID src, RegisterID dst) | - | ||||||||||||||||||
| 961 | { | - | ||||||||||||||||||
| 962 | ASSERT(isSSE2Present()); | - | ||||||||||||||||||
| 963 | m_assembler.movd_rr(src, dst); | - | ||||||||||||||||||
| 964 | } never executed: end of block | 0 | ||||||||||||||||||
| 965 | - | |||||||||||||||||||
| 966 | // Stack manipulation operations: | - | ||||||||||||||||||
| 967 | // | - | ||||||||||||||||||
| 968 | // The ABI is assumed to provide a stack abstraction to memory, | - | ||||||||||||||||||
| 969 | // containing machine word sized units of data. Push and pop | - | ||||||||||||||||||
| 970 | // operations add and remove a single register sized unit of data | - | ||||||||||||||||||
| 971 | // to or from the stack. Peek and poke operations read or write | - | ||||||||||||||||||
| 972 | // values on the stack, without moving the current stack position. | - | ||||||||||||||||||
| 973 | - | |||||||||||||||||||
| 974 | void pop(RegisterID dest) | - | ||||||||||||||||||
| 975 | { | - | ||||||||||||||||||
| 976 | m_assembler.pop_r(dest); | - | ||||||||||||||||||
| 977 | } executed 6960026 times by 153 tests: end of blockExecuted by:
| 6960026 | ||||||||||||||||||
| 978 | - | |||||||||||||||||||
| 979 | void push(RegisterID src) | - | ||||||||||||||||||
| 980 | { | - | ||||||||||||||||||
| 981 | m_assembler.push_r(src); | - | ||||||||||||||||||
| 982 | } executed 2368921 times by 153 tests: end of blockExecuted by:
| 2368921 | ||||||||||||||||||
| 983 | - | |||||||||||||||||||
| 984 | void push(Address address) | - | ||||||||||||||||||
| 985 | { | - | ||||||||||||||||||
| 986 | m_assembler.push_m(address.offset, address.base); | - | ||||||||||||||||||
| 987 | } never executed: end of block | 0 | ||||||||||||||||||
| 988 | - | |||||||||||||||||||
| 989 | void push(TrustedImm32 imm) | - | ||||||||||||||||||
| 990 | { | - | ||||||||||||||||||
| 991 | m_assembler.push_i32(imm.m_value); | - | ||||||||||||||||||
| 992 | } never executed: end of block | 0 | ||||||||||||||||||
| 993 | - | |||||||||||||||||||
| 994 | - | |||||||||||||||||||
| 995 | // Register move operations: | - | ||||||||||||||||||
| 996 | // | - | ||||||||||||||||||
| 997 | // Move values in registers. | - | ||||||||||||||||||
| 998 | - | |||||||||||||||||||
| 999 | void move(TrustedImm32 imm, RegisterID dest) | - | ||||||||||||||||||
| 1000 | { | - | ||||||||||||||||||
| 1001 | // Note: on 64-bit the TrustedImm32 value is zero extended into the register, it | - | ||||||||||||||||||
| 1002 | // may be useful to have a separate version that sign extends the value? | - | ||||||||||||||||||
| 1003 | if (!imm.m_value)
| 50956-2303896 | ||||||||||||||||||
| 1004 | m_assembler.xorl_rr(dest, dest); executed 2303982 times by 153 tests: m_assembler.xorl_rr(dest, dest);Executed by:
| 2303982 | ||||||||||||||||||
| 1005 | else | - | ||||||||||||||||||
| 1006 | m_assembler.movl_i32r(imm.m_value, dest); executed 50956 times by 63 tests: m_assembler.movl_i32r(imm.m_value, dest);Executed by:
| 50956 | ||||||||||||||||||
| 1007 | } | - | ||||||||||||||||||
| 1008 | - | |||||||||||||||||||
| 1009 | #if CPU(X86_64) | - | ||||||||||||||||||
| 1010 | void move(RegisterID src, RegisterID dest) | - | ||||||||||||||||||
| 1011 | { | - | ||||||||||||||||||
| 1012 | // Note: on 64-bit this is is a full register move; perhaps it would be | - | ||||||||||||||||||
| 1013 | // useful to have separate move32 & movePtr, with move32 zero extending? | - | ||||||||||||||||||
| 1014 | if (src != dest)
| 77464-3594558 | ||||||||||||||||||
| 1015 | m_assembler.movq_rr(src, dest); executed 3594619 times by 153 tests: m_assembler.movq_rr(src, dest);Executed by:
| 3594619 | ||||||||||||||||||
| 1016 | } executed 3674131 times by 153 tests: end of blockExecuted by:
| 3674131 | ||||||||||||||||||
| 1017 | - | |||||||||||||||||||
| 1018 | void move(TrustedImmPtr imm, RegisterID dest) | - | ||||||||||||||||||
| 1019 | { | - | ||||||||||||||||||
| 1020 | m_assembler.movq_i64r(imm.asIntptr(), dest); | - | ||||||||||||||||||
| 1021 | } executed 2401047 times by 153 tests: end of blockExecuted by:
| 2401047 | ||||||||||||||||||
| 1022 | - | |||||||||||||||||||
| 1023 | void move(TrustedImm64 imm, RegisterID dest) | - | ||||||||||||||||||
| 1024 | { | - | ||||||||||||||||||
| 1025 | m_assembler.movq_i64r(imm.m_value, dest); | - | ||||||||||||||||||
| 1026 | } executed 27352 times by 64 tests: end of blockExecuted by:
| 27352 | ||||||||||||||||||
| 1027 | - | |||||||||||||||||||
| 1028 | void swap(RegisterID reg1, RegisterID reg2) | - | ||||||||||||||||||
| 1029 | { | - | ||||||||||||||||||
| 1030 | if (reg1 != reg2)
| 0 | ||||||||||||||||||
| 1031 | m_assembler.xchgq_rr(reg1, reg2); never executed: m_assembler.xchgq_rr(reg1, reg2); | 0 | ||||||||||||||||||
| 1032 | } never executed: end of block | 0 | ||||||||||||||||||
| 1033 | - | |||||||||||||||||||
| 1034 | void signExtend32ToPtr(RegisterID src, RegisterID dest) | - | ||||||||||||||||||
| 1035 | { | - | ||||||||||||||||||
| 1036 | m_assembler.movsxd_rr(src, dest); | - | ||||||||||||||||||
| 1037 | } never executed: end of block | 0 | ||||||||||||||||||
| 1038 | - | |||||||||||||||||||
| 1039 | void zeroExtend32ToPtr(RegisterID src, RegisterID dest) | - | ||||||||||||||||||
| 1040 | { | - | ||||||||||||||||||
| 1041 | m_assembler.movl_rr(src, dest); | - | ||||||||||||||||||
| 1042 | } executed 2299557 times by 153 tests: end of blockExecuted by:
| 2299557 | ||||||||||||||||||
| 1043 | #else | - | ||||||||||||||||||
| 1044 | void move(RegisterID src, RegisterID dest) | - | ||||||||||||||||||
| 1045 | { | - | ||||||||||||||||||
| 1046 | if (src != dest) | - | ||||||||||||||||||
| 1047 | m_assembler.movl_rr(src, dest); | - | ||||||||||||||||||
| 1048 | } | - | ||||||||||||||||||
| 1049 | - | |||||||||||||||||||
| 1050 | void move(TrustedImmPtr imm, RegisterID dest) | - | ||||||||||||||||||
| 1051 | { | - | ||||||||||||||||||
| 1052 | m_assembler.movl_i32r(imm.asIntptr(), dest); | - | ||||||||||||||||||
| 1053 | } | - | ||||||||||||||||||
| 1054 | - | |||||||||||||||||||
| 1055 | void swap(RegisterID reg1, RegisterID reg2) | - | ||||||||||||||||||
| 1056 | { | - | ||||||||||||||||||
| 1057 | if (reg1 != reg2) | - | ||||||||||||||||||
| 1058 | m_assembler.xchgl_rr(reg1, reg2); | - | ||||||||||||||||||
| 1059 | } | - | ||||||||||||||||||
| 1060 | - | |||||||||||||||||||
| 1061 | void signExtend32ToPtr(RegisterID src, RegisterID dest) | - | ||||||||||||||||||
| 1062 | { | - | ||||||||||||||||||
| 1063 | move(src, dest); | - | ||||||||||||||||||
| 1064 | } | - | ||||||||||||||||||
| 1065 | - | |||||||||||||||||||
| 1066 | void zeroExtend32ToPtr(RegisterID src, RegisterID dest) | - | ||||||||||||||||||
| 1067 | { | - | ||||||||||||||||||
| 1068 | move(src, dest); | - | ||||||||||||||||||
| 1069 | } | - | ||||||||||||||||||
| 1070 | #endif | - | ||||||||||||||||||
| 1071 | - | |||||||||||||||||||
| 1072 | - | |||||||||||||||||||
| 1073 | // Forwards / external control flow operations: | - | ||||||||||||||||||
| 1074 | // | - | ||||||||||||||||||
| 1075 | // This set of jump and conditional branch operations return a Jump | - | ||||||||||||||||||
| 1076 | // object which may linked at a later point, allow forwards jump, | - | ||||||||||||||||||
| 1077 | // or jumps that will require external linkage (after the code has been | - | ||||||||||||||||||
| 1078 | // relocated). | - | ||||||||||||||||||
| 1079 | // | - | ||||||||||||||||||
| 1080 | // For branches, signed <, >, <= and >= are denoted as l, g, le, and ge | - | ||||||||||||||||||
| 1081 | // respecitvely, for unsigned comparisons the names b, a, be, and ae are | - | ||||||||||||||||||
| 1082 | // used (representing the names 'below' and 'above'). | - | ||||||||||||||||||
| 1083 | // | - | ||||||||||||||||||
| 1084 | // Operands to the comparision are provided in the expected order, e.g. | - | ||||||||||||||||||
| 1085 | // jle32(reg1, TrustedImm32(5)) will branch if the value held in reg1, when | - | ||||||||||||||||||
| 1086 | // treated as a signed 32bit value, is less than or equal to 5. | - | ||||||||||||||||||
| 1087 | // | - | ||||||||||||||||||
| 1088 | // jz and jnz test whether the first operand is equal to zero, and take | - | ||||||||||||||||||
| 1089 | // an optional second operand of a mask under which to perform the test. | - | ||||||||||||||||||
| 1090 | - | |||||||||||||||||||
| 1091 | public: | - | ||||||||||||||||||
| 1092 | Jump branch8(RelationalCondition cond, Address left, TrustedImm32 right) | - | ||||||||||||||||||
| 1093 | { | - | ||||||||||||||||||
| 1094 | m_assembler.cmpb_im(right.m_value, left.offset, left.base); | - | ||||||||||||||||||
| 1095 | return Jump(m_assembler.jCC(x86Condition(cond))); never executed: return Jump(m_assembler.jCC(x86Condition(cond))); | 0 | ||||||||||||||||||
| 1096 | } | - | ||||||||||||||||||
| 1097 | - | |||||||||||||||||||
| 1098 | Jump branch32(RelationalCondition cond, RegisterID left, RegisterID right) | - | ||||||||||||||||||
| 1099 | { | - | ||||||||||||||||||
| 1100 | m_assembler.cmpl_rr(right, left); | - | ||||||||||||||||||
| 1101 | return Jump(m_assembler.jCC(x86Condition(cond))); executed 4602882 times by 153 tests: return Jump(m_assembler.jCC(x86Condition(cond)));Executed by:
| 4602882 | ||||||||||||||||||
| 1102 | } | - | ||||||||||||||||||
| 1103 | - | |||||||||||||||||||
| 1104 | Jump branch32(RelationalCondition cond, RegisterID left, TrustedImm32 right) | - | ||||||||||||||||||
| 1105 | { | - | ||||||||||||||||||
| 1106 | if (((cond == Equal) || (cond == NotEqual)) && !right.m_value)
| 7528-1629741 | ||||||||||||||||||
| 1107 | m_assembler.testl_rr(left, left); executed 7528 times by 39 tests: m_assembler.testl_rr(left, left);Executed by:
| 7528 | ||||||||||||||||||
| 1108 | else | - | ||||||||||||||||||
| 1109 | m_assembler.cmpl_ir(right.m_value, left); executed 1648520 times by 52 tests: m_assembler.cmpl_ir(right.m_value, left);Executed by:
| 1648520 | ||||||||||||||||||
| 1110 | return Jump(m_assembler.jCC(x86Condition(cond))); executed 1655521 times by 52 tests: return Jump(m_assembler.jCC(x86Condition(cond)));Executed by:
| 1655521 | ||||||||||||||||||
| 1111 | } | - | ||||||||||||||||||
| 1112 | - | |||||||||||||||||||
| 1113 | Jump branch32(RelationalCondition cond, RegisterID left, Address right) | - | ||||||||||||||||||
| 1114 | { | - | ||||||||||||||||||
| 1115 | m_assembler.cmpl_mr(right.offset, right.base, left); | - | ||||||||||||||||||
| 1116 | return Jump(m_assembler.jCC(x86Condition(cond))); executed 11 times by 1 test: return Jump(m_assembler.jCC(x86Condition(cond)));Executed by:
| 11 | ||||||||||||||||||
| 1117 | } | - | ||||||||||||||||||
| 1118 | - | |||||||||||||||||||
| 1119 | Jump branch32(RelationalCondition cond, Address left, RegisterID right) | - | ||||||||||||||||||
| 1120 | { | - | ||||||||||||||||||
| 1121 | m_assembler.cmpl_rm(right, left.offset, left.base); | - | ||||||||||||||||||
| 1122 | return Jump(m_assembler.jCC(x86Condition(cond))); never executed: return Jump(m_assembler.jCC(x86Condition(cond))); | 0 | ||||||||||||||||||
| 1123 | } | - | ||||||||||||||||||
| 1124 | - | |||||||||||||||||||
| 1125 | Jump branch32(RelationalCondition cond, Address left, TrustedImm32 right) | - | ||||||||||||||||||
| 1126 | { | - | ||||||||||||||||||
| 1127 | m_assembler.cmpl_im(right.m_value, left.offset, left.base); | - | ||||||||||||||||||
| 1128 | return Jump(m_assembler.jCC(x86Condition(cond))); executed 52784 times by 64 tests: return Jump(m_assembler.jCC(x86Condition(cond)));Executed by:
| 52784 | ||||||||||||||||||
| 1129 | } | - | ||||||||||||||||||
| 1130 | - | |||||||||||||||||||
| 1131 | Jump branch32(RelationalCondition cond, BaseIndex left, TrustedImm32 right) | - | ||||||||||||||||||
| 1132 | { | - | ||||||||||||||||||
| 1133 | m_assembler.cmpl_im(right.m_value, left.offset, left.base, left.index, left.scale); | - | ||||||||||||||||||
| 1134 | return Jump(m_assembler.jCC(x86Condition(cond))); never executed: return Jump(m_assembler.jCC(x86Condition(cond))); | 0 | ||||||||||||||||||
| 1135 | } | - | ||||||||||||||||||
| 1136 | - | |||||||||||||||||||
| 1137 | Jump branch32WithUnalignedHalfWords(RelationalCondition cond, BaseIndex left, TrustedImm32 right) | - | ||||||||||||||||||
| 1138 | { | - | ||||||||||||||||||
| 1139 | return branch32(cond, left, right); never executed: return branch32(cond, left, right); | 0 | ||||||||||||||||||
| 1140 | } | - | ||||||||||||||||||
| 1141 | - | |||||||||||||||||||
| 1142 | Jump branchTest32(ResultCondition cond, RegisterID reg, RegisterID mask) | - | ||||||||||||||||||
| 1143 | { | - | ||||||||||||||||||
| 1144 | m_assembler.testl_rr(reg, mask); | - | ||||||||||||||||||
| 1145 | return Jump(m_assembler.jCC(x86Condition(cond))); never executed: return Jump(m_assembler.jCC(x86Condition(cond))); | 0 | ||||||||||||||||||
| 1146 | } | - | ||||||||||||||||||
| 1147 | - | |||||||||||||||||||
| 1148 | Jump branchTest32(ResultCondition cond, RegisterID reg, TrustedImm32 mask = TrustedImm32(-1)) | - | ||||||||||||||||||
| 1149 | { | - | ||||||||||||||||||
| 1150 | // if we are only interested in the low seven bits, this can be tested with a testb | - | ||||||||||||||||||
| 1151 | if (mask.m_value == -1)
| 0-2182 | ||||||||||||||||||
| 1152 | m_assembler.testl_rr(reg, reg); executed 2182 times by 8 tests: m_assembler.testl_rr(reg, reg);Executed by:
| 2182 | ||||||||||||||||||
| 1153 | else | - | ||||||||||||||||||
| 1154 | m_assembler.testl_i32r(mask.m_value, reg); never executed: m_assembler.testl_i32r(mask.m_value, reg); | 0 | ||||||||||||||||||
| 1155 | return Jump(m_assembler.jCC(x86Condition(cond))); executed 2183 times by 8 tests: return Jump(m_assembler.jCC(x86Condition(cond)));Executed by:
| 2183 | ||||||||||||||||||
| 1156 | } | - | ||||||||||||||||||
| 1157 | - | |||||||||||||||||||
| 1158 | Jump branchTest32(ResultCondition cond, Address address, TrustedImm32 mask = TrustedImm32(-1)) | - | ||||||||||||||||||
| 1159 | { | - | ||||||||||||||||||
| 1160 | if (mask.m_value == -1)
| 0 | ||||||||||||||||||
| 1161 | m_assembler.cmpl_im(0, address.offset, address.base); never executed: m_assembler.cmpl_im(0, address.offset, address.base); | 0 | ||||||||||||||||||
| 1162 | else | - | ||||||||||||||||||
| 1163 | m_assembler.testl_i32m(mask.m_value, address.offset, address.base); never executed: m_assembler.testl_i32m(mask.m_value, address.offset, address.base); | 0 | ||||||||||||||||||
| 1164 | return Jump(m_assembler.jCC(x86Condition(cond))); never executed: return Jump(m_assembler.jCC(x86Condition(cond))); | 0 | ||||||||||||||||||
| 1165 | } | - | ||||||||||||||||||
| 1166 | - | |||||||||||||||||||
| 1167 | Jump branchTest32(ResultCondition cond, BaseIndex address, TrustedImm32 mask = TrustedImm32(-1)) | - | ||||||||||||||||||
| 1168 | { | - | ||||||||||||||||||
| 1169 | if (mask.m_value == -1)
| 0 | ||||||||||||||||||
| 1170 | m_assembler.cmpl_im(0, address.offset, address.base, address.index, address.scale); never executed: m_assembler.cmpl_im(0, address.offset, address.base, address.index, address.scale); | 0 | ||||||||||||||||||
| 1171 | else | - | ||||||||||||||||||
| 1172 | m_assembler.testl_i32m(mask.m_value, address.offset, address.base, address.index, address.scale); never executed: m_assembler.testl_i32m(mask.m_value, address.offset, address.base, address.index, address.scale); | 0 | ||||||||||||||||||
| 1173 | return Jump(m_assembler.jCC(x86Condition(cond))); never executed: return Jump(m_assembler.jCC(x86Condition(cond))); | 0 | ||||||||||||||||||
| 1174 | } | - | ||||||||||||||||||
| 1175 | - | |||||||||||||||||||
| 1176 | Jump branchTest8(ResultCondition cond, Address address, TrustedImm32 mask = TrustedImm32(-1)) | - | ||||||||||||||||||
| 1177 | { | - | ||||||||||||||||||
| 1178 | // Byte in TrustedImm32 is not well defined, so be a little permisive here, but don't accept nonsense values. | - | ||||||||||||||||||
| 1179 | ASSERT(mask.m_value >= -128 && mask.m_value <= 255); | - | ||||||||||||||||||
| 1180 | if (mask.m_value == -1)
| 0 | ||||||||||||||||||
| 1181 | m_assembler.cmpb_im(0, address.offset, address.base); never executed: m_assembler.cmpb_im(0, address.offset, address.base); | 0 | ||||||||||||||||||
| 1182 | else | - | ||||||||||||||||||
| 1183 | m_assembler.testb_im(mask.m_value, address.offset, address.base); never executed: m_assembler.testb_im(mask.m_value, address.offset, address.base); | 0 | ||||||||||||||||||
| 1184 | return Jump(m_assembler.jCC(x86Condition(cond))); never executed: return Jump(m_assembler.jCC(x86Condition(cond))); | 0 | ||||||||||||||||||
| 1185 | } | - | ||||||||||||||||||
| 1186 | - | |||||||||||||||||||
| 1187 | Jump branchTest8(ResultCondition cond, BaseIndex address, TrustedImm32 mask = TrustedImm32(-1)) | - | ||||||||||||||||||
| 1188 | { | - | ||||||||||||||||||
| 1189 | // Byte in TrustedImm32 is not well defined, so be a little permisive here, but don't accept nonsense values. | - | ||||||||||||||||||
| 1190 | ASSERT(mask.m_value >= -128 && mask.m_value <= 255); | - | ||||||||||||||||||
| 1191 | if (mask.m_value == -1)
| 0-3752 | ||||||||||||||||||
| 1192 | m_assembler.cmpb_im(0, address.offset, address.base, address.index, address.scale); executed 3753 times by 3 tests: m_assembler.cmpb_im(0, address.offset, address.base, address.index, address.scale);Executed by:
| 3753 | ||||||||||||||||||
| 1193 | else | - | ||||||||||||||||||
| 1194 | m_assembler.testb_im(mask.m_value, address.offset, address.base, address.index, address.scale); never executed: m_assembler.testb_im(mask.m_value, address.offset, address.base, address.index, address.scale); | 0 | ||||||||||||||||||
| 1195 | return Jump(m_assembler.jCC(x86Condition(cond))); executed 3754 times by 3 tests: return Jump(m_assembler.jCC(x86Condition(cond)));Executed by:
| 3754 | ||||||||||||||||||
| 1196 | } | - | ||||||||||||||||||
| 1197 | - | |||||||||||||||||||
| 1198 | Jump branch8(RelationalCondition cond, BaseIndex left, TrustedImm32 right) | - | ||||||||||||||||||
| 1199 | { | - | ||||||||||||||||||
| 1200 | ASSERT(!(right.m_value & 0xFFFFFF00)); | - | ||||||||||||||||||
| 1201 | - | |||||||||||||||||||
| 1202 | m_assembler.cmpb_im(right.m_value, left.offset, left.base, left.index, left.scale); | - | ||||||||||||||||||
| 1203 | return Jump(m_assembler.jCC(x86Condition(cond))); never executed: return Jump(m_assembler.jCC(x86Condition(cond))); | 0 | ||||||||||||||||||
| 1204 | } | - | ||||||||||||||||||
| 1205 | - | |||||||||||||||||||
| 1206 | Jump jump() | - | ||||||||||||||||||
| 1207 | { | - | ||||||||||||||||||
| 1208 | return Jump(m_assembler.jmp()); executed 1186261 times by 153 tests: return Jump(m_assembler.jmp());Executed by:
| 1186261 | ||||||||||||||||||
| 1209 | } | - | ||||||||||||||||||
| 1210 | - | |||||||||||||||||||
| 1211 | void jump(RegisterID target) | - | ||||||||||||||||||
| 1212 | { | - | ||||||||||||||||||
| 1213 | m_assembler.jmp_r(target); | - | ||||||||||||||||||
| 1214 | } executed 13238 times by 64 tests: end of blockExecuted by:
| 13238 | ||||||||||||||||||
| 1215 | - | |||||||||||||||||||
| 1216 | // Address is a memory location containing the address to jump to | - | ||||||||||||||||||
| 1217 | void jump(Address address) | - | ||||||||||||||||||
| 1218 | { | - | ||||||||||||||||||
| 1219 | m_assembler.jmp_m(address.offset, address.base); | - | ||||||||||||||||||
| 1220 | } executed 164 times by 3 tests: end of blockExecuted by:
| 164 | ||||||||||||||||||
| 1221 | - | |||||||||||||||||||
| 1222 | - | |||||||||||||||||||
| 1223 | // Arithmetic control flow operations: | - | ||||||||||||||||||
| 1224 | // | - | ||||||||||||||||||
| 1225 | // This set of conditional branch operations branch based | - | ||||||||||||||||||
| 1226 | // on the result of an arithmetic operation. The operation | - | ||||||||||||||||||
| 1227 | // is performed as normal, storing the result. | - | ||||||||||||||||||
| 1228 | // | - | ||||||||||||||||||
| 1229 | // * jz operations branch if the result is zero. | - | ||||||||||||||||||
| 1230 | // * jo operations branch if the (signed) arithmetic | - | ||||||||||||||||||
| 1231 | // operation caused an overflow to occur. | - | ||||||||||||||||||
| 1232 | - | |||||||||||||||||||
| 1233 | Jump branchAdd32(ResultCondition cond, RegisterID src, RegisterID dest) | - | ||||||||||||||||||
| 1234 | { | - | ||||||||||||||||||
| 1235 | add32(src, dest); | - | ||||||||||||||||||
| 1236 | return Jump(m_assembler.jCC(x86Condition(cond))); executed 2130 times by 29 tests: return Jump(m_assembler.jCC(x86Condition(cond)));Executed by:
| 2130 | ||||||||||||||||||
| 1237 | } | - | ||||||||||||||||||
| 1238 | - | |||||||||||||||||||
| 1239 | Jump branchAdd32(ResultCondition cond, TrustedImm32 imm, RegisterID dest) | - | ||||||||||||||||||
| 1240 | { | - | ||||||||||||||||||
| 1241 | add32(imm, dest); | - | ||||||||||||||||||
| 1242 | return Jump(m_assembler.jCC(x86Condition(cond))); executed 326 times by 13 tests: return Jump(m_assembler.jCC(x86Condition(cond)));Executed by:
| 326 | ||||||||||||||||||
| 1243 | } | - | ||||||||||||||||||
| 1244 | - | |||||||||||||||||||
| 1245 | Jump branchAdd32(ResultCondition cond, TrustedImm32 src, Address dest) | - | ||||||||||||||||||
| 1246 | { | - | ||||||||||||||||||
| 1247 | add32(src, dest); | - | ||||||||||||||||||
| 1248 | return Jump(m_assembler.jCC(x86Condition(cond))); never executed: return Jump(m_assembler.jCC(x86Condition(cond))); | 0 | ||||||||||||||||||
| 1249 | } | - | ||||||||||||||||||
| 1250 | - | |||||||||||||||||||
| 1251 | Jump branchAdd32(ResultCondition cond, RegisterID src, Address dest) | - | ||||||||||||||||||
| 1252 | { | - | ||||||||||||||||||
| 1253 | add32(src, dest); | - | ||||||||||||||||||
| 1254 | return Jump(m_assembler.jCC(x86Condition(cond))); never executed: return Jump(m_assembler.jCC(x86Condition(cond))); | 0 | ||||||||||||||||||
| 1255 | } | - | ||||||||||||||||||
| 1256 | - | |||||||||||||||||||
| 1257 | Jump branchAdd32(ResultCondition cond, Address src, RegisterID dest) | - | ||||||||||||||||||
| 1258 | { | - | ||||||||||||||||||
| 1259 | add32(src, dest); | - | ||||||||||||||||||
| 1260 | return Jump(m_assembler.jCC(x86Condition(cond))); never executed: return Jump(m_assembler.jCC(x86Condition(cond))); | 0 | ||||||||||||||||||
| 1261 | } | - | ||||||||||||||||||
| 1262 | - | |||||||||||||||||||
| 1263 | Jump branchAdd32(ResultCondition cond, RegisterID src1, RegisterID src2, RegisterID dest) | - | ||||||||||||||||||
| 1264 | { | - | ||||||||||||||||||
| 1265 | if (src1 == dest)
| 0 | ||||||||||||||||||
| 1266 | return branchAdd32(cond, src2, dest); never executed: return branchAdd32(cond, src2, dest); | 0 | ||||||||||||||||||
| 1267 | move(src2, dest); | - | ||||||||||||||||||
| 1268 | return branchAdd32(cond, src1, dest); never executed: return branchAdd32(cond, src1, dest); | 0 | ||||||||||||||||||
| 1269 | } | - | ||||||||||||||||||
| 1270 | - | |||||||||||||||||||
| 1271 | Jump branchAdd32(ResultCondition cond, RegisterID src, TrustedImm32 imm, RegisterID dest) | - | ||||||||||||||||||
| 1272 | { | - | ||||||||||||||||||
| 1273 | move(src, dest); | - | ||||||||||||||||||
| 1274 | return branchAdd32(cond, imm, dest); executed 326 times by 13 tests: return branchAdd32(cond, imm, dest);Executed by:
| 326 | ||||||||||||||||||
| 1275 | } | - | ||||||||||||||||||
| 1276 | - | |||||||||||||||||||
| 1277 | Jump branchMul32(ResultCondition cond, RegisterID src, RegisterID dest) | - | ||||||||||||||||||
| 1278 | { | - | ||||||||||||||||||
| 1279 | mul32(src, dest); | - | ||||||||||||||||||
| 1280 | if (cond != Overflow)
| 0-896 | ||||||||||||||||||
| 1281 | m_assembler.testl_rr(dest, dest); never executed: m_assembler.testl_rr(dest, dest); | 0 | ||||||||||||||||||
| 1282 | return Jump(m_assembler.jCC(x86Condition(cond))); executed 896 times by 13 tests: return Jump(m_assembler.jCC(x86Condition(cond)));Executed by:
| 896 | ||||||||||||||||||
| 1283 | } | - | ||||||||||||||||||
| 1284 | - | |||||||||||||||||||
| 1285 | Jump branchMul32(ResultCondition cond, Address src, RegisterID dest) | - | ||||||||||||||||||
| 1286 | { | - | ||||||||||||||||||
| 1287 | mul32(src, dest); | - | ||||||||||||||||||
| 1288 | if (cond != Overflow)
| 0 | ||||||||||||||||||
| 1289 | m_assembler.testl_rr(dest, dest); never executed: m_assembler.testl_rr(dest, dest); | 0 | ||||||||||||||||||
| 1290 | return Jump(m_assembler.jCC(x86Condition(cond))); never executed: return Jump(m_assembler.jCC(x86Condition(cond))); | 0 | ||||||||||||||||||
| 1291 | } | - | ||||||||||||||||||
| 1292 | - | |||||||||||||||||||
| 1293 | Jump branchMul32(ResultCondition cond, TrustedImm32 imm, RegisterID src, RegisterID dest) | - | ||||||||||||||||||
| 1294 | { | - | ||||||||||||||||||
| 1295 | mul32(imm, src, dest); | - | ||||||||||||||||||
| 1296 | if (cond != Overflow)
| 0 | ||||||||||||||||||
| 1297 | m_assembler.testl_rr(dest, dest); never executed: m_assembler.testl_rr(dest, dest); | 0 | ||||||||||||||||||
| 1298 | return Jump(m_assembler.jCC(x86Condition(cond))); never executed: return Jump(m_assembler.jCC(x86Condition(cond))); | 0 | ||||||||||||||||||
| 1299 | } | - | ||||||||||||||||||
| 1300 | - | |||||||||||||||||||
| 1301 | Jump branchMul32(ResultCondition cond, RegisterID src1, RegisterID src2, RegisterID dest) | - | ||||||||||||||||||
| 1302 | { | - | ||||||||||||||||||
| 1303 | if (src1 == dest)
| 0 | ||||||||||||||||||
| 1304 | return branchMul32(cond, src2, dest); never executed: return branchMul32(cond, src2, dest); | 0 | ||||||||||||||||||
| 1305 | move(src2, dest); | - | ||||||||||||||||||
| 1306 | return branchMul32(cond, src1, dest); never executed: return branchMul32(cond, src1, dest); | 0 | ||||||||||||||||||
| 1307 | } | - | ||||||||||||||||||
| 1308 | - | |||||||||||||||||||
| 1309 | Jump branchSub32(ResultCondition cond, RegisterID src, RegisterID dest) | - | ||||||||||||||||||
| 1310 | { | - | ||||||||||||||||||
| 1311 | sub32(src, dest); | - | ||||||||||||||||||
| 1312 | return Jump(m_assembler.jCC(x86Condition(cond))); executed 686 times by 20 tests: return Jump(m_assembler.jCC(x86Condition(cond)));Executed by:
| 686 | ||||||||||||||||||
| 1313 | } | - | ||||||||||||||||||
| 1314 | - | |||||||||||||||||||
| 1315 | Jump branchSub32(ResultCondition cond, TrustedImm32 imm, RegisterID dest) | - | ||||||||||||||||||
| 1316 | { | - | ||||||||||||||||||
| 1317 | sub32(imm, dest); | - | ||||||||||||||||||
| 1318 | return Jump(m_assembler.jCC(x86Condition(cond))); executed 288 times by 6 tests: return Jump(m_assembler.jCC(x86Condition(cond)));Executed by:
| 288 | ||||||||||||||||||
| 1319 | } | - | ||||||||||||||||||
| 1320 | - | |||||||||||||||||||
| 1321 | Jump branchSub32(ResultCondition cond, TrustedImm32 imm, Address dest) | - | ||||||||||||||||||
| 1322 | { | - | ||||||||||||||||||
| 1323 | sub32(imm, dest); | - | ||||||||||||||||||
| 1324 | return Jump(m_assembler.jCC(x86Condition(cond))); never executed: return Jump(m_assembler.jCC(x86Condition(cond))); | 0 | ||||||||||||||||||
| 1325 | } | - | ||||||||||||||||||
| 1326 | - | |||||||||||||||||||
| 1327 | Jump branchSub32(ResultCondition cond, RegisterID src, Address dest) | - | ||||||||||||||||||
| 1328 | { | - | ||||||||||||||||||
| 1329 | sub32(src, dest); | - | ||||||||||||||||||
| 1330 | return Jump(m_assembler.jCC(x86Condition(cond))); never executed: return Jump(m_assembler.jCC(x86Condition(cond))); | 0 | ||||||||||||||||||
| 1331 | } | - | ||||||||||||||||||
| 1332 | - | |||||||||||||||||||
| 1333 | Jump branchSub32(ResultCondition cond, Address src, RegisterID dest) | - | ||||||||||||||||||
| 1334 | { | - | ||||||||||||||||||
| 1335 | sub32(src, dest); | - | ||||||||||||||||||
| 1336 | return Jump(m_assembler.jCC(x86Condition(cond))); never executed: return Jump(m_assembler.jCC(x86Condition(cond))); | 0 | ||||||||||||||||||
| 1337 | } | - | ||||||||||||||||||
| 1338 | - | |||||||||||||||||||
| 1339 | Jump branchSub32(ResultCondition cond, RegisterID src1, RegisterID src2, RegisterID dest) | - | ||||||||||||||||||
| 1340 | { | - | ||||||||||||||||||
| 1341 | // B := A - B is invalid. | - | ||||||||||||||||||
| 1342 | ASSERT(src1 == dest || src2 != dest); | - | ||||||||||||||||||
| 1343 | - | |||||||||||||||||||
| 1344 | move(src1, dest); | - | ||||||||||||||||||
| 1345 | return branchSub32(cond, src2, dest); never executed: return branchSub32(cond, src2, dest); | 0 | ||||||||||||||||||
| 1346 | } | - | ||||||||||||||||||
| 1347 | - | |||||||||||||||||||
| 1348 | Jump branchSub32(ResultCondition cond, RegisterID src1, TrustedImm32 src2, RegisterID dest) | - | ||||||||||||||||||
| 1349 | { | - | ||||||||||||||||||
| 1350 | move(src1, dest); | - | ||||||||||||||||||
| 1351 | return branchSub32(cond, src2, dest); executed 288 times by 6 tests: return branchSub32(cond, src2, dest);Executed by:
| 288 | ||||||||||||||||||
| 1352 | } | - | ||||||||||||||||||
| 1353 | - | |||||||||||||||||||
| 1354 | Jump branchNeg32(ResultCondition cond, RegisterID srcDest) | - | ||||||||||||||||||
| 1355 | { | - | ||||||||||||||||||
| 1356 | neg32(srcDest); | - | ||||||||||||||||||
| 1357 | return Jump(m_assembler.jCC(x86Condition(cond))); never executed: return Jump(m_assembler.jCC(x86Condition(cond))); | 0 | ||||||||||||||||||
| 1358 | } | - | ||||||||||||||||||
| 1359 | - | |||||||||||||||||||
| 1360 | Jump branchOr32(ResultCondition cond, RegisterID src, RegisterID dest) | - | ||||||||||||||||||
| 1361 | { | - | ||||||||||||||||||
| 1362 | or32(src, dest); | - | ||||||||||||||||||
| 1363 | return Jump(m_assembler.jCC(x86Condition(cond))); never executed: return Jump(m_assembler.jCC(x86Condition(cond))); | 0 | ||||||||||||||||||
| 1364 | } | - | ||||||||||||||||||
| 1365 | - | |||||||||||||||||||
| 1366 | - | |||||||||||||||||||
| 1367 | // Miscellaneous operations: | - | ||||||||||||||||||
| 1368 | - | |||||||||||||||||||
| 1369 | void breakpoint() | - | ||||||||||||||||||
| 1370 | { | - | ||||||||||||||||||
| 1371 | m_assembler.int3(); | - | ||||||||||||||||||
| 1372 | } executed 12 times by 1 test: end of blockExecuted by:
| 12 | ||||||||||||||||||
| 1373 | - | |||||||||||||||||||
| 1374 | Call nearCall() | - | ||||||||||||||||||
| 1375 | { | - | ||||||||||||||||||
| 1376 | return Call(m_assembler.call(), Call::LinkableNear); never executed: return Call(m_assembler.call(), Call::LinkableNear); | 0 | ||||||||||||||||||
| 1377 | } | - | ||||||||||||||||||
| 1378 | - | |||||||||||||||||||
| 1379 | Call call(RegisterID target) | - | ||||||||||||||||||
| 1380 | { | - | ||||||||||||||||||
| 1381 | return Call(m_assembler.call(target), Call::None); executed 83222 times by 64 tests: return Call(m_assembler.call(target), Call::None);Executed by:
| 83222 | ||||||||||||||||||
| 1382 | } | - | ||||||||||||||||||
| 1383 | - | |||||||||||||||||||
| 1384 | void call(Address address) | - | ||||||||||||||||||
| 1385 | { | - | ||||||||||||||||||
| 1386 | m_assembler.call_m(address.offset, address.base); | - | ||||||||||||||||||
| 1387 | } never executed: end of block | 0 | ||||||||||||||||||
| 1388 | - | |||||||||||||||||||
| 1389 | void ret() | - | ||||||||||||||||||
| 1390 | { | - | ||||||||||||||||||
| 1391 | m_assembler.ret(); | - | ||||||||||||||||||
| 1392 | } executed 3462963 times by 153 tests: end of blockExecuted by:
| 3462963 | ||||||||||||||||||
| 1393 | - | |||||||||||||||||||
| 1394 | void compare8(RelationalCondition cond, Address left, TrustedImm32 right, RegisterID dest) | - | ||||||||||||||||||
| 1395 | { | - | ||||||||||||||||||
| 1396 | m_assembler.cmpb_im(right.m_value, left.offset, left.base); | - | ||||||||||||||||||
| 1397 | set32(x86Condition(cond), dest); | - | ||||||||||||||||||
| 1398 | } never executed: end of block | 0 | ||||||||||||||||||
| 1399 | - | |||||||||||||||||||
| 1400 | void compare32(RelationalCondition cond, RegisterID left, RegisterID right, RegisterID dest) | - | ||||||||||||||||||
| 1401 | { | - | ||||||||||||||||||
| 1402 | m_assembler.cmpl_rr(right, left); | - | ||||||||||||||||||
| 1403 | set32(x86Condition(cond), dest); | - | ||||||||||||||||||
| 1404 | } executed 2256 times by 32 tests: end of blockExecuted by:
| 2256 | ||||||||||||||||||
| 1405 | - | |||||||||||||||||||
| 1406 | void compare32(RelationalCondition cond, RegisterID left, TrustedImm32 right, RegisterID dest) | - | ||||||||||||||||||
| 1407 | { | - | ||||||||||||||||||
| 1408 | if (((cond == Equal) || (cond == NotEqual)) && !right.m_value)
| 0-316 | ||||||||||||||||||
| 1409 | m_assembler.testl_rr(left, left); executed 312 times by 12 tests: m_assembler.testl_rr(left, left);Executed by:
| 312 | ||||||||||||||||||
| 1410 | else | - | ||||||||||||||||||
| 1411 | m_assembler.cmpl_ir(right.m_value, left); executed 34 times by 8 tests: m_assembler.cmpl_ir(right.m_value, left);Executed by:
| 34 | ||||||||||||||||||
| 1412 | set32(x86Condition(cond), dest); | - | ||||||||||||||||||
| 1413 | } executed 346 times by 16 tests: end of blockExecuted by:
| 346 | ||||||||||||||||||
| 1414 | - | |||||||||||||||||||
| 1415 | // FIXME: | - | ||||||||||||||||||
| 1416 | // The mask should be optional... perhaps the argument order should be | - | ||||||||||||||||||
| 1417 | // dest-src, operations always have a dest? ... possibly not true, considering | - | ||||||||||||||||||
| 1418 | // asm ops like test, or pseudo ops like pop(). | - | ||||||||||||||||||
| 1419 | - | |||||||||||||||||||
| 1420 | void test8(ResultCondition cond, Address address, TrustedImm32 mask, RegisterID dest) | - | ||||||||||||||||||
| 1421 | { | - | ||||||||||||||||||
| 1422 | if (mask.m_value == -1)
| 0 | ||||||||||||||||||
| 1423 | m_assembler.cmpb_im(0, address.offset, address.base); never executed: m_assembler.cmpb_im(0, address.offset, address.base); | 0 | ||||||||||||||||||
| 1424 | else | - | ||||||||||||||||||
| 1425 | m_assembler.testb_im(mask.m_value, address.offset, address.base); never executed: m_assembler.testb_im(mask.m_value, address.offset, address.base); | 0 | ||||||||||||||||||
| 1426 | set32(x86Condition(cond), dest); | - | ||||||||||||||||||
| 1427 | } never executed: end of block | 0 | ||||||||||||||||||
| 1428 | - | |||||||||||||||||||
| 1429 | void test32(ResultCondition cond, Address address, TrustedImm32 mask, RegisterID dest) | - | ||||||||||||||||||
| 1430 | { | - | ||||||||||||||||||
| 1431 | if (mask.m_value == -1)
| 0 | ||||||||||||||||||
| 1432 | m_assembler.cmpl_im(0, address.offset, address.base); never executed: m_assembler.cmpl_im(0, address.offset, address.base); | 0 | ||||||||||||||||||
| 1433 | else | - | ||||||||||||||||||
| 1434 | m_assembler.testl_i32m(mask.m_value, address.offset, address.base); never executed: m_assembler.testl_i32m(mask.m_value, address.offset, address.base); | 0 | ||||||||||||||||||
| 1435 | set32(x86Condition(cond), dest); | - | ||||||||||||||||||
| 1436 | } never executed: end of block | 0 | ||||||||||||||||||
| 1437 | - | |||||||||||||||||||
| 1438 | // Invert a relational condition, e.g. == becomes !=, < becomes >=, etc. | - | ||||||||||||||||||
| 1439 | static RelationalCondition invert(RelationalCondition cond) | - | ||||||||||||||||||
| 1440 | { | - | ||||||||||||||||||
| 1441 | return static_cast<RelationalCondition>(cond ^ 1); never executed: return static_cast<RelationalCondition>(cond ^ 1); | 0 | ||||||||||||||||||
| 1442 | } | - | ||||||||||||||||||
| 1443 | - | |||||||||||||||||||
| 1444 | void nop() | - | ||||||||||||||||||
| 1445 | { | - | ||||||||||||||||||
| 1446 | m_assembler.nop(); | - | ||||||||||||||||||
| 1447 | } never executed: end of block | 0 | ||||||||||||||||||
| 1448 | - | |||||||||||||||||||
| 1449 | static void replaceWithJump(CodeLocationLabel instructionStart, CodeLocationLabel destination) | - | ||||||||||||||||||
| 1450 | { | - | ||||||||||||||||||
| 1451 | X86Assembler::replaceWithJump(instructionStart.executableAddress(), destination.executableAddress()); | - | ||||||||||||||||||
| 1452 | } never executed: end of block | 0 | ||||||||||||||||||
| 1453 | - | |||||||||||||||||||
| 1454 | static ptrdiff_t maxJumpReplacementSize() | - | ||||||||||||||||||
| 1455 | { | - | ||||||||||||||||||
| 1456 | return X86Assembler::maxJumpReplacementSize(); never executed: return X86Assembler::maxJumpReplacementSize(); | 0 | ||||||||||||||||||
| 1457 | } | - | ||||||||||||||||||
| 1458 | - | |||||||||||||||||||
| 1459 | protected: | - | ||||||||||||||||||
| 1460 | X86Assembler::Condition x86Condition(RelationalCondition cond) | - | ||||||||||||||||||
| 1461 | { | - | ||||||||||||||||||
| 1462 | return static_cast<X86Assembler::Condition>(cond); executed 6325906 times by 153 tests: return static_cast<X86Assembler::Condition>(cond);Executed by:
| 6325906 | ||||||||||||||||||
| 1463 | } | - | ||||||||||||||||||
| 1464 | - | |||||||||||||||||||
| 1465 | X86Assembler::Condition x86Condition(ResultCondition cond) | - | ||||||||||||||||||
| 1466 | { | - | ||||||||||||||||||
| 1467 | return static_cast<X86Assembler::Condition>(cond); executed 10262 times by 44 tests: return static_cast<X86Assembler::Condition>(cond);Executed by:
| 10262 | ||||||||||||||||||
| 1468 | } | - | ||||||||||||||||||
| 1469 | - | |||||||||||||||||||
| 1470 | void set32(X86Assembler::Condition cond, RegisterID dest) | - | ||||||||||||||||||
| 1471 | { | - | ||||||||||||||||||
| 1472 | #if CPU(X86) | - | ||||||||||||||||||
| 1473 | // On 32-bit x86 we can only set the first 4 registers; | - | ||||||||||||||||||
| 1474 | // esp..edi are mapped to the 'h' registers! | - | ||||||||||||||||||
| 1475 | if (dest >= 4) { | - | ||||||||||||||||||
| 1476 | m_assembler.xchgl_rr(dest, X86Registers::eax); | - | ||||||||||||||||||
| 1477 | m_assembler.setCC_r(cond, X86Registers::eax); | - | ||||||||||||||||||
| 1478 | m_assembler.movzbl_rr(X86Registers::eax, X86Registers::eax); | - | ||||||||||||||||||
| 1479 | m_assembler.xchgl_rr(dest, X86Registers::eax); | - | ||||||||||||||||||
| 1480 | return; | - | ||||||||||||||||||
| 1481 | } | - | ||||||||||||||||||
| 1482 | #endif | - | ||||||||||||||||||
| 1483 | m_assembler.setCC_r(cond, dest); | - | ||||||||||||||||||
| 1484 | m_assembler.movzbl_rr(dest, dest); | - | ||||||||||||||||||
| 1485 | } executed 2602 times by 34 tests: end of blockExecuted by:
| 2602 | ||||||||||||||||||
| 1486 | - | |||||||||||||||||||
| 1487 | private: | - | ||||||||||||||||||
| 1488 | // Only MacroAssemblerX86 should be using the following method; SSE2 is always available on | - | ||||||||||||||||||
| 1489 | // x86_64, and clients & subclasses of MacroAssembler should be using 'supportsFloatingPoint()'. | - | ||||||||||||||||||
| 1490 | friend class MacroAssemblerX86; | - | ||||||||||||||||||
| 1491 | - | |||||||||||||||||||
| 1492 | #if CPU(X86) | - | ||||||||||||||||||
| 1493 | #if OS(MAC_OS_X) | - | ||||||||||||||||||
| 1494 | - | |||||||||||||||||||
| 1495 | // All X86 Macs are guaranteed to support at least SSE2, | - | ||||||||||||||||||
| 1496 | static bool isSSE2Present() | - | ||||||||||||||||||
| 1497 | { | - | ||||||||||||||||||
| 1498 | return true; | - | ||||||||||||||||||
| 1499 | } | - | ||||||||||||||||||
| 1500 | - | |||||||||||||||||||
| 1501 | #else // OS(MAC_OS_X) | - | ||||||||||||||||||
| 1502 | - | |||||||||||||||||||
| 1503 | enum SSE2CheckState { | - | ||||||||||||||||||
| 1504 | NotCheckedSSE2, | - | ||||||||||||||||||
| 1505 | HasSSE2, | - | ||||||||||||||||||
| 1506 | NoSSE2 | - | ||||||||||||||||||
| 1507 | }; | - | ||||||||||||||||||
| 1508 | - | |||||||||||||||||||
| 1509 | static bool isSSE2Present() | - | ||||||||||||||||||
| 1510 | { | - | ||||||||||||||||||
| 1511 | if (s_sse2CheckState == NotCheckedSSE2) { | - | ||||||||||||||||||
| 1512 | // Default the flags value to zero; if the compiler is | - | ||||||||||||||||||
| 1513 | // not MSVC or GCC we will read this as SSE2 not present. | - | ||||||||||||||||||
| 1514 | int flags = 0; | - | ||||||||||||||||||
| 1515 | #if COMPILER(MSVC) | - | ||||||||||||||||||
| 1516 | _asm { | - | ||||||||||||||||||
| 1517 | mov eax, 1 // cpuid function 1 gives us the standard feature set | - | ||||||||||||||||||
| 1518 | cpuid; | - | ||||||||||||||||||
| 1519 | mov flags, edx; | - | ||||||||||||||||||
| 1520 | } | - | ||||||||||||||||||
| 1521 | #elif COMPILER(GCC) | - | ||||||||||||||||||
| 1522 | asm ( | - | ||||||||||||||||||
| 1523 | "movl $0x1, %%eax;" | - | ||||||||||||||||||
| 1524 | "pushl %%ebx;" | - | ||||||||||||||||||
| 1525 | "cpuid;" | - | ||||||||||||||||||
| 1526 | "popl %%ebx;" | - | ||||||||||||||||||
| 1527 | "movl %%edx, %0;" | - | ||||||||||||||||||
| 1528 | : "=g" (flags) | - | ||||||||||||||||||
| 1529 | : | - | ||||||||||||||||||
| 1530 | : "%eax", "%ecx", "%edx" | - | ||||||||||||||||||
| 1531 | ); | - | ||||||||||||||||||
| 1532 | #endif | - | ||||||||||||||||||
| 1533 | static const int SSE2FeatureBit = 1 << 26; | - | ||||||||||||||||||
| 1534 | s_sse2CheckState = (flags & SSE2FeatureBit) ? HasSSE2 : NoSSE2; | - | ||||||||||||||||||
| 1535 | } | - | ||||||||||||||||||
| 1536 | // Only check once. | - | ||||||||||||||||||
| 1537 | ASSERT(s_sse2CheckState != NotCheckedSSE2); | - | ||||||||||||||||||
| 1538 | - | |||||||||||||||||||
| 1539 | return s_sse2CheckState == HasSSE2; | - | ||||||||||||||||||
| 1540 | } | - | ||||||||||||||||||
| 1541 | - | |||||||||||||||||||
| 1542 | static SSE2CheckState s_sse2CheckState; | - | ||||||||||||||||||
| 1543 | - | |||||||||||||||||||
| 1544 | #endif // OS(MAC_OS_X) | - | ||||||||||||||||||
| 1545 | #elif !defined(NDEBUG) // CPU(X86) | - | ||||||||||||||||||
| 1546 | - | |||||||||||||||||||
| 1547 | // On x86-64 we should never be checking for SSE2 in a non-debug build, | - | ||||||||||||||||||
| 1548 | // but non debug add this method to keep the asserts above happy. | - | ||||||||||||||||||
| 1549 | static bool isSSE2Present() | - | ||||||||||||||||||
| 1550 | { | - | ||||||||||||||||||
| 1551 | return true; never executed: return true; | 0 | ||||||||||||||||||
| 1552 | } | - | ||||||||||||||||||
| 1553 | - | |||||||||||||||||||
| 1554 | #endif | - | ||||||||||||||||||
| 1555 | }; | - | ||||||||||||||||||
| 1556 | - | |||||||||||||||||||
| 1557 | } // namespace JSC | - | ||||||||||||||||||
| 1558 | - | |||||||||||||||||||
| 1559 | #endif // ENABLE(ASSEMBLER) | - | ||||||||||||||||||
| 1560 | - | |||||||||||||||||||
| 1561 | #endif // MacroAssemblerX86Common_h | - | ||||||||||||||||||
| Source code | Switch to Preprocessed file |