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

Side by Side Diff: src/ia32/lithium-codegen-ia32.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: Fix phi? 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 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-factory.h" 10 #include "src/code-factory.h"
(...skipping 3876 matching lines...) Expand 10 before | Expand all | Expand 10 after
3887 3887
3888 void LCodeGen::DoMathLog(LMathLog* instr) { 3888 void LCodeGen::DoMathLog(LMathLog* instr) {
3889 DCHECK(instr->value()->Equals(instr->result())); 3889 DCHECK(instr->value()->Equals(instr->result()));
3890 XMMRegister input_reg = ToDoubleRegister(instr->value()); 3890 XMMRegister input_reg = ToDoubleRegister(instr->value());
3891 XMMRegister xmm_scratch = double_scratch0(); 3891 XMMRegister xmm_scratch = double_scratch0();
3892 Label positive, done, zero; 3892 Label positive, done, zero;
3893 __ xorps(xmm_scratch, xmm_scratch); 3893 __ xorps(xmm_scratch, xmm_scratch);
3894 __ ucomisd(input_reg, xmm_scratch); 3894 __ ucomisd(input_reg, xmm_scratch);
3895 __ j(above, &positive, Label::kNear); 3895 __ j(above, &positive, Label::kNear);
3896 __ j(not_carry, &zero, Label::kNear); 3896 __ j(not_carry, &zero, Label::kNear);
3897 ExternalReference nan = 3897 if (CpuFeatures::IsSupported(AVX)) {
3898 ExternalReference::address_of_canonical_non_hole_nan(); 3898 CpuFeatureScope scope2(masm(), AVX);
3899 __ movsd(input_reg, Operand::StaticVariable(nan)); 3899 __ vdivsd(input_reg, xmm_scratch, xmm_scratch);
3900 } else {
3901 __ divsd(xmm_scratch, xmm_scratch);
3902 __ movsd(input_reg, xmm_scratch);
3903 }
3900 __ jmp(&done, Label::kNear); 3904 __ jmp(&done, Label::kNear);
3901 __ bind(&zero); 3905 __ bind(&zero);
3902 ExternalReference ninf = 3906 ExternalReference ninf =
3903 ExternalReference::address_of_negative_infinity(); 3907 ExternalReference::address_of_negative_infinity();
3904 __ movsd(input_reg, Operand::StaticVariable(ninf)); 3908 __ movsd(input_reg, Operand::StaticVariable(ninf));
3905 __ jmp(&done, Label::kNear); 3909 __ jmp(&done, Label::kNear);
3906 __ bind(&positive); 3910 __ bind(&positive);
3907 __ fldln2(); 3911 __ fldln2();
3908 __ sub(Operand(esp), Immediate(kDoubleSize)); 3912 __ sub(Operand(esp), Immediate(kDoubleSize));
3909 __ movsd(Operand(esp, 0), input_reg); 3913 __ movsd(Operand(esp, 0), input_reg);
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
4243 case DICTIONARY_ELEMENTS: 4247 case DICTIONARY_ELEMENTS:
4244 case SLOPPY_ARGUMENTS_ELEMENTS: 4248 case SLOPPY_ARGUMENTS_ELEMENTS:
4245 UNREACHABLE(); 4249 UNREACHABLE();
4246 break; 4250 break;
4247 } 4251 }
4248 } 4252 }
4249 } 4253 }
4250 4254
4251 4255
4252 void LCodeGen::DoStoreKeyedFixedDoubleArray(LStoreKeyed* instr) { 4256 void LCodeGen::DoStoreKeyedFixedDoubleArray(LStoreKeyed* instr) {
4253 ExternalReference canonical_nan_reference =
4254 ExternalReference::address_of_canonical_non_hole_nan();
4255 Operand double_store_operand = BuildFastArrayOperand( 4257 Operand double_store_operand = BuildFastArrayOperand(
4256 instr->elements(), 4258 instr->elements(),
4257 instr->key(), 4259 instr->key(),
4258 instr->hydrogen()->key()->representation(), 4260 instr->hydrogen()->key()->representation(),
4259 FAST_DOUBLE_ELEMENTS, 4261 FAST_DOUBLE_ELEMENTS,
4260 instr->base_offset()); 4262 instr->base_offset());
4261 4263
4262 XMMRegister value = ToDoubleRegister(instr->value()); 4264 XMMRegister value = ToDoubleRegister(instr->value());
4263 4265
4264 if (instr->NeedsCanonicalization()) { 4266 if (instr->NeedsCanonicalization()) {
4265 Label have_value; 4267 XMMRegister xmm_scratch = double_scratch0();
4266 4268 // Turn potential sNaN value into qNaN.
4267 __ ucomisd(value, value); 4269 __ xorps(xmm_scratch, xmm_scratch);
4268 __ j(parity_odd, &have_value, Label::kNear); // NaN. 4270 __ subsd(value, xmm_scratch);
4269
4270 __ movsd(value, Operand::StaticVariable(canonical_nan_reference));
4271 __ bind(&have_value);
4272 } 4271 }
4273 4272
4274 __ movsd(double_store_operand, value); 4273 __ movsd(double_store_operand, value);
4275 } 4274 }
4276 4275
4277 4276
4278 void LCodeGen::DoStoreKeyedFixedArray(LStoreKeyed* instr) { 4277 void LCodeGen::DoStoreKeyedFixedArray(LStoreKeyed* instr) {
4279 Register elements = ToRegister(instr->elements()); 4278 Register elements = ToRegister(instr->elements());
4280 Register key = instr->key()->IsRegister() ? ToRegister(instr->key()) : no_reg; 4279 Register key = instr->key()->IsRegister() ? ToRegister(instr->key()) : no_reg;
4281 4280
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
4754 } 4753 }
4755 __ jmp(&done, Label::kNear); 4754 __ jmp(&done, Label::kNear);
4756 4755
4757 if (can_convert_undefined_to_nan) { 4756 if (can_convert_undefined_to_nan) {
4758 __ bind(&convert); 4757 __ bind(&convert);
4759 4758
4760 // Convert undefined (and hole) to NaN. 4759 // Convert undefined (and hole) to NaN.
4761 __ cmp(input_reg, factory()->undefined_value()); 4760 __ cmp(input_reg, factory()->undefined_value());
4762 DeoptimizeIf(not_equal, instr, "not a heap number/undefined"); 4761 DeoptimizeIf(not_equal, instr, "not a heap number/undefined");
4763 4762
4764 ExternalReference nan = 4763 __ xorps(result_reg, result_reg);
4765 ExternalReference::address_of_canonical_non_hole_nan(); 4764 __ divsd(result_reg, result_reg);
4766 __ movsd(result_reg, Operand::StaticVariable(nan));
4767 __ jmp(&done, Label::kNear); 4765 __ jmp(&done, Label::kNear);
4768 } 4766 }
4769 } else { 4767 } else {
4770 DCHECK(mode == NUMBER_CANDIDATE_IS_SMI); 4768 DCHECK(mode == NUMBER_CANDIDATE_IS_SMI);
4771 } 4769 }
4772 4770
4773 __ bind(&load_smi); 4771 __ bind(&load_smi);
4774 // Smi to XMM conversion. Clobbering a temp is faster than re-tagging the 4772 // Smi to XMM conversion. Clobbering a temp is faster than re-tagging the
4775 // input register since we avoid dependencies. 4773 // input register since we avoid dependencies.
4776 __ mov(temp_reg, input_reg); 4774 __ mov(temp_reg, input_reg);
(...skipping 983 matching lines...) Expand 10 before | Expand all | Expand 10 after
5760 CallRuntime(Runtime::kPushBlockContext, 2, instr); 5758 CallRuntime(Runtime::kPushBlockContext, 2, instr);
5761 RecordSafepoint(Safepoint::kNoLazyDeopt); 5759 RecordSafepoint(Safepoint::kNoLazyDeopt);
5762 } 5760 }
5763 5761
5764 5762
5765 #undef __ 5763 #undef __
5766 5764
5767 } } // namespace v8::internal 5765 } } // namespace v8::internal
5768 5766
5769 #endif // V8_TARGET_ARCH_IA32 5767 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698