| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #if V8_TARGET_ARCH_X64 | 5 #if V8_TARGET_ARCH_X64 |
| 6 | 6 |
| 7 #include "src/crankshaft/x64/lithium-codegen-x64.h" | 7 #include "src/crankshaft/x64/lithium-codegen-x64.h" |
| 8 | 8 |
| 9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
| 10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
| (...skipping 3256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3267 } | 3267 } |
| 3268 | 3268 |
| 3269 | 3269 |
| 3270 void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LMathAbs* instr) { | 3270 void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LMathAbs* instr) { |
| 3271 Register input_reg = ToRegister(instr->value()); | 3271 Register input_reg = ToRegister(instr->value()); |
| 3272 __ CompareRoot(FieldOperand(input_reg, HeapObject::kMapOffset), | 3272 __ CompareRoot(FieldOperand(input_reg, HeapObject::kMapOffset), |
| 3273 Heap::kHeapNumberMapRootIndex); | 3273 Heap::kHeapNumberMapRootIndex); |
| 3274 DeoptimizeIf(not_equal, instr, Deoptimizer::kNotAHeapNumber); | 3274 DeoptimizeIf(not_equal, instr, Deoptimizer::kNotAHeapNumber); |
| 3275 | 3275 |
| 3276 Label slow, allocated, done; | 3276 Label slow, allocated, done; |
| 3277 Register tmp = input_reg.is(rax) ? rcx : rax; | 3277 uint32_t available_regs = rax.bit() | rcx.bit() | rdx.bit() | rbx.bit(); |
| 3278 Register tmp2 = tmp.is(rcx) ? rdx : input_reg.is(rcx) ? rdx : rcx; | 3278 available_regs &= ~input_reg.bit(); |
| 3279 if (instr->context()->IsRegister()) { |
| 3280 // Make sure that the context isn't overwritten in the AllocateHeapNumber |
| 3281 // macro below. |
| 3282 available_regs &= ~ToRegister(instr->context()).bit(); |
| 3283 } |
| 3284 |
| 3285 Register tmp = |
| 3286 Register::from_code(base::bits::CountTrailingZeros32(available_regs)); |
| 3287 available_regs &= ~tmp.bit(); |
| 3288 Register tmp2 = |
| 3289 Register::from_code(base::bits::CountTrailingZeros32(available_regs)); |
| 3279 | 3290 |
| 3280 // Preserve the value of all registers. | 3291 // Preserve the value of all registers. |
| 3281 PushSafepointRegistersScope scope(this); | 3292 PushSafepointRegistersScope scope(this); |
| 3282 | 3293 |
| 3283 __ movl(tmp, FieldOperand(input_reg, HeapNumber::kExponentOffset)); | 3294 __ movl(tmp, FieldOperand(input_reg, HeapNumber::kExponentOffset)); |
| 3284 // Check the sign of the argument. If the argument is positive, just | 3295 // Check the sign of the argument. If the argument is positive, just |
| 3285 // return it. We do not need to patch the stack since |input| and | 3296 // return it. We do not need to patch the stack since |input| and |
| 3286 // |result| are the same register and |input| will be restored | 3297 // |result| are the same register and |input| will be restored |
| 3287 // unchanged by popping safepoint registers. | 3298 // unchanged by popping safepoint registers. |
| 3288 __ testl(tmp, Immediate(HeapNumber::kSignMask)); | 3299 __ testl(tmp, Immediate(HeapNumber::kSignMask)); |
| (...skipping 2335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5624 __ bind(deferred->exit()); | 5635 __ bind(deferred->exit()); |
| 5625 __ bind(&done); | 5636 __ bind(&done); |
| 5626 } | 5637 } |
| 5627 | 5638 |
| 5628 #undef __ | 5639 #undef __ |
| 5629 | 5640 |
| 5630 } // namespace internal | 5641 } // namespace internal |
| 5631 } // namespace v8 | 5642 } // namespace v8 |
| 5632 | 5643 |
| 5633 #endif // V8_TARGET_ARCH_X64 | 5644 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |