Chromium Code Reviews| 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 = 0xf; |
| 3352 Register tmp2 = tmp.is(ecx) ? edx : input_reg.is(ecx) ? edx : ecx; | 3352 if (input_reg.code() < 4) 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 Register context_reg = ToRegister(instr->context()); | |
| 3357 if (context_reg.code() < 4) available_regs ^= context_reg.bit(); | |
| 3358 } | |
| 3359 | |
| 3360 Register tmp = | |
| 3361 Register::from_code(base::bits::CountTrailingZeros32(available_regs)); | |
| 3362 available_regs ^= tmp.bit(); | |
| 3363 Register tmp2 = | |
| 3364 Register::from_code(base::bits::CountTrailingZeros32(available_regs)); | |
|
Jarin
2016/06/03 19:08:17
I am not quite happy about hardcoding the integer
| |
| 3353 | 3365 |
| 3354 // Preserve the value of all registers. | 3366 // Preserve the value of all registers. |
| 3355 PushSafepointRegistersScope scope(this); | 3367 PushSafepointRegistersScope scope(this); |
| 3356 | 3368 |
| 3357 __ mov(tmp, FieldOperand(input_reg, HeapNumber::kExponentOffset)); | 3369 __ mov(tmp, FieldOperand(input_reg, HeapNumber::kExponentOffset)); |
| 3358 // Check the sign of the argument. If the argument is positive, just | 3370 // 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 | 3371 // return it. We do not need to patch the stack since |input| and |
| 3360 // |result| are the same register and |input| will be restored | 3372 // |result| are the same register and |input| will be restored |
| 3361 // unchanged by popping safepoint registers. | 3373 // unchanged by popping safepoint registers. |
| 3362 __ test(tmp, Immediate(HeapNumber::kSignMask)); | 3374 __ test(tmp, Immediate(HeapNumber::kSignMask)); |
| (...skipping 2493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5856 __ bind(deferred->exit()); | 5868 __ bind(deferred->exit()); |
| 5857 __ bind(&done); | 5869 __ bind(&done); |
| 5858 } | 5870 } |
| 5859 | 5871 |
| 5860 #undef __ | 5872 #undef __ |
| 5861 | 5873 |
| 5862 } // namespace internal | 5874 } // namespace internal |
| 5863 } // namespace v8 | 5875 } // namespace v8 |
| 5864 | 5876 |
| 5865 #endif // V8_TARGET_ARCH_X87 | 5877 #endif // V8_TARGET_ARCH_X87 |
| OLD | NEW |