| OLD | NEW |
| 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 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 __ ret(0); | 364 __ ret(0); |
| 365 } | 365 } |
| 366 | 366 |
| 367 | 367 |
| 368 void StubCompiler::GenerateFastPropertyLoad(MacroAssembler* masm, | 368 void StubCompiler::GenerateFastPropertyLoad(MacroAssembler* masm, |
| 369 Register dst, | 369 Register dst, |
| 370 Register src, | 370 Register src, |
| 371 bool inobject, | 371 bool inobject, |
| 372 int index, | 372 int index, |
| 373 Representation representation) { | 373 Representation representation) { |
| 374 ASSERT(!FLAG_track_double_fields || !representation.IsDouble()); | 374 ASSERT(!representation.IsDouble()); |
| 375 int offset = index * kPointerSize; | 375 int offset = index * kPointerSize; |
| 376 if (!inobject) { | 376 if (!inobject) { |
| 377 // Calculate the offset into the properties array. | 377 // Calculate the offset into the properties array. |
| 378 offset = offset + FixedArray::kHeaderSize; | 378 offset = offset + FixedArray::kHeaderSize; |
| 379 __ mov(dst, FieldOperand(src, JSObject::kPropertiesOffset)); | 379 __ mov(dst, FieldOperand(src, JSObject::kPropertiesOffset)); |
| 380 src = dst; | 380 src = dst; |
| 381 } | 381 } |
| 382 __ mov(dst, FieldOperand(src, offset)); | 382 __ mov(dst, FieldOperand(src, offset)); |
| 383 } | 383 } |
| 384 | 384 |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 int descriptor = transition->LastAdded(); | 566 int descriptor = transition->LastAdded(); |
| 567 DescriptorArray* descriptors = transition->instance_descriptors(); | 567 DescriptorArray* descriptors = transition->instance_descriptors(); |
| 568 PropertyDetails details = descriptors->GetDetails(descriptor); | 568 PropertyDetails details = descriptors->GetDetails(descriptor); |
| 569 Representation representation = details.representation(); | 569 Representation representation = details.representation(); |
| 570 ASSERT(!representation.IsNone()); | 570 ASSERT(!representation.IsNone()); |
| 571 | 571 |
| 572 if (details.type() == CONSTANT) { | 572 if (details.type() == CONSTANT) { |
| 573 Handle<Object> constant(descriptors->GetValue(descriptor), masm->isolate()); | 573 Handle<Object> constant(descriptors->GetValue(descriptor), masm->isolate()); |
| 574 __ CmpObject(value_reg, constant); | 574 __ CmpObject(value_reg, constant); |
| 575 __ j(not_equal, miss_label); | 575 __ j(not_equal, miss_label); |
| 576 } else if (FLAG_track_fields && representation.IsSmi()) { | 576 } else if (representation.IsSmi()) { |
| 577 __ JumpIfNotSmi(value_reg, miss_label); | 577 __ JumpIfNotSmi(value_reg, miss_label); |
| 578 } else if (FLAG_track_heap_object_fields && representation.IsHeapObject()) { | 578 } else if (representation.IsHeapObject()) { |
| 579 __ JumpIfSmi(value_reg, miss_label); | 579 __ JumpIfSmi(value_reg, miss_label); |
| 580 } else if (FLAG_track_double_fields && representation.IsDouble()) { | 580 } else if (representation.IsDouble()) { |
| 581 Label do_store, heap_number; | 581 Label do_store, heap_number; |
| 582 __ AllocateHeapNumber(storage_reg, scratch1, scratch2, slow); | 582 __ AllocateHeapNumber(storage_reg, scratch1, scratch2, slow); |
| 583 | 583 |
| 584 __ JumpIfNotSmi(value_reg, &heap_number); | 584 __ JumpIfNotSmi(value_reg, &heap_number); |
| 585 __ SmiUntag(value_reg); | 585 __ SmiUntag(value_reg); |
| 586 if (CpuFeatures::IsSupported(SSE2)) { | 586 if (CpuFeatures::IsSupported(SSE2)) { |
| 587 CpuFeatureScope use_sse2(masm, SSE2); | 587 CpuFeatureScope use_sse2(masm, SSE2); |
| 588 __ Cvtsi2sd(xmm0, value_reg); | 588 __ Cvtsi2sd(xmm0, value_reg); |
| 589 } else { | 589 } else { |
| 590 __ push(value_reg); | 590 __ push(value_reg); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 661 // face of a transition we can use the old map here because the size of the | 661 // face of a transition we can use the old map here because the size of the |
| 662 // object and the number of in-object properties is not going to change. | 662 // object and the number of in-object properties is not going to change. |
| 663 index -= object->map()->inobject_properties(); | 663 index -= object->map()->inobject_properties(); |
| 664 | 664 |
| 665 SmiCheck smi_check = representation.IsTagged() | 665 SmiCheck smi_check = representation.IsTagged() |
| 666 ? INLINE_SMI_CHECK : OMIT_SMI_CHECK; | 666 ? INLINE_SMI_CHECK : OMIT_SMI_CHECK; |
| 667 // TODO(verwaest): Share this code as a code stub. | 667 // TODO(verwaest): Share this code as a code stub. |
| 668 if (index < 0) { | 668 if (index < 0) { |
| 669 // Set the property straight into the object. | 669 // Set the property straight into the object. |
| 670 int offset = object->map()->instance_size() + (index * kPointerSize); | 670 int offset = object->map()->instance_size() + (index * kPointerSize); |
| 671 if (FLAG_track_double_fields && representation.IsDouble()) { | 671 if (representation.IsDouble()) { |
| 672 __ mov(FieldOperand(receiver_reg, offset), storage_reg); | 672 __ mov(FieldOperand(receiver_reg, offset), storage_reg); |
| 673 } else { | 673 } else { |
| 674 __ mov(FieldOperand(receiver_reg, offset), value_reg); | 674 __ mov(FieldOperand(receiver_reg, offset), value_reg); |
| 675 } | 675 } |
| 676 | 676 |
| 677 if (!FLAG_track_fields || !representation.IsSmi()) { | 677 if (!representation.IsSmi()) { |
| 678 // Update the write barrier for the array address. | 678 // Update the write barrier for the array address. |
| 679 if (!FLAG_track_double_fields || !representation.IsDouble()) { | 679 if (!representation.IsDouble()) { |
| 680 __ mov(storage_reg, value_reg); | 680 __ mov(storage_reg, value_reg); |
| 681 } | 681 } |
| 682 __ RecordWriteField(receiver_reg, | 682 __ RecordWriteField(receiver_reg, |
| 683 offset, | 683 offset, |
| 684 storage_reg, | 684 storage_reg, |
| 685 scratch1, | 685 scratch1, |
| 686 kDontSaveFPRegs, | 686 kDontSaveFPRegs, |
| 687 EMIT_REMEMBERED_SET, | 687 EMIT_REMEMBERED_SET, |
| 688 smi_check); | 688 smi_check); |
| 689 } | 689 } |
| 690 } else { | 690 } else { |
| 691 // Write to the properties array. | 691 // Write to the properties array. |
| 692 int offset = index * kPointerSize + FixedArray::kHeaderSize; | 692 int offset = index * kPointerSize + FixedArray::kHeaderSize; |
| 693 // Get the properties array (optimistically). | 693 // Get the properties array (optimistically). |
| 694 __ mov(scratch1, FieldOperand(receiver_reg, JSObject::kPropertiesOffset)); | 694 __ mov(scratch1, FieldOperand(receiver_reg, JSObject::kPropertiesOffset)); |
| 695 if (FLAG_track_double_fields && representation.IsDouble()) { | 695 if (representation.IsDouble()) { |
| 696 __ mov(FieldOperand(scratch1, offset), storage_reg); | 696 __ mov(FieldOperand(scratch1, offset), storage_reg); |
| 697 } else { | 697 } else { |
| 698 __ mov(FieldOperand(scratch1, offset), value_reg); | 698 __ mov(FieldOperand(scratch1, offset), value_reg); |
| 699 } | 699 } |
| 700 | 700 |
| 701 if (!FLAG_track_fields || !representation.IsSmi()) { | 701 if (!representation.IsSmi()) { |
| 702 // Update the write barrier for the array address. | 702 // Update the write barrier for the array address. |
| 703 if (!FLAG_track_double_fields || !representation.IsDouble()) { | 703 if (!representation.IsDouble()) { |
| 704 __ mov(storage_reg, value_reg); | 704 __ mov(storage_reg, value_reg); |
| 705 } | 705 } |
| 706 __ RecordWriteField(scratch1, | 706 __ RecordWriteField(scratch1, |
| 707 offset, | 707 offset, |
| 708 storage_reg, | 708 storage_reg, |
| 709 receiver_reg, | 709 receiver_reg, |
| 710 kDontSaveFPRegs, | 710 kDontSaveFPRegs, |
| 711 EMIT_REMEMBERED_SET, | 711 EMIT_REMEMBERED_SET, |
| 712 smi_check); | 712 smi_check); |
| 713 } | 713 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 736 | 736 |
| 737 int index = lookup->GetFieldIndex().field_index(); | 737 int index = lookup->GetFieldIndex().field_index(); |
| 738 | 738 |
| 739 // Adjust for the number of properties stored in the object. Even in the | 739 // Adjust for the number of properties stored in the object. Even in the |
| 740 // face of a transition we can use the old map here because the size of the | 740 // face of a transition we can use the old map here because the size of the |
| 741 // object and the number of in-object properties is not going to change. | 741 // object and the number of in-object properties is not going to change. |
| 742 index -= object->map()->inobject_properties(); | 742 index -= object->map()->inobject_properties(); |
| 743 | 743 |
| 744 Representation representation = lookup->representation(); | 744 Representation representation = lookup->representation(); |
| 745 ASSERT(!representation.IsNone()); | 745 ASSERT(!representation.IsNone()); |
| 746 if (FLAG_track_fields && representation.IsSmi()) { | 746 if (representation.IsSmi()) { |
| 747 __ JumpIfNotSmi(value_reg, miss_label); | 747 __ JumpIfNotSmi(value_reg, miss_label); |
| 748 } else if (FLAG_track_heap_object_fields && representation.IsHeapObject()) { | 748 } else if (representation.IsHeapObject()) { |
| 749 __ JumpIfSmi(value_reg, miss_label); | 749 __ JumpIfSmi(value_reg, miss_label); |
| 750 } else if (FLAG_track_double_fields && representation.IsDouble()) { | 750 } else if (representation.IsDouble()) { |
| 751 // Load the double storage. | 751 // Load the double storage. |
| 752 if (index < 0) { | 752 if (index < 0) { |
| 753 int offset = object->map()->instance_size() + (index * kPointerSize); | 753 int offset = object->map()->instance_size() + (index * kPointerSize); |
| 754 __ mov(scratch1, FieldOperand(receiver_reg, offset)); | 754 __ mov(scratch1, FieldOperand(receiver_reg, offset)); |
| 755 } else { | 755 } else { |
| 756 __ mov(scratch1, FieldOperand(receiver_reg, JSObject::kPropertiesOffset)); | 756 __ mov(scratch1, FieldOperand(receiver_reg, JSObject::kPropertiesOffset)); |
| 757 int offset = index * kPointerSize + FixedArray::kHeaderSize; | 757 int offset = index * kPointerSize + FixedArray::kHeaderSize; |
| 758 __ mov(scratch1, FieldOperand(scratch1, offset)); | 758 __ mov(scratch1, FieldOperand(scratch1, offset)); |
| 759 } | 759 } |
| 760 | 760 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 787 __ movsd(FieldOperand(scratch1, HeapNumber::kValueOffset), xmm0); | 787 __ movsd(FieldOperand(scratch1, HeapNumber::kValueOffset), xmm0); |
| 788 } else { | 788 } else { |
| 789 __ fstp_d(FieldOperand(scratch1, HeapNumber::kValueOffset)); | 789 __ fstp_d(FieldOperand(scratch1, HeapNumber::kValueOffset)); |
| 790 } | 790 } |
| 791 // Return the value (register eax). | 791 // Return the value (register eax). |
| 792 ASSERT(value_reg.is(eax)); | 792 ASSERT(value_reg.is(eax)); |
| 793 __ ret(0); | 793 __ ret(0); |
| 794 return; | 794 return; |
| 795 } | 795 } |
| 796 | 796 |
| 797 ASSERT(!FLAG_track_double_fields || !representation.IsDouble()); | 797 ASSERT(!representation.IsDouble()); |
| 798 // TODO(verwaest): Share this code as a code stub. | 798 // TODO(verwaest): Share this code as a code stub. |
| 799 SmiCheck smi_check = representation.IsTagged() | 799 SmiCheck smi_check = representation.IsTagged() |
| 800 ? INLINE_SMI_CHECK : OMIT_SMI_CHECK; | 800 ? INLINE_SMI_CHECK : OMIT_SMI_CHECK; |
| 801 if (index < 0) { | 801 if (index < 0) { |
| 802 // Set the property straight into the object. | 802 // Set the property straight into the object. |
| 803 int offset = object->map()->instance_size() + (index * kPointerSize); | 803 int offset = object->map()->instance_size() + (index * kPointerSize); |
| 804 __ mov(FieldOperand(receiver_reg, offset), value_reg); | 804 __ mov(FieldOperand(receiver_reg, offset), value_reg); |
| 805 | 805 |
| 806 if (!FLAG_track_fields || !representation.IsSmi()) { | 806 if (!representation.IsSmi()) { |
| 807 // Update the write barrier for the array address. | 807 // Update the write barrier for the array address. |
| 808 // Pass the value being stored in the now unused name_reg. | 808 // Pass the value being stored in the now unused name_reg. |
| 809 __ mov(name_reg, value_reg); | 809 __ mov(name_reg, value_reg); |
| 810 __ RecordWriteField(receiver_reg, | 810 __ RecordWriteField(receiver_reg, |
| 811 offset, | 811 offset, |
| 812 name_reg, | 812 name_reg, |
| 813 scratch1, | 813 scratch1, |
| 814 kDontSaveFPRegs, | 814 kDontSaveFPRegs, |
| 815 EMIT_REMEMBERED_SET, | 815 EMIT_REMEMBERED_SET, |
| 816 smi_check); | 816 smi_check); |
| 817 } | 817 } |
| 818 } else { | 818 } else { |
| 819 // Write to the properties array. | 819 // Write to the properties array. |
| 820 int offset = index * kPointerSize + FixedArray::kHeaderSize; | 820 int offset = index * kPointerSize + FixedArray::kHeaderSize; |
| 821 // Get the properties array (optimistically). | 821 // Get the properties array (optimistically). |
| 822 __ mov(scratch1, FieldOperand(receiver_reg, JSObject::kPropertiesOffset)); | 822 __ mov(scratch1, FieldOperand(receiver_reg, JSObject::kPropertiesOffset)); |
| 823 __ mov(FieldOperand(scratch1, offset), value_reg); | 823 __ mov(FieldOperand(scratch1, offset), value_reg); |
| 824 | 824 |
| 825 if (!FLAG_track_fields || !representation.IsSmi()) { | 825 if (!representation.IsSmi()) { |
| 826 // Update the write barrier for the array address. | 826 // Update the write barrier for the array address. |
| 827 // Pass the value being stored in the now unused name_reg. | 827 // Pass the value being stored in the now unused name_reg. |
| 828 __ mov(name_reg, value_reg); | 828 __ mov(name_reg, value_reg); |
| 829 __ RecordWriteField(scratch1, | 829 __ RecordWriteField(scratch1, |
| 830 offset, | 830 offset, |
| 831 name_reg, | 831 name_reg, |
| 832 receiver_reg, | 832 receiver_reg, |
| 833 kDontSaveFPRegs, | 833 kDontSaveFPRegs, |
| 834 EMIT_REMEMBERED_SET, | 834 EMIT_REMEMBERED_SET, |
| 835 smi_check); | 835 smi_check); |
| (...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1568 // ----------------------------------- | 1568 // ----------------------------------- |
| 1569 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); | 1569 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); |
| 1570 } | 1570 } |
| 1571 | 1571 |
| 1572 | 1572 |
| 1573 #undef __ | 1573 #undef __ |
| 1574 | 1574 |
| 1575 } } // namespace v8::internal | 1575 } } // namespace v8::internal |
| 1576 | 1576 |
| 1577 #endif // V8_TARGET_ARCH_IA32 | 1577 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |