OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 "v8.h" | 5 #include "v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_X64 | 7 #if V8_TARGET_ARCH_X64 |
8 | 8 |
9 #include "x64/lithium-codegen-x64.h" | 9 #include "x64/lithium-codegen-x64.h" |
10 #include "code-stubs.h" | 10 #include "code-stubs.h" |
(...skipping 3707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3718 __ testq(output_reg, output_reg); | 3718 __ testq(output_reg, output_reg); |
3719 __ RecordComment("Minus zero"); | 3719 __ RecordComment("Minus zero"); |
3720 DeoptimizeIf(negative, instr->environment()); | 3720 DeoptimizeIf(negative, instr->environment()); |
3721 } | 3721 } |
3722 __ Set(output_reg, 0); | 3722 __ Set(output_reg, 0); |
3723 __ bind(&done); | 3723 __ bind(&done); |
3724 } | 3724 } |
3725 | 3725 |
3726 | 3726 |
3727 void LCodeGen::DoMathSqrt(LMathSqrt* instr) { | 3727 void LCodeGen::DoMathSqrt(LMathSqrt* instr) { |
3728 XMMRegister input_reg = ToDoubleRegister(instr->value()); | 3728 XMMRegister output = ToDoubleRegister(instr->result()); |
3729 ASSERT(ToDoubleRegister(instr->result()).is(input_reg)); | 3729 if (instr->value()->IsDoubleRegister()) { |
3730 __ sqrtsd(input_reg, input_reg); | 3730 XMMRegister input = ToDoubleRegister(instr->value()); |
| 3731 __ sqrtsd(output, input); |
| 3732 } else { |
| 3733 Operand input = ToOperand(instr->value()); |
| 3734 __ sqrtsd(output, input); |
| 3735 } |
3731 } | 3736 } |
3732 | 3737 |
3733 | 3738 |
3734 void LCodeGen::DoMathPowHalf(LMathPowHalf* instr) { | 3739 void LCodeGen::DoMathPowHalf(LMathPowHalf* instr) { |
3735 XMMRegister xmm_scratch = double_scratch0(); | 3740 XMMRegister xmm_scratch = double_scratch0(); |
3736 XMMRegister input_reg = ToDoubleRegister(instr->value()); | 3741 XMMRegister input_reg = ToDoubleRegister(instr->value()); |
3737 ASSERT(ToDoubleRegister(instr->result()).is(input_reg)); | 3742 ASSERT(ToDoubleRegister(instr->result()).is(input_reg)); |
3738 | 3743 |
3739 // Note that according to ECMA-262 15.8.2.13: | 3744 // Note that according to ECMA-262 15.8.2.13: |
3740 // Math.pow(-Infinity, 0.5) == Infinity | 3745 // Math.pow(-Infinity, 0.5) == Infinity |
(...skipping 1965 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5706 __ bind(deferred->exit()); | 5711 __ bind(deferred->exit()); |
5707 __ bind(&done); | 5712 __ bind(&done); |
5708 } | 5713 } |
5709 | 5714 |
5710 | 5715 |
5711 #undef __ | 5716 #undef __ |
5712 | 5717 |
5713 } } // namespace v8::internal | 5718 } } // namespace v8::internal |
5714 | 5719 |
5715 #endif // V8_TARGET_ARCH_X64 | 5720 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |