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 "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_X64 | 7 #if V8_TARGET_ARCH_X64 |
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 3967 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3978 | 3978 |
3979 void LCodeGen::DoMathLog(LMathLog* instr) { | 3979 void LCodeGen::DoMathLog(LMathLog* instr) { |
3980 DCHECK(instr->value()->Equals(instr->result())); | 3980 DCHECK(instr->value()->Equals(instr->result())); |
3981 XMMRegister input_reg = ToDoubleRegister(instr->value()); | 3981 XMMRegister input_reg = ToDoubleRegister(instr->value()); |
3982 XMMRegister xmm_scratch = double_scratch0(); | 3982 XMMRegister xmm_scratch = double_scratch0(); |
3983 Label positive, done, zero; | 3983 Label positive, done, zero; |
3984 __ xorps(xmm_scratch, xmm_scratch); | 3984 __ xorps(xmm_scratch, xmm_scratch); |
3985 __ ucomisd(input_reg, xmm_scratch); | 3985 __ ucomisd(input_reg, xmm_scratch); |
3986 __ j(above, &positive, Label::kNear); | 3986 __ j(above, &positive, Label::kNear); |
3987 __ j(not_carry, &zero, Label::kNear); | 3987 __ j(not_carry, &zero, Label::kNear); |
3988 ExternalReference nan = | 3988 if (CpuFeatures::IsSupported(AVX)) { |
3989 ExternalReference::address_of_canonical_non_hole_nan(); | 3989 CpuFeatureScope scope2(masm(), AVX); |
3990 Operand nan_operand = masm()->ExternalOperand(nan); | 3990 __ vdivsd(input_reg, xmm_scratch, xmm_scratch); |
3991 __ movsd(input_reg, nan_operand); | 3991 } else { |
| 3992 __ divsd(xmm_scratch, xmm_scratch); |
| 3993 __ movsd(input_reg, xmm_scratch); |
| 3994 } |
3992 __ jmp(&done, Label::kNear); | 3995 __ jmp(&done, Label::kNear); |
3993 __ bind(&zero); | 3996 __ bind(&zero); |
3994 ExternalReference ninf = | 3997 ExternalReference ninf = |
3995 ExternalReference::address_of_negative_infinity(); | 3998 ExternalReference::address_of_negative_infinity(); |
3996 Operand ninf_operand = masm()->ExternalOperand(ninf); | 3999 Operand ninf_operand = masm()->ExternalOperand(ninf); |
3997 __ movsd(input_reg, ninf_operand); | 4000 __ movsd(input_reg, ninf_operand); |
3998 __ jmp(&done, Label::kNear); | 4001 __ jmp(&done, Label::kNear); |
3999 __ bind(&positive); | 4002 __ bind(&positive); |
4000 __ fldln2(); | 4003 __ fldln2(); |
4001 __ subp(rsp, Immediate(kDoubleSize)); | 4004 __ subp(rsp, Immediate(kDoubleSize)); |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4405 void LCodeGen::DoStoreKeyedFixedDoubleArray(LStoreKeyed* instr) { | 4408 void LCodeGen::DoStoreKeyedFixedDoubleArray(LStoreKeyed* instr) { |
4406 XMMRegister value = ToDoubleRegister(instr->value()); | 4409 XMMRegister value = ToDoubleRegister(instr->value()); |
4407 LOperand* key = instr->key(); | 4410 LOperand* key = instr->key(); |
4408 if (kPointerSize == kInt32Size && !key->IsConstantOperand() && | 4411 if (kPointerSize == kInt32Size && !key->IsConstantOperand() && |
4409 instr->hydrogen()->IsDehoisted()) { | 4412 instr->hydrogen()->IsDehoisted()) { |
4410 // Sign extend key because it could be a 32 bit negative value | 4413 // Sign extend key because it could be a 32 bit negative value |
4411 // and the dehoisted address computation happens in 64 bits | 4414 // and the dehoisted address computation happens in 64 bits |
4412 __ movsxlq(ToRegister(key), ToRegister(key)); | 4415 __ movsxlq(ToRegister(key), ToRegister(key)); |
4413 } | 4416 } |
4414 if (instr->NeedsCanonicalization()) { | 4417 if (instr->NeedsCanonicalization()) { |
4415 Label have_value; | 4418 XMMRegister xmm_scratch = double_scratch0(); |
4416 | 4419 // Turn potential sNaN value into qNaN. |
4417 __ ucomisd(value, value); | 4420 __ xorps(xmm_scratch, xmm_scratch); |
4418 __ j(parity_odd, &have_value, Label::kNear); // NaN. | 4421 __ subsd(value, xmm_scratch); |
4419 | |
4420 __ Set(kScratchRegister, | |
4421 bit_cast<uint64_t>( | |
4422 FixedDoubleArray::canonical_not_the_hole_nan_as_double())); | |
4423 __ movq(value, kScratchRegister); | |
4424 | |
4425 __ bind(&have_value); | |
4426 } | 4422 } |
4427 | 4423 |
4428 Operand double_store_operand = BuildFastArrayOperand( | 4424 Operand double_store_operand = BuildFastArrayOperand( |
4429 instr->elements(), | 4425 instr->elements(), |
4430 key, | 4426 key, |
4431 instr->hydrogen()->key()->representation(), | 4427 instr->hydrogen()->key()->representation(), |
4432 FAST_DOUBLE_ELEMENTS, | 4428 FAST_DOUBLE_ELEMENTS, |
4433 instr->base_offset()); | 4429 instr->base_offset()); |
4434 | 4430 |
4435 __ movsd(double_store_operand, value); | 4431 __ movsd(double_store_operand, value); |
(...skipping 1495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5931 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5927 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
5932 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5928 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5933 } | 5929 } |
5934 | 5930 |
5935 | 5931 |
5936 #undef __ | 5932 #undef __ |
5937 | 5933 |
5938 } } // namespace v8::internal | 5934 } } // namespace v8::internal |
5939 | 5935 |
5940 #endif // V8_TARGET_ARCH_X64 | 5936 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |