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 3054 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3065 } | 3065 } |
3066 | 3066 |
3067 | 3067 |
3068 void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LMathAbs* instr) { | 3068 void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LMathAbs* instr) { |
3069 Register input_reg = ToRegister(instr->value()); | 3069 Register input_reg = ToRegister(instr->value()); |
3070 __ cmp(FieldOperand(input_reg, HeapObject::kMapOffset), | 3070 __ cmp(FieldOperand(input_reg, HeapObject::kMapOffset), |
3071 factory()->heap_number_map()); | 3071 factory()->heap_number_map()); |
3072 DeoptimizeIf(not_equal, instr, Deoptimizer::kNotAHeapNumber); | 3072 DeoptimizeIf(not_equal, instr, Deoptimizer::kNotAHeapNumber); |
3073 | 3073 |
3074 Label slow, allocated, done; | 3074 Label slow, allocated, done; |
3075 Register tmp = input_reg.is(eax) ? ecx : eax; | 3075 uint32_t available_regs = eax.bit() | ecx.bit() | edx.bit() | ebx.bit(); |
3076 Register tmp2 = tmp.is(ecx) ? edx : input_reg.is(ecx) ? edx : ecx; | 3076 available_regs &= ~input_reg.bit(); |
| 3077 if (instr->context()->IsRegister()) { |
| 3078 // Make sure that the context isn't overwritten in the AllocateHeapNumber |
| 3079 // macro below. |
| 3080 available_regs &= ~ToRegister(instr->context()).bit(); |
| 3081 } |
| 3082 |
| 3083 Register tmp = |
| 3084 Register::from_code(base::bits::CountTrailingZeros32(available_regs)); |
| 3085 available_regs &= ~tmp.bit(); |
| 3086 Register tmp2 = |
| 3087 Register::from_code(base::bits::CountTrailingZeros32(available_regs)); |
3077 | 3088 |
3078 // Preserve the value of all registers. | 3089 // Preserve the value of all registers. |
3079 PushSafepointRegistersScope scope(this); | 3090 PushSafepointRegistersScope scope(this); |
3080 | 3091 |
3081 __ mov(tmp, FieldOperand(input_reg, HeapNumber::kExponentOffset)); | 3092 __ mov(tmp, FieldOperand(input_reg, HeapNumber::kExponentOffset)); |
3082 // Check the sign of the argument. If the argument is positive, just | 3093 // Check the sign of the argument. If the argument is positive, just |
3083 // return it. We do not need to patch the stack since |input| and | 3094 // return it. We do not need to patch the stack since |input| and |
3084 // |result| are the same register and |input| will be restored | 3095 // |result| are the same register and |input| will be restored |
3085 // unchanged by popping safepoint registers. | 3096 // unchanged by popping safepoint registers. |
3086 __ test(tmp, Immediate(HeapNumber::kSignMask)); | 3097 __ test(tmp, Immediate(HeapNumber::kSignMask)); |
(...skipping 2222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5309 __ bind(deferred->exit()); | 5320 __ bind(deferred->exit()); |
5310 __ bind(&done); | 5321 __ bind(&done); |
5311 } | 5322 } |
5312 | 5323 |
5313 #undef __ | 5324 #undef __ |
5314 | 5325 |
5315 } // namespace internal | 5326 } // namespace internal |
5316 } // namespace v8 | 5327 } // namespace v8 |
5317 | 5328 |
5318 #endif // V8_TARGET_ARCH_IA32 | 5329 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |