| 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-factory.h" | 10 #include "src/code-factory.h" |
| (...skipping 3852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3863 | 3863 |
| 3864 void LCodeGen::DoMathLog(LMathLog* instr) { | 3864 void LCodeGen::DoMathLog(LMathLog* instr) { |
| 3865 DCHECK(instr->value()->Equals(instr->result())); | 3865 DCHECK(instr->value()->Equals(instr->result())); |
| 3866 XMMRegister input_reg = ToDoubleRegister(instr->value()); | 3866 XMMRegister input_reg = ToDoubleRegister(instr->value()); |
| 3867 XMMRegister xmm_scratch = double_scratch0(); | 3867 XMMRegister xmm_scratch = double_scratch0(); |
| 3868 Label positive, done, zero; | 3868 Label positive, done, zero; |
| 3869 __ xorps(xmm_scratch, xmm_scratch); | 3869 __ xorps(xmm_scratch, xmm_scratch); |
| 3870 __ ucomisd(input_reg, xmm_scratch); | 3870 __ ucomisd(input_reg, xmm_scratch); |
| 3871 __ j(above, &positive, Label::kNear); | 3871 __ j(above, &positive, Label::kNear); |
| 3872 __ j(not_carry, &zero, Label::kNear); | 3872 __ j(not_carry, &zero, Label::kNear); |
| 3873 ExternalReference nan = | 3873 if (CpuFeatures::IsSupported(AVX)) { |
| 3874 ExternalReference::address_of_canonical_non_hole_nan(); | 3874 CpuFeatureScope scope2(masm(), AVX); |
| 3875 __ movsd(input_reg, Operand::StaticVariable(nan)); | 3875 __ vdivsd(input_reg, xmm_scratch, xmm_scratch); |
| 3876 } else { |
| 3877 __ divsd(xmm_scratch, xmm_scratch); |
| 3878 __ movsd(input_reg, xmm_scratch); |
| 3879 } |
| 3876 __ jmp(&done, Label::kNear); | 3880 __ jmp(&done, Label::kNear); |
| 3877 __ bind(&zero); | 3881 __ bind(&zero); |
| 3878 ExternalReference ninf = | 3882 ExternalReference ninf = |
| 3879 ExternalReference::address_of_negative_infinity(); | 3883 ExternalReference::address_of_negative_infinity(); |
| 3880 __ movsd(input_reg, Operand::StaticVariable(ninf)); | 3884 __ movsd(input_reg, Operand::StaticVariable(ninf)); |
| 3881 __ jmp(&done, Label::kNear); | 3885 __ jmp(&done, Label::kNear); |
| 3882 __ bind(&positive); | 3886 __ bind(&positive); |
| 3883 __ fldln2(); | 3887 __ fldln2(); |
| 3884 __ sub(Operand(esp), Immediate(kDoubleSize)); | 3888 __ sub(Operand(esp), Immediate(kDoubleSize)); |
| 3885 __ movsd(Operand(esp, 0), input_reg); | 3889 __ movsd(Operand(esp, 0), input_reg); |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4219 case DICTIONARY_ELEMENTS: | 4223 case DICTIONARY_ELEMENTS: |
| 4220 case SLOPPY_ARGUMENTS_ELEMENTS: | 4224 case SLOPPY_ARGUMENTS_ELEMENTS: |
| 4221 UNREACHABLE(); | 4225 UNREACHABLE(); |
| 4222 break; | 4226 break; |
| 4223 } | 4227 } |
| 4224 } | 4228 } |
| 4225 } | 4229 } |
| 4226 | 4230 |
| 4227 | 4231 |
| 4228 void LCodeGen::DoStoreKeyedFixedDoubleArray(LStoreKeyed* instr) { | 4232 void LCodeGen::DoStoreKeyedFixedDoubleArray(LStoreKeyed* instr) { |
| 4229 ExternalReference canonical_nan_reference = | |
| 4230 ExternalReference::address_of_canonical_non_hole_nan(); | |
| 4231 Operand double_store_operand = BuildFastArrayOperand( | 4233 Operand double_store_operand = BuildFastArrayOperand( |
| 4232 instr->elements(), | 4234 instr->elements(), |
| 4233 instr->key(), | 4235 instr->key(), |
| 4234 instr->hydrogen()->key()->representation(), | 4236 instr->hydrogen()->key()->representation(), |
| 4235 FAST_DOUBLE_ELEMENTS, | 4237 FAST_DOUBLE_ELEMENTS, |
| 4236 instr->base_offset()); | 4238 instr->base_offset()); |
| 4237 | 4239 |
| 4238 XMMRegister value = ToDoubleRegister(instr->value()); | 4240 XMMRegister value = ToDoubleRegister(instr->value()); |
| 4239 | 4241 |
| 4240 if (instr->NeedsCanonicalization()) { | 4242 if (instr->NeedsCanonicalization()) { |
| 4241 Label have_value; | 4243 XMMRegister xmm_scratch = double_scratch0(); |
| 4242 | 4244 // Turn potential sNaN value into qNaN. |
| 4243 __ ucomisd(value, value); | 4245 __ xorps(xmm_scratch, xmm_scratch); |
| 4244 __ j(parity_odd, &have_value, Label::kNear); // NaN. | 4246 __ subsd(value, xmm_scratch); |
| 4245 | |
| 4246 __ movsd(value, Operand::StaticVariable(canonical_nan_reference)); | |
| 4247 __ bind(&have_value); | |
| 4248 } | 4247 } |
| 4249 | 4248 |
| 4250 __ movsd(double_store_operand, value); | 4249 __ movsd(double_store_operand, value); |
| 4251 } | 4250 } |
| 4252 | 4251 |
| 4253 | 4252 |
| 4254 void LCodeGen::DoStoreKeyedFixedArray(LStoreKeyed* instr) { | 4253 void LCodeGen::DoStoreKeyedFixedArray(LStoreKeyed* instr) { |
| 4255 Register elements = ToRegister(instr->elements()); | 4254 Register elements = ToRegister(instr->elements()); |
| 4256 Register key = instr->key()->IsRegister() ? ToRegister(instr->key()) : no_reg; | 4255 Register key = instr->key()->IsRegister() ? ToRegister(instr->key()) : no_reg; |
| 4257 | 4256 |
| (...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4730 } | 4729 } |
| 4731 __ jmp(&done, Label::kNear); | 4730 __ jmp(&done, Label::kNear); |
| 4732 | 4731 |
| 4733 if (can_convert_undefined_to_nan) { | 4732 if (can_convert_undefined_to_nan) { |
| 4734 __ bind(&convert); | 4733 __ bind(&convert); |
| 4735 | 4734 |
| 4736 // Convert undefined (and hole) to NaN. | 4735 // Convert undefined (and hole) to NaN. |
| 4737 __ cmp(input_reg, factory()->undefined_value()); | 4736 __ cmp(input_reg, factory()->undefined_value()); |
| 4738 DeoptimizeIf(not_equal, instr, "not a heap number/undefined"); | 4737 DeoptimizeIf(not_equal, instr, "not a heap number/undefined"); |
| 4739 | 4738 |
| 4740 ExternalReference nan = | 4739 __ xorps(result_reg, result_reg); |
| 4741 ExternalReference::address_of_canonical_non_hole_nan(); | 4740 __ divsd(result_reg, result_reg); |
| 4742 __ movsd(result_reg, Operand::StaticVariable(nan)); | |
| 4743 __ jmp(&done, Label::kNear); | 4741 __ jmp(&done, Label::kNear); |
| 4744 } | 4742 } |
| 4745 } else { | 4743 } else { |
| 4746 DCHECK(mode == NUMBER_CANDIDATE_IS_SMI); | 4744 DCHECK(mode == NUMBER_CANDIDATE_IS_SMI); |
| 4747 } | 4745 } |
| 4748 | 4746 |
| 4749 __ bind(&load_smi); | 4747 __ bind(&load_smi); |
| 4750 // Smi to XMM conversion. Clobbering a temp is faster than re-tagging the | 4748 // Smi to XMM conversion. Clobbering a temp is faster than re-tagging the |
| 4751 // input register since we avoid dependencies. | 4749 // input register since we avoid dependencies. |
| 4752 __ mov(temp_reg, input_reg); | 4750 __ mov(temp_reg, input_reg); |
| (...skipping 983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5736 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5734 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
| 5737 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5735 RecordSafepoint(Safepoint::kNoLazyDeopt); |
| 5738 } | 5736 } |
| 5739 | 5737 |
| 5740 | 5738 |
| 5741 #undef __ | 5739 #undef __ |
| 5742 | 5740 |
| 5743 } } // namespace v8::internal | 5741 } } // namespace v8::internal |
| 5744 | 5742 |
| 5745 #endif // V8_TARGET_ARCH_IA32 | 5743 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |