| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_X87 | 5 #if V8_TARGET_ARCH_X87 |
| 6 | 6 |
| 7 #include "src/crankshaft/x87/lithium-codegen-x87.h" | 7 #include "src/crankshaft/x87/lithium-codegen-x87.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 3330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3341 } | 3341 } |
| 3342 | 3342 |
| 3343 | 3343 |
| 3344 void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LMathAbs* instr) { | 3344 void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LMathAbs* instr) { |
| 3345 Register input_reg = ToRegister(instr->value()); | 3345 Register input_reg = ToRegister(instr->value()); |
| 3346 __ cmp(FieldOperand(input_reg, HeapObject::kMapOffset), | 3346 __ cmp(FieldOperand(input_reg, HeapObject::kMapOffset), |
| 3347 factory()->heap_number_map()); | 3347 factory()->heap_number_map()); |
| 3348 DeoptimizeIf(not_equal, instr, Deoptimizer::kNotAHeapNumber); | 3348 DeoptimizeIf(not_equal, instr, Deoptimizer::kNotAHeapNumber); |
| 3349 | 3349 |
| 3350 Label slow, allocated, done; | 3350 Label slow, allocated, done; |
| 3351 Register tmp = input_reg.is(eax) ? ecx : eax; | 3351 uint32_t available_regs = eax.bit() | ecx.bit() | edx.bit() | ebx.bit(); |
| 3352 Register tmp2 = tmp.is(ecx) ? edx : input_reg.is(ecx) ? edx : ecx; | 3352 available_regs &= ~input_reg.bit(); |
| 3353 if (instr->context()->IsRegister()) { |
| 3354 // Make sure that the context isn't overwritten in the AllocateHeapNumber |
| 3355 // macro below. |
| 3356 available_regs &= ~ToRegister(instr->context()).bit(); |
| 3357 } |
| 3358 |
| 3359 Register tmp = |
| 3360 Register::from_code(base::bits::CountTrailingZeros32(available_regs)); |
| 3361 available_regs &= ~tmp.bit(); |
| 3362 Register tmp2 = |
| 3363 Register::from_code(base::bits::CountTrailingZeros32(available_regs)); |
| 3353 | 3364 |
| 3354 // Preserve the value of all registers. | 3365 // Preserve the value of all registers. |
| 3355 PushSafepointRegistersScope scope(this); | 3366 PushSafepointRegistersScope scope(this); |
| 3356 | 3367 |
| 3357 __ mov(tmp, FieldOperand(input_reg, HeapNumber::kExponentOffset)); | 3368 __ mov(tmp, FieldOperand(input_reg, HeapNumber::kExponentOffset)); |
| 3358 // Check the sign of the argument. If the argument is positive, just | 3369 // Check the sign of the argument. If the argument is positive, just |
| 3359 // return it. We do not need to patch the stack since |input| and | 3370 // return it. We do not need to patch the stack since |input| and |
| 3360 // |result| are the same register and |input| will be restored | 3371 // |result| are the same register and |input| will be restored |
| 3361 // unchanged by popping safepoint registers. | 3372 // unchanged by popping safepoint registers. |
| 3362 __ test(tmp, Immediate(HeapNumber::kSignMask)); | 3373 __ test(tmp, Immediate(HeapNumber::kSignMask)); |
| (...skipping 2493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5856 __ bind(deferred->exit()); | 5867 __ bind(deferred->exit()); |
| 5857 __ bind(&done); | 5868 __ bind(&done); |
| 5858 } | 5869 } |
| 5859 | 5870 |
| 5860 #undef __ | 5871 #undef __ |
| 5861 | 5872 |
| 5862 } // namespace internal | 5873 } // namespace internal |
| 5863 } // namespace v8 | 5874 } // namespace v8 |
| 5864 | 5875 |
| 5865 #endif // V8_TARGET_ARCH_X87 | 5876 #endif // V8_TARGET_ARCH_X87 |
| OLD | NEW |