| 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 3338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3349 } | 3349 } |
| 3350 | 3350 |
| 3351 | 3351 |
| 3352 void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LMathAbs* instr) { | 3352 void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LMathAbs* instr) { |
| 3353 Register input_reg = ToRegister(instr->value()); | 3353 Register input_reg = ToRegister(instr->value()); |
| 3354 __ cmp(FieldOperand(input_reg, HeapObject::kMapOffset), | 3354 __ cmp(FieldOperand(input_reg, HeapObject::kMapOffset), |
| 3355 factory()->heap_number_map()); | 3355 factory()->heap_number_map()); |
| 3356 DeoptimizeIf(not_equal, instr, Deoptimizer::kNotAHeapNumber); | 3356 DeoptimizeIf(not_equal, instr, Deoptimizer::kNotAHeapNumber); |
| 3357 | 3357 |
| 3358 Label slow, allocated, done; | 3358 Label slow, allocated, done; |
| 3359 Register tmp = input_reg.is(eax) ? ecx : eax; | 3359 uint32_t available_regs = eax.bit() | ecx.bit() | edx.bit() | ebx.bit(); |
| 3360 Register tmp2 = tmp.is(ecx) ? edx : input_reg.is(ecx) ? edx : ecx; | 3360 available_regs &= ~input_reg.bit(); |
| 3361 if (instr->context()->IsRegister()) { |
| 3362 // Make sure that the context isn't overwritten in the AllocateHeapNumber |
| 3363 // macro below. |
| 3364 available_regs &= ~ToRegister(instr->context()).bit(); |
| 3365 } |
| 3366 |
| 3367 Register tmp = |
| 3368 Register::from_code(base::bits::CountTrailingZeros32(available_regs)); |
| 3369 available_regs &= ~tmp.bit(); |
| 3370 Register tmp2 = |
| 3371 Register::from_code(base::bits::CountTrailingZeros32(available_regs)); |
| 3361 | 3372 |
| 3362 // Preserve the value of all registers. | 3373 // Preserve the value of all registers. |
| 3363 PushSafepointRegistersScope scope(this); | 3374 PushSafepointRegistersScope scope(this); |
| 3364 | 3375 |
| 3365 __ mov(tmp, FieldOperand(input_reg, HeapNumber::kExponentOffset)); | 3376 __ mov(tmp, FieldOperand(input_reg, HeapNumber::kExponentOffset)); |
| 3366 // Check the sign of the argument. If the argument is positive, just | 3377 // Check the sign of the argument. If the argument is positive, just |
| 3367 // return it. We do not need to patch the stack since |input| and | 3378 // return it. We do not need to patch the stack since |input| and |
| 3368 // |result| are the same register and |input| will be restored | 3379 // |result| are the same register and |input| will be restored |
| 3369 // unchanged by popping safepoint registers. | 3380 // unchanged by popping safepoint registers. |
| 3370 __ test(tmp, Immediate(HeapNumber::kSignMask)); | 3381 __ test(tmp, Immediate(HeapNumber::kSignMask)); |
| (...skipping 2501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5872 __ bind(deferred->exit()); | 5883 __ bind(deferred->exit()); |
| 5873 __ bind(&done); | 5884 __ bind(&done); |
| 5874 } | 5885 } |
| 5875 | 5886 |
| 5876 #undef __ | 5887 #undef __ |
| 5877 | 5888 |
| 5878 } // namespace internal | 5889 } // namespace internal |
| 5879 } // namespace v8 | 5890 } // namespace v8 |
| 5880 | 5891 |
| 5881 #endif // V8_TARGET_ARCH_X87 | 5892 #endif // V8_TARGET_ARCH_X87 |
| OLD | NEW |