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

Side by Side Diff: src/ia32/macro-assembler-ia32.cc

Issue 23654026: Use xorps to break the cvtsi2sd unnecessary dependence due to its partially written (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: x64 port Created 7 years, 3 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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 277
278 void MacroAssembler::DoubleToI(Register result_reg, 278 void MacroAssembler::DoubleToI(Register result_reg,
279 XMMRegister input_reg, 279 XMMRegister input_reg,
280 XMMRegister scratch, 280 XMMRegister scratch,
281 MinusZeroMode minus_zero_mode, 281 MinusZeroMode minus_zero_mode,
282 Label* conversion_failed, 282 Label* conversion_failed,
283 Label::Distance dst) { 283 Label::Distance dst) {
284 ASSERT(!input_reg.is(scratch)); 284 ASSERT(!input_reg.is(scratch));
285 Label done; 285 Label done;
286 cvttsd2si(result_reg, Operand(input_reg)); 286 cvttsd2si(result_reg, Operand(input_reg));
287 cvtsi2sd(scratch, Operand(result_reg)); 287 Cvtsi2sd(scratch, Operand(result_reg));
288 ucomisd(scratch, input_reg); 288 ucomisd(scratch, input_reg);
289 j(not_equal, conversion_failed, dst); 289 j(not_equal, conversion_failed, dst);
290 j(parity_even, conversion_failed, dst); // NaN. 290 j(parity_even, conversion_failed, dst); // NaN.
291 if (minus_zero_mode == FAIL_ON_MINUS_ZERO) { 291 if (minus_zero_mode == FAIL_ON_MINUS_ZERO) {
292 test(result_reg, Operand(result_reg)); 292 test(result_reg, Operand(result_reg));
293 j(not_zero, &done, Label::kNear); 293 j(not_zero, &done, Label::kNear);
294 movmskpd(result_reg, input_reg); 294 movmskpd(result_reg, input_reg);
295 and_(result_reg, 1); 295 and_(result_reg, 1);
296 j(not_zero, conversion_failed, dst); 296 j(not_zero, conversion_failed, dst);
297 } 297 }
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 cmp(FieldOperand(input_reg, HeapObject::kMapOffset), 380 cmp(FieldOperand(input_reg, HeapObject::kMapOffset),
381 isolate()->factory()->heap_number_map()); 381 isolate()->factory()->heap_number_map());
382 j(not_equal, lost_precision, Label::kNear); 382 j(not_equal, lost_precision, Label::kNear);
383 383
384 if (CpuFeatures::IsSafeForSnapshot(SSE2)) { 384 if (CpuFeatures::IsSafeForSnapshot(SSE2)) {
385 ASSERT(!temp.is(no_xmm_reg)); 385 ASSERT(!temp.is(no_xmm_reg));
386 CpuFeatureScope scope(this, SSE2); 386 CpuFeatureScope scope(this, SSE2);
387 387
388 movdbl(xmm0, FieldOperand(input_reg, HeapNumber::kValueOffset)); 388 movdbl(xmm0, FieldOperand(input_reg, HeapNumber::kValueOffset));
389 cvttsd2si(result_reg, Operand(xmm0)); 389 cvttsd2si(result_reg, Operand(xmm0));
390 cvtsi2sd(temp, Operand(result_reg)); 390 Cvtsi2sd(temp, Operand(result_reg));
391 ucomisd(xmm0, temp); 391 ucomisd(xmm0, temp);
392 RecordComment("Deferred TaggedToI: lost precision"); 392 RecordComment("Deferred TaggedToI: lost precision");
393 j(not_equal, lost_precision, Label::kNear); 393 j(not_equal, lost_precision, Label::kNear);
394 RecordComment("Deferred TaggedToI: NaN"); 394 RecordComment("Deferred TaggedToI: NaN");
395 j(parity_even, lost_precision, Label::kNear); 395 j(parity_even, lost_precision, Label::kNear);
396 if (minus_zero_mode == FAIL_ON_MINUS_ZERO) { 396 if (minus_zero_mode == FAIL_ON_MINUS_ZERO) {
397 test(result_reg, Operand(result_reg)); 397 test(result_reg, Operand(result_reg));
398 j(not_zero, &done, Label::kNear); 398 j(not_zero, &done, Label::kNear);
399 movmskpd(result_reg, xmm0); 399 movmskpd(result_reg, xmm0);
400 and_(result_reg, 1); 400 and_(result_reg, 1);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 static_cast<double>(static_cast<uint32_t>(0xFFFFFFFF)) + 1; 445 static_cast<double>(static_cast<uint32_t>(0xFFFFFFFF)) + 1;
446 446
447 447
448 void MacroAssembler::LoadUint32(XMMRegister dst, 448 void MacroAssembler::LoadUint32(XMMRegister dst,
449 Register src, 449 Register src,
450 XMMRegister scratch) { 450 XMMRegister scratch) {
451 Label done; 451 Label done;
452 cmp(src, Immediate(0)); 452 cmp(src, Immediate(0));
453 movdbl(scratch, 453 movdbl(scratch,
454 Operand(reinterpret_cast<int32_t>(&kUint32Bias), RelocInfo::NONE32)); 454 Operand(reinterpret_cast<int32_t>(&kUint32Bias), RelocInfo::NONE32));
455 cvtsi2sd(dst, src); 455 Cvtsi2sd(dst, src);
456 j(not_sign, &done, Label::kNear); 456 j(not_sign, &done, Label::kNear);
457 addsd(dst, scratch); 457 addsd(dst, scratch);
458 bind(&done); 458 bind(&done);
459 } 459 }
460 460
461 461
462 void MacroAssembler::RecordWriteArray(Register object, 462 void MacroAssembler::RecordWriteArray(Register object,
463 Register value, 463 Register value,
464 Register index, 464 Register index,
465 SaveFPRegsMode save_fp, 465 SaveFPRegsMode save_fp,
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 #ifdef ENABLE_DEBUGGER_SUPPORT 664 #ifdef ENABLE_DEBUGGER_SUPPORT
665 void MacroAssembler::DebugBreak() { 665 void MacroAssembler::DebugBreak() {
666 Set(eax, Immediate(0)); 666 Set(eax, Immediate(0));
667 mov(ebx, Immediate(ExternalReference(Runtime::kDebugBreak, isolate()))); 667 mov(ebx, Immediate(ExternalReference(Runtime::kDebugBreak, isolate())));
668 CEntryStub ces(1); 668 CEntryStub ces(1);
669 call(ces.GetCode(isolate()), RelocInfo::DEBUG_BREAK); 669 call(ces.GetCode(isolate()), RelocInfo::DEBUG_BREAK);
670 } 670 }
671 #endif 671 #endif
672 672
673 673
674 void MacroAssembler::Cvtsi2sd(XMMRegister dst, const Operand& src) {
675 xorps(dst, dst);
676 cvtsi2sd(dst, src);
677 }
678
679
674 void MacroAssembler::Set(Register dst, const Immediate& x) { 680 void MacroAssembler::Set(Register dst, const Immediate& x) {
675 if (x.is_zero()) { 681 if (x.is_zero()) {
676 xor_(dst, dst); // Shorter than mov. 682 xor_(dst, dst); // Shorter than mov.
677 } else { 683 } else {
678 mov(dst, x); 684 mov(dst, x);
679 } 685 }
680 } 686 }
681 687
682 688
683 void MacroAssembler::Set(const Operand& dst, const Immediate& x) { 689 void MacroAssembler::Set(const Operand& dst, const Immediate& x) {
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
822 } 828 }
823 jmp(&have_double_value, Label::kNear); 829 jmp(&have_double_value, Label::kNear);
824 830
825 bind(&smi_value); 831 bind(&smi_value);
826 // Value is a smi. Convert to a double and store. 832 // Value is a smi. Convert to a double and store.
827 // Preserve original value. 833 // Preserve original value.
828 mov(scratch1, maybe_number); 834 mov(scratch1, maybe_number);
829 SmiUntag(scratch1); 835 SmiUntag(scratch1);
830 if (CpuFeatures::IsSupported(SSE2) && specialize_for_processor) { 836 if (CpuFeatures::IsSupported(SSE2) && specialize_for_processor) {
831 CpuFeatureScope fscope(this, SSE2); 837 CpuFeatureScope fscope(this, SSE2);
832 cvtsi2sd(scratch2, scratch1); 838 Cvtsi2sd(scratch2, scratch1);
833 movdbl(FieldOperand(elements, key, times_4, 839 movdbl(FieldOperand(elements, key, times_4,
834 FixedDoubleArray::kHeaderSize - elements_offset), 840 FixedDoubleArray::kHeaderSize - elements_offset),
835 scratch2); 841 scratch2);
836 } else { 842 } else {
837 push(scratch1); 843 push(scratch1);
838 fild_s(Operand(esp, 0)); 844 fild_s(Operand(esp, 0));
839 pop(scratch1); 845 pop(scratch1);
840 fstp_d(FieldOperand(elements, key, times_4, 846 fstp_d(FieldOperand(elements, key, times_4,
841 FixedDoubleArray::kHeaderSize - elements_offset)); 847 FixedDoubleArray::kHeaderSize - elements_offset));
842 } 848 }
(...skipping 2574 matching lines...) Expand 10 before | Expand all | Expand 10 after
3417 j(greater, &no_memento_available); 3423 j(greater, &no_memento_available);
3418 cmp(MemOperand(scratch_reg, -AllocationMemento::kSize), 3424 cmp(MemOperand(scratch_reg, -AllocationMemento::kSize),
3419 Immediate(Handle<Map>(isolate()->heap()->allocation_memento_map()))); 3425 Immediate(Handle<Map>(isolate()->heap()->allocation_memento_map())));
3420 bind(&no_memento_available); 3426 bind(&no_memento_available);
3421 } 3427 }
3422 3428
3423 3429
3424 } } // namespace v8::internal 3430 } } // namespace v8::internal
3425 3431
3426 #endif // V8_TARGET_ARCH_IA32 3432 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698