| 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_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
| 6 | 6 |
| 7 #include "src/crankshaft/ia32/lithium-codegen-ia32.h" | 7 #include "src/crankshaft/ia32/lithium-codegen-ia32.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 3060 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3071 } | 3071 } |
| 3072 | 3072 |
| 3073 | 3073 |
| 3074 void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LMathAbs* instr) { | 3074 void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LMathAbs* instr) { |
| 3075 Register input_reg = ToRegister(instr->value()); | 3075 Register input_reg = ToRegister(instr->value()); |
| 3076 __ cmp(FieldOperand(input_reg, HeapObject::kMapOffset), | 3076 __ cmp(FieldOperand(input_reg, HeapObject::kMapOffset), |
| 3077 factory()->heap_number_map()); | 3077 factory()->heap_number_map()); |
| 3078 DeoptimizeIf(not_equal, instr, Deoptimizer::kNotAHeapNumber); | 3078 DeoptimizeIf(not_equal, instr, Deoptimizer::kNotAHeapNumber); |
| 3079 | 3079 |
| 3080 Label slow, allocated, done; | 3080 Label slow, allocated, done; |
| 3081 Register tmp = input_reg.is(eax) ? ecx : eax; | 3081 uint32_t available_regs = eax.bit() | ecx.bit() | edx.bit() | ebx.bit(); |
| 3082 Register tmp2 = tmp.is(ecx) ? edx : input_reg.is(ecx) ? edx : ecx; | 3082 available_regs &= ~input_reg.bit(); |
| 3083 if (instr->context()->IsRegister()) { |
| 3084 // Make sure that the context isn't overwritten in the AllocateHeapNumber |
| 3085 // macro below. |
| 3086 available_regs &= ~ToRegister(instr->context()).bit(); |
| 3087 } |
| 3088 |
| 3089 Register tmp = |
| 3090 Register::from_code(base::bits::CountTrailingZeros32(available_regs)); |
| 3091 available_regs &= ~tmp.bit(); |
| 3092 Register tmp2 = |
| 3093 Register::from_code(base::bits::CountTrailingZeros32(available_regs)); |
| 3083 | 3094 |
| 3084 // Preserve the value of all registers. | 3095 // Preserve the value of all registers. |
| 3085 PushSafepointRegistersScope scope(this); | 3096 PushSafepointRegistersScope scope(this); |
| 3086 | 3097 |
| 3087 __ mov(tmp, FieldOperand(input_reg, HeapNumber::kExponentOffset)); | 3098 __ mov(tmp, FieldOperand(input_reg, HeapNumber::kExponentOffset)); |
| 3088 // Check the sign of the argument. If the argument is positive, just | 3099 // Check the sign of the argument. If the argument is positive, just |
| 3089 // return it. We do not need to patch the stack since |input| and | 3100 // return it. We do not need to patch the stack since |input| and |
| 3090 // |result| are the same register and |input| will be restored | 3101 // |result| are the same register and |input| will be restored |
| 3091 // unchanged by popping safepoint registers. | 3102 // unchanged by popping safepoint registers. |
| 3092 __ test(tmp, Immediate(HeapNumber::kSignMask)); | 3103 __ test(tmp, Immediate(HeapNumber::kSignMask)); |
| (...skipping 2226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5319 __ bind(deferred->exit()); | 5330 __ bind(deferred->exit()); |
| 5320 __ bind(&done); | 5331 __ bind(&done); |
| 5321 } | 5332 } |
| 5322 | 5333 |
| 5323 #undef __ | 5334 #undef __ |
| 5324 | 5335 |
| 5325 } // namespace internal | 5336 } // namespace internal |
| 5326 } // namespace v8 | 5337 } // namespace v8 |
| 5327 | 5338 |
| 5328 #endif // V8_TARGET_ARCH_IA32 | 5339 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |