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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 3779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3790 __ addsd(input_reg, xmm_scratch); // Convert -0 to +0. | 3790 __ addsd(input_reg, xmm_scratch); // Convert -0 to +0. |
3791 __ sqrtsd(input_reg, input_reg); | 3791 __ sqrtsd(input_reg, input_reg); |
3792 __ bind(&done); | 3792 __ bind(&done); |
3793 } | 3793 } |
3794 | 3794 |
3795 | 3795 |
3796 void LCodeGen::DoPower(LPower* instr) { | 3796 void LCodeGen::DoPower(LPower* instr) { |
3797 Representation exponent_type = instr->hydrogen()->right()->representation(); | 3797 Representation exponent_type = instr->hydrogen()->right()->representation(); |
3798 // Having marked this as a call, we can use any registers. | 3798 // Having marked this as a call, we can use any registers. |
3799 // Just make sure that the input/output registers are the expected ones. | 3799 // Just make sure that the input/output registers are the expected ones. |
| 3800 Register tagged_exponent = MathPowTaggedDescriptor::exponent(); |
3800 DCHECK(!instr->right()->IsDoubleRegister() || | 3801 DCHECK(!instr->right()->IsDoubleRegister() || |
3801 ToDoubleRegister(instr->right()).is(xmm1)); | 3802 ToDoubleRegister(instr->right()).is(xmm1)); |
3802 DCHECK(!instr->right()->IsRegister() || | 3803 DCHECK(!instr->right()->IsRegister() || |
3803 ToRegister(instr->right()).is(eax)); | 3804 ToRegister(instr->right()).is(tagged_exponent)); |
3804 DCHECK(ToDoubleRegister(instr->left()).is(xmm2)); | 3805 DCHECK(ToDoubleRegister(instr->left()).is(xmm2)); |
3805 DCHECK(ToDoubleRegister(instr->result()).is(xmm3)); | 3806 DCHECK(ToDoubleRegister(instr->result()).is(xmm3)); |
3806 | 3807 |
3807 if (exponent_type.IsSmi()) { | 3808 if (exponent_type.IsSmi()) { |
3808 MathPowStub stub(isolate(), MathPowStub::TAGGED); | 3809 MathPowStub stub(isolate(), MathPowStub::TAGGED); |
3809 __ CallStub(&stub); | 3810 __ CallStub(&stub); |
3810 } else if (exponent_type.IsTagged()) { | 3811 } else if (exponent_type.IsTagged()) { |
3811 Label no_deopt; | 3812 Label no_deopt; |
3812 __ JumpIfSmi(eax, &no_deopt); | 3813 __ JumpIfSmi(tagged_exponent, &no_deopt); |
3813 __ CmpObjectType(eax, HEAP_NUMBER_TYPE, ecx); | 3814 DCHECK(!ecx.is(tagged_exponent)); |
| 3815 __ CmpObjectType(tagged_exponent, HEAP_NUMBER_TYPE, ecx); |
3814 DeoptimizeIf(not_equal, instr->environment()); | 3816 DeoptimizeIf(not_equal, instr->environment()); |
3815 __ bind(&no_deopt); | 3817 __ bind(&no_deopt); |
3816 MathPowStub stub(isolate(), MathPowStub::TAGGED); | 3818 MathPowStub stub(isolate(), MathPowStub::TAGGED); |
3817 __ CallStub(&stub); | 3819 __ CallStub(&stub); |
3818 } else if (exponent_type.IsInteger32()) { | 3820 } else if (exponent_type.IsInteger32()) { |
3819 MathPowStub stub(isolate(), MathPowStub::INTEGER); | 3821 MathPowStub stub(isolate(), MathPowStub::INTEGER); |
3820 __ CallStub(&stub); | 3822 __ CallStub(&stub); |
3821 } else { | 3823 } else { |
3822 DCHECK(exponent_type.IsDouble()); | 3824 DCHECK(exponent_type.IsDouble()); |
3823 MathPowStub stub(isolate(), MathPowStub::DOUBLE); | 3825 MathPowStub stub(isolate(), MathPowStub::DOUBLE); |
(...skipping 1870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5694 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5696 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
5695 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5697 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5696 } | 5698 } |
5697 | 5699 |
5698 | 5700 |
5699 #undef __ | 5701 #undef __ |
5700 | 5702 |
5701 } } // namespace v8::internal | 5703 } } // namespace v8::internal |
5702 | 5704 |
5703 #endif // V8_TARGET_ARCH_IA32 | 5705 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |