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