| 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 "v8.h" | 5 #include "v8.h" |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
| 8 | 8 |
| 9 #include "ic-inl.h" | 9 #include "ic-inl.h" |
| 10 #include "codegen.h" | 10 #include "codegen.h" |
| (...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 __ j(equal, &do_store, Label::kNear); | 520 __ j(equal, &do_store, Label::kNear); |
| 521 } | 521 } |
| 522 __ bind(&do_store); | 522 __ bind(&do_store); |
| 523 } | 523 } |
| 524 } else if (representation.IsDouble()) { | 524 } else if (representation.IsDouble()) { |
| 525 Label do_store, heap_number; | 525 Label do_store, heap_number; |
| 526 __ AllocateHeapNumber(storage_reg, scratch1, scratch2, slow); | 526 __ AllocateHeapNumber(storage_reg, scratch1, scratch2, slow); |
| 527 | 527 |
| 528 __ JumpIfNotSmi(value_reg, &heap_number); | 528 __ JumpIfNotSmi(value_reg, &heap_number); |
| 529 __ SmiUntag(value_reg); | 529 __ SmiUntag(value_reg); |
| 530 if (CpuFeatures::IsSupported(SSE2)) { | 530 __ Cvtsi2sd(xmm0, value_reg); |
| 531 CpuFeatureScope use_sse2(masm, SSE2); | |
| 532 __ Cvtsi2sd(xmm0, value_reg); | |
| 533 } else { | |
| 534 __ push(value_reg); | |
| 535 __ fild_s(Operand(esp, 0)); | |
| 536 __ pop(value_reg); | |
| 537 } | |
| 538 __ SmiTag(value_reg); | 531 __ SmiTag(value_reg); |
| 539 __ jmp(&do_store); | 532 __ jmp(&do_store); |
| 540 | 533 |
| 541 __ bind(&heap_number); | 534 __ bind(&heap_number); |
| 542 __ CheckMap(value_reg, masm->isolate()->factory()->heap_number_map(), | 535 __ CheckMap(value_reg, masm->isolate()->factory()->heap_number_map(), |
| 543 miss_label, DONT_DO_SMI_CHECK); | 536 miss_label, DONT_DO_SMI_CHECK); |
| 544 if (CpuFeatures::IsSupported(SSE2)) { | 537 __ movsd(xmm0, FieldOperand(value_reg, HeapNumber::kValueOffset)); |
| 545 CpuFeatureScope use_sse2(masm, SSE2); | |
| 546 __ movsd(xmm0, FieldOperand(value_reg, HeapNumber::kValueOffset)); | |
| 547 } else { | |
| 548 __ fld_d(FieldOperand(value_reg, HeapNumber::kValueOffset)); | |
| 549 } | |
| 550 | 538 |
| 551 __ bind(&do_store); | 539 __ bind(&do_store); |
| 552 if (CpuFeatures::IsSupported(SSE2)) { | 540 __ movsd(FieldOperand(storage_reg, HeapNumber::kValueOffset), xmm0); |
| 553 CpuFeatureScope use_sse2(masm, SSE2); | |
| 554 __ movsd(FieldOperand(storage_reg, HeapNumber::kValueOffset), xmm0); | |
| 555 } else { | |
| 556 __ fstp_d(FieldOperand(storage_reg, HeapNumber::kValueOffset)); | |
| 557 } | |
| 558 } | 541 } |
| 559 | 542 |
| 560 // Stub never generated for non-global objects that require access | 543 // Stub never generated for non-global objects that require access |
| 561 // checks. | 544 // checks. |
| 562 ASSERT(object->IsJSGlobalProxy() || !object->IsAccessCheckNeeded()); | 545 ASSERT(object->IsJSGlobalProxy() || !object->IsAccessCheckNeeded()); |
| 563 | 546 |
| 564 // Perform map transition for the receiver if necessary. | 547 // Perform map transition for the receiver if necessary. |
| 565 if (details.type() == FIELD && | 548 if (details.type() == FIELD && |
| 566 object->map()->unused_property_fields() == 0) { | 549 object->map()->unused_property_fields() == 0) { |
| 567 // The properties must be extended before we can store the value. | 550 // The properties must be extended before we can store the value. |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 714 } else { | 697 } else { |
| 715 __ mov(scratch1, FieldOperand(receiver_reg, JSObject::kPropertiesOffset)); | 698 __ mov(scratch1, FieldOperand(receiver_reg, JSObject::kPropertiesOffset)); |
| 716 int offset = index * kPointerSize + FixedArray::kHeaderSize; | 699 int offset = index * kPointerSize + FixedArray::kHeaderSize; |
| 717 __ mov(scratch1, FieldOperand(scratch1, offset)); | 700 __ mov(scratch1, FieldOperand(scratch1, offset)); |
| 718 } | 701 } |
| 719 | 702 |
| 720 // Store the value into the storage. | 703 // Store the value into the storage. |
| 721 Label do_store, heap_number; | 704 Label do_store, heap_number; |
| 722 __ JumpIfNotSmi(value_reg, &heap_number); | 705 __ JumpIfNotSmi(value_reg, &heap_number); |
| 723 __ SmiUntag(value_reg); | 706 __ SmiUntag(value_reg); |
| 724 if (CpuFeatures::IsSupported(SSE2)) { | 707 __ Cvtsi2sd(xmm0, value_reg); |
| 725 CpuFeatureScope use_sse2(masm, SSE2); | |
| 726 __ Cvtsi2sd(xmm0, value_reg); | |
| 727 } else { | |
| 728 __ push(value_reg); | |
| 729 __ fild_s(Operand(esp, 0)); | |
| 730 __ pop(value_reg); | |
| 731 } | |
| 732 __ SmiTag(value_reg); | 708 __ SmiTag(value_reg); |
| 733 __ jmp(&do_store); | 709 __ jmp(&do_store); |
| 734 __ bind(&heap_number); | 710 __ bind(&heap_number); |
| 735 __ CheckMap(value_reg, masm->isolate()->factory()->heap_number_map(), | 711 __ CheckMap(value_reg, masm->isolate()->factory()->heap_number_map(), |
| 736 miss_label, DONT_DO_SMI_CHECK); | 712 miss_label, DONT_DO_SMI_CHECK); |
| 737 if (CpuFeatures::IsSupported(SSE2)) { | 713 __ movsd(xmm0, FieldOperand(value_reg, HeapNumber::kValueOffset)); |
| 738 CpuFeatureScope use_sse2(masm, SSE2); | |
| 739 __ movsd(xmm0, FieldOperand(value_reg, HeapNumber::kValueOffset)); | |
| 740 } else { | |
| 741 __ fld_d(FieldOperand(value_reg, HeapNumber::kValueOffset)); | |
| 742 } | |
| 743 __ bind(&do_store); | 714 __ bind(&do_store); |
| 744 if (CpuFeatures::IsSupported(SSE2)) { | 715 __ movsd(FieldOperand(scratch1, HeapNumber::kValueOffset), xmm0); |
| 745 CpuFeatureScope use_sse2(masm, SSE2); | |
| 746 __ movsd(FieldOperand(scratch1, HeapNumber::kValueOffset), xmm0); | |
| 747 } else { | |
| 748 __ fstp_d(FieldOperand(scratch1, HeapNumber::kValueOffset)); | |
| 749 } | |
| 750 // Return the value (register eax). | 716 // Return the value (register eax). |
| 751 ASSERT(value_reg.is(eax)); | 717 ASSERT(value_reg.is(eax)); |
| 752 __ ret(0); | 718 __ ret(0); |
| 753 return; | 719 return; |
| 754 } | 720 } |
| 755 | 721 |
| 756 ASSERT(!representation.IsDouble()); | 722 ASSERT(!representation.IsDouble()); |
| 757 // TODO(verwaest): Share this code as a code stub. | 723 // TODO(verwaest): Share this code as a code stub. |
| 758 SmiCheck smi_check = representation.IsTagged() | 724 SmiCheck smi_check = representation.IsTagged() |
| 759 ? INLINE_SMI_CHECK : OMIT_SMI_CHECK; | 725 ? INLINE_SMI_CHECK : OMIT_SMI_CHECK; |
| (...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1534 // ----------------------------------- | 1500 // ----------------------------------- |
| 1535 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); | 1501 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); |
| 1536 } | 1502 } |
| 1537 | 1503 |
| 1538 | 1504 |
| 1539 #undef __ | 1505 #undef __ |
| 1540 | 1506 |
| 1541 } } // namespace v8::internal | 1507 } } // namespace v8::internal |
| 1542 | 1508 |
| 1543 #endif // V8_TARGET_ARCH_IA32 | 1509 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |