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 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
726 // edx: receiver | 726 // edx: receiver |
727 // ebx: FixedArray receiver->elements | 727 // ebx: FixedArray receiver->elements |
728 // edi: receiver map | 728 // edi: receiver map |
729 // Fast case: Do the store, could either Object or double. | 729 // Fast case: Do the store, could either Object or double. |
730 __ bind(fast_object); | 730 __ bind(fast_object); |
731 if (check_map == kCheckMap) { | 731 if (check_map == kCheckMap) { |
732 __ mov(edi, FieldOperand(ebx, HeapObject::kMapOffset)); | 732 __ mov(edi, FieldOperand(ebx, HeapObject::kMapOffset)); |
733 __ cmp(edi, masm->isolate()->factory()->fixed_array_map()); | 733 __ cmp(edi, masm->isolate()->factory()->fixed_array_map()); |
734 __ j(not_equal, fast_double); | 734 __ j(not_equal, fast_double); |
735 } | 735 } |
| 736 |
| 737 // HOLECHECK: guards "A[i] = V" |
| 738 // We have to go to the runtime if the current value is the hole because |
| 739 // there may be a callback on the element |
| 740 Label holecheck_passed1; |
| 741 __ cmp(CodeGenerator::FixedArrayElementOperand(ebx, ecx), |
| 742 masm->isolate()->factory()->the_hole_value()); |
| 743 __ j(not_equal, &holecheck_passed1); |
| 744 __ HasDictionaryInPrototypeChain(edx, ebx, edi, slow); |
| 745 |
| 746 __ bind(&holecheck_passed1); |
| 747 |
736 // Smi stores don't require further checks. | 748 // Smi stores don't require further checks. |
737 Label non_smi_value; | 749 Label non_smi_value; |
738 __ JumpIfNotSmi(eax, &non_smi_value); | 750 __ JumpIfNotSmi(eax, &non_smi_value); |
739 if (increment_length == kIncrementLength) { | 751 if (increment_length == kIncrementLength) { |
740 // Add 1 to receiver->length. | 752 // Add 1 to receiver->length. |
741 __ add(FieldOperand(edx, JSArray::kLengthOffset), | 753 __ add(FieldOperand(edx, JSArray::kLengthOffset), |
742 Immediate(Smi::FromInt(1))); | 754 Immediate(Smi::FromInt(1))); |
743 } | 755 } |
744 // It's irrelevant whether array is smi-only or not when writing a smi. | 756 // It's irrelevant whether array is smi-only or not when writing a smi. |
745 __ mov(CodeGenerator::FixedArrayElementOperand(ebx, ecx), eax); | 757 __ mov(CodeGenerator::FixedArrayElementOperand(ebx, ecx), eax); |
(...skipping 20 matching lines...) Expand all Loading... |
766 | 778 |
767 __ bind(fast_double); | 779 __ bind(fast_double); |
768 if (check_map == kCheckMap) { | 780 if (check_map == kCheckMap) { |
769 // Check for fast double array case. If this fails, call through to the | 781 // Check for fast double array case. If this fails, call through to the |
770 // runtime. | 782 // runtime. |
771 __ cmp(edi, masm->isolate()->factory()->fixed_double_array_map()); | 783 __ cmp(edi, masm->isolate()->factory()->fixed_double_array_map()); |
772 __ j(not_equal, slow); | 784 __ j(not_equal, slow); |
773 // If the value is a number, store it as a double in the FastDoubleElements | 785 // If the value is a number, store it as a double in the FastDoubleElements |
774 // array. | 786 // array. |
775 } | 787 } |
| 788 |
| 789 // HOLECHECK: guards "A[i] double hole?" |
| 790 // We have to see if the double version of the hole is present. If so |
| 791 // go to the runtime. |
| 792 uint32_t offset = FixedDoubleArray::kHeaderSize + sizeof(kHoleNanLower32); |
| 793 __ cmp(FieldOperand(ebx, ecx, times_4, offset), Immediate(kHoleNanUpper32)); |
| 794 __ j(not_equal, &fast_double_without_map_check); |
| 795 __ HasDictionaryInPrototypeChain(edx, ebx, edi, slow); |
| 796 |
776 __ bind(&fast_double_without_map_check); | 797 __ bind(&fast_double_without_map_check); |
777 __ StoreNumberToDoubleElements(eax, ebx, ecx, edi, xmm0, | 798 __ StoreNumberToDoubleElements(eax, ebx, ecx, edi, xmm0, |
778 &transition_double_elements, false); | 799 &transition_double_elements, false); |
779 if (increment_length == kIncrementLength) { | 800 if (increment_length == kIncrementLength) { |
780 // Add 1 to receiver->length. | 801 // Add 1 to receiver->length. |
781 __ add(FieldOperand(edx, JSArray::kLengthOffset), | 802 __ add(FieldOperand(edx, JSArray::kLengthOffset), |
782 Immediate(Smi::FromInt(1))); | 803 Immediate(Smi::FromInt(1))); |
783 } | 804 } |
784 __ ret(0); | 805 __ ret(0); |
785 | 806 |
(...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1658 Condition cc = (check == ENABLE_INLINED_SMI_CHECK) | 1679 Condition cc = (check == ENABLE_INLINED_SMI_CHECK) |
1659 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) | 1680 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) |
1660 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); | 1681 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); |
1661 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); | 1682 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); |
1662 } | 1683 } |
1663 | 1684 |
1664 | 1685 |
1665 } } // namespace v8::internal | 1686 } } // namespace v8::internal |
1666 | 1687 |
1667 #endif // V8_TARGET_ARCH_IA32 | 1688 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |