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 = 0xf; |
Jarin
2016/06/06 08:09:22
uint32_t available_regs = eax.bit() | ebx.bit() |
| |
3076 Register tmp2 = tmp.is(ecx) ? edx : input_reg.is(ecx) ? edx : ecx; | 3076 if (input_reg.code() < 4) available_regs ^= input_reg.bit(); |
Jarin
2016/06/06 08:09:22
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 Register context_reg = ToRegister(instr->context()); | |
3081 if (context_reg.code() < 4) available_regs ^= context_reg.bit(); | |
Jarin
2016/06/06 08:09:21
available_regs &= ~context_reg.bit();
| |
3082 } | |
3083 | |
3084 Register tmp = | |
3085 Register::from_code(base::bits::CountTrailingZeros32(available_regs)); | |
3086 available_regs ^= tmp.bit(); | |
Jarin
2016/06/06 08:09:22
For consistency, may even here:
DCHECK(available_
| |
3087 Register tmp2 = | |
3088 Register::from_code(base::bits::CountTrailingZeros32(available_regs)); | |
Jarin
2016/06/06 08:09:22
DCHECK(available_regs & tmp2.bit());
| |
3077 | 3089 |
3078 // Preserve the value of all registers. | 3090 // Preserve the value of all registers. |
3079 PushSafepointRegistersScope scope(this); | 3091 PushSafepointRegistersScope scope(this); |
3080 | 3092 |
3081 __ mov(tmp, FieldOperand(input_reg, HeapNumber::kExponentOffset)); | 3093 __ mov(tmp, FieldOperand(input_reg, HeapNumber::kExponentOffset)); |
3082 // Check the sign of the argument. If the argument is positive, just | 3094 // 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 | 3095 // return it. We do not need to patch the stack since |input| and |
3084 // |result| are the same register and |input| will be restored | 3096 // |result| are the same register and |input| will be restored |
3085 // unchanged by popping safepoint registers. | 3097 // unchanged by popping safepoint registers. |
3086 __ test(tmp, Immediate(HeapNumber::kSignMask)); | 3098 __ test(tmp, Immediate(HeapNumber::kSignMask)); |
(...skipping 2222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5309 __ bind(deferred->exit()); | 5321 __ bind(deferred->exit()); |
5310 __ bind(&done); | 5322 __ bind(&done); |
5311 } | 5323 } |
5312 | 5324 |
5313 #undef __ | 5325 #undef __ |
5314 | 5326 |
5315 } // namespace internal | 5327 } // namespace internal |
5316 } // namespace v8 | 5328 } // namespace v8 |
5317 | 5329 |
5318 #endif // V8_TARGET_ARCH_IA32 | 5330 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |