Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: src/x64/lithium-codegen-x64.cc

Issue 863633002: Use signaling NaN for holes in fixed double arrays. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Next bunch of fixes Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 3945 matching lines...) Expand 10 before | Expand all | Expand 10 after
3956 3956
3957 void LCodeGen::DoMathLog(LMathLog* instr) { 3957 void LCodeGen::DoMathLog(LMathLog* instr) {
3958 DCHECK(instr->value()->Equals(instr->result())); 3958 DCHECK(instr->value()->Equals(instr->result()));
3959 XMMRegister input_reg = ToDoubleRegister(instr->value()); 3959 XMMRegister input_reg = ToDoubleRegister(instr->value());
3960 XMMRegister xmm_scratch = double_scratch0(); 3960 XMMRegister xmm_scratch = double_scratch0();
3961 Label positive, done, zero; 3961 Label positive, done, zero;
3962 __ xorps(xmm_scratch, xmm_scratch); 3962 __ xorps(xmm_scratch, xmm_scratch);
3963 __ ucomisd(input_reg, xmm_scratch); 3963 __ ucomisd(input_reg, xmm_scratch);
3964 __ j(above, &positive, Label::kNear); 3964 __ j(above, &positive, Label::kNear);
3965 __ j(not_carry, &zero, Label::kNear); 3965 __ j(not_carry, &zero, Label::kNear);
3966 ExternalReference nan = 3966 if (CpuFeatures::IsSupported(AVX)) {
3967 ExternalReference::address_of_canonical_non_hole_nan(); 3967 CpuFeatureScope scope2(masm(), AVX);
3968 Operand nan_operand = masm()->ExternalOperand(nan); 3968 __ vdivsd(input_reg, xmm_scratch, xmm_scratch);
3969 __ movsd(input_reg, nan_operand); 3969 } else {
3970 __ divsd(xmm_scratch, xmm_scratch);
3971 __ movsd(input_reg, xmm_scratch);
3972 }
3970 __ jmp(&done, Label::kNear); 3973 __ jmp(&done, Label::kNear);
3971 __ bind(&zero); 3974 __ bind(&zero);
3972 ExternalReference ninf = 3975 ExternalReference ninf =
3973 ExternalReference::address_of_negative_infinity(); 3976 ExternalReference::address_of_negative_infinity();
3974 Operand ninf_operand = masm()->ExternalOperand(ninf); 3977 Operand ninf_operand = masm()->ExternalOperand(ninf);
3975 __ movsd(input_reg, ninf_operand); 3978 __ movsd(input_reg, ninf_operand);
3976 __ jmp(&done, Label::kNear); 3979 __ jmp(&done, Label::kNear);
3977 __ bind(&positive); 3980 __ bind(&positive);
3978 __ fldln2(); 3981 __ fldln2();
3979 __ subp(rsp, Immediate(kDoubleSize)); 3982 __ subp(rsp, Immediate(kDoubleSize));
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
4383 void LCodeGen::DoStoreKeyedFixedDoubleArray(LStoreKeyed* instr) { 4386 void LCodeGen::DoStoreKeyedFixedDoubleArray(LStoreKeyed* instr) {
4384 XMMRegister value = ToDoubleRegister(instr->value()); 4387 XMMRegister value = ToDoubleRegister(instr->value());
4385 LOperand* key = instr->key(); 4388 LOperand* key = instr->key();
4386 if (kPointerSize == kInt32Size && !key->IsConstantOperand() && 4389 if (kPointerSize == kInt32Size && !key->IsConstantOperand() &&
4387 instr->hydrogen()->IsDehoisted()) { 4390 instr->hydrogen()->IsDehoisted()) {
4388 // Sign extend key because it could be a 32 bit negative value 4391 // Sign extend key because it could be a 32 bit negative value
4389 // and the dehoisted address computation happens in 64 bits 4392 // and the dehoisted address computation happens in 64 bits
4390 __ movsxlq(ToRegister(key), ToRegister(key)); 4393 __ movsxlq(ToRegister(key), ToRegister(key));
4391 } 4394 }
4392 if (instr->NeedsCanonicalization()) { 4395 if (instr->NeedsCanonicalization()) {
4393 Label have_value; 4396 XMMRegister xmm_scratch = double_scratch0();
4394 4397 // Turn potential sNaN value into qNaN.
4395 __ ucomisd(value, value); 4398 __ xorps(xmm_scratch, xmm_scratch);
4396 __ j(parity_odd, &have_value, Label::kNear); // NaN. 4399 __ subsd(value, xmm_scratch);
4397
4398 __ Set(kScratchRegister,
4399 bit_cast<uint64_t>(
4400 FixedDoubleArray::canonical_not_the_hole_nan_as_double()));
4401 __ movq(value, kScratchRegister);
4402
4403 __ bind(&have_value);
4404 } 4400 }
4405 4401
4406 Operand double_store_operand = BuildFastArrayOperand( 4402 Operand double_store_operand = BuildFastArrayOperand(
4407 instr->elements(), 4403 instr->elements(),
4408 key, 4404 key,
4409 instr->hydrogen()->key()->representation(), 4405 instr->hydrogen()->key()->representation(),
4410 FAST_DOUBLE_ELEMENTS, 4406 FAST_DOUBLE_ELEMENTS,
4411 instr->base_offset()); 4407 instr->base_offset());
4412 4408
4413 __ movsd(double_store_operand, value); 4409 __ movsd(double_store_operand, value);
(...skipping 1495 matching lines...) Expand 10 before | Expand all | Expand 10 after
5909 CallRuntime(Runtime::kPushBlockContext, 2, instr); 5905 CallRuntime(Runtime::kPushBlockContext, 2, instr);
5910 RecordSafepoint(Safepoint::kNoLazyDeopt); 5906 RecordSafepoint(Safepoint::kNoLazyDeopt);
5911 } 5907 }
5912 5908
5913 5909
5914 #undef __ 5910 #undef __
5915 5911
5916 } } // namespace v8::internal 5912 } } // namespace v8::internal
5917 5913
5918 #endif // V8_TARGET_ARCH_X64 5914 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698