| 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 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 740 __ mov(unmapped_location, eax); | 740 __ mov(unmapped_location, eax); |
| 741 __ lea(edi, unmapped_location); | 741 __ lea(edi, unmapped_location); |
| 742 __ mov(edx, eax); | 742 __ mov(edx, eax); |
| 743 __ RecordWrite(ebx, edi, edx, kDontSaveFPRegs); | 743 __ RecordWrite(ebx, edi, edx, kDontSaveFPRegs); |
| 744 __ Ret(); | 744 __ Ret(); |
| 745 __ bind(&slow); | 745 __ bind(&slow); |
| 746 GenerateMiss(masm, false); | 746 GenerateMiss(masm, false); |
| 747 } | 747 } |
| 748 | 748 |
| 749 | 749 |
| 750 static void KeyedStoreGenerateGenericHelper(MacroAssembler* masm, | 750 static void KeyedStoreGenerateGenericHelper( |
| 751 Label* fast_object, | 751 MacroAssembler* masm, |
| 752 Label* fast_double, | 752 Label* fast_object, |
| 753 Label* slow, | 753 Label* fast_double, |
| 754 bool check_map, | 754 Label* slow, |
| 755 bool increment_length) { | 755 KeyedStoreCheckMap check_map, |
| 756 KeyedStoreIncrementLength increment_length) { |
| 756 Label transition_smi_elements; | 757 Label transition_smi_elements; |
| 757 Label finish_object_store, non_double_value, transition_double_elements; | 758 Label finish_object_store, non_double_value, transition_double_elements; |
| 758 Label fast_double_without_map_check; | 759 Label fast_double_without_map_check; |
| 759 // eax: value | 760 // eax: value |
| 760 // ecx: key (a smi) | 761 // ecx: key (a smi) |
| 761 // edx: receiver | 762 // edx: receiver |
| 762 // ebx: FixedArray receiver->elements | 763 // ebx: FixedArray receiver->elements |
| 763 // edi: receiver map | 764 // edi: receiver map |
| 764 // Fast case: Do the store, could either Object or double. | 765 // Fast case: Do the store, could either Object or double. |
| 765 __ bind(fast_object); | 766 __ bind(fast_object); |
| 766 if (check_map) { | 767 if (check_map == kCheckMap) { |
| 767 __ mov(edi, FieldOperand(ebx, HeapObject::kMapOffset)); | 768 __ mov(edi, FieldOperand(ebx, HeapObject::kMapOffset)); |
| 768 __ cmp(edi, masm->isolate()->factory()->fixed_array_map()); | 769 __ cmp(edi, masm->isolate()->factory()->fixed_array_map()); |
| 769 __ j(not_equal, fast_double); | 770 __ j(not_equal, fast_double); |
| 770 } | 771 } |
| 771 // Smi stores don't require further checks. | 772 // Smi stores don't require further checks. |
| 772 Label non_smi_value; | 773 Label non_smi_value; |
| 773 __ JumpIfNotSmi(eax, &non_smi_value); | 774 __ JumpIfNotSmi(eax, &non_smi_value); |
| 774 if (increment_length) { | 775 if (increment_length == kIncrementLength) { |
| 775 // Add 1 to receiver->length. | 776 // Add 1 to receiver->length. |
| 776 __ add(FieldOperand(edx, JSArray::kLengthOffset), | 777 __ add(FieldOperand(edx, JSArray::kLengthOffset), |
| 777 Immediate(Smi::FromInt(1))); | 778 Immediate(Smi::FromInt(1))); |
| 778 } | 779 } |
| 779 // It's irrelevant whether array is smi-only or not when writing a smi. | 780 // It's irrelevant whether array is smi-only or not when writing a smi. |
| 780 __ mov(CodeGenerator::FixedArrayElementOperand(ebx, ecx), eax); | 781 __ mov(CodeGenerator::FixedArrayElementOperand(ebx, ecx), eax); |
| 781 __ ret(0); | 782 __ ret(0); |
| 782 | 783 |
| 783 __ bind(&non_smi_value); | 784 __ bind(&non_smi_value); |
| 784 // Escape to elements kind transition case. | 785 // Escape to elements kind transition case. |
| 785 __ mov(edi, FieldOperand(edx, HeapObject::kMapOffset)); | 786 __ mov(edi, FieldOperand(edx, HeapObject::kMapOffset)); |
| 786 __ CheckFastObjectElements(edi, &transition_smi_elements); | 787 __ CheckFastObjectElements(edi, &transition_smi_elements); |
| 787 | 788 |
| 788 // Fast elements array, store the value to the elements backing store. | 789 // Fast elements array, store the value to the elements backing store. |
| 789 __ bind(&finish_object_store); | 790 __ bind(&finish_object_store); |
| 790 if (increment_length) { | 791 if (increment_length == kIncrementLength) { |
| 791 // Add 1 to receiver->length. | 792 // Add 1 to receiver->length. |
| 792 __ add(FieldOperand(edx, JSArray::kLengthOffset), | 793 __ add(FieldOperand(edx, JSArray::kLengthOffset), |
| 793 Immediate(Smi::FromInt(1))); | 794 Immediate(Smi::FromInt(1))); |
| 794 } | 795 } |
| 795 __ mov(CodeGenerator::FixedArrayElementOperand(ebx, ecx), eax); | 796 __ mov(CodeGenerator::FixedArrayElementOperand(ebx, ecx), eax); |
| 796 // Update write barrier for the elements array address. | 797 // Update write barrier for the elements array address. |
| 797 __ mov(edx, eax); // Preserve the value which is returned. | 798 __ mov(edx, eax); // Preserve the value which is returned. |
| 798 __ RecordWriteArray( | 799 __ RecordWriteArray( |
| 799 ebx, edx, ecx, kDontSaveFPRegs, EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); | 800 ebx, edx, ecx, kDontSaveFPRegs, EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); |
| 800 __ ret(0); | 801 __ ret(0); |
| 801 | 802 |
| 802 __ bind(fast_double); | 803 __ bind(fast_double); |
| 803 if (check_map) { | 804 if (check_map == kCheckMap) { |
| 804 // Check for fast double array case. If this fails, call through to the | 805 // Check for fast double array case. If this fails, call through to the |
| 805 // runtime. | 806 // runtime. |
| 806 __ cmp(edi, masm->isolate()->factory()->fixed_double_array_map()); | 807 __ cmp(edi, masm->isolate()->factory()->fixed_double_array_map()); |
| 807 __ j(not_equal, slow); | 808 __ j(not_equal, slow); |
| 808 // If the value is a number, store it as a double in the FastDoubleElements | 809 // If the value is a number, store it as a double in the FastDoubleElements |
| 809 // array. | 810 // array. |
| 810 } | 811 } |
| 811 __ bind(&fast_double_without_map_check); | 812 __ bind(&fast_double_without_map_check); |
| 812 __ StoreNumberToDoubleElements(eax, ebx, ecx, edi, xmm0, | 813 __ StoreNumberToDoubleElements(eax, ebx, ecx, edi, xmm0, |
| 813 &transition_double_elements, false); | 814 &transition_double_elements, false); |
| 814 if (increment_length) { | 815 if (increment_length == kIncrementLength) { |
| 815 // Add 1 to receiver->length. | 816 // Add 1 to receiver->length. |
| 816 __ add(FieldOperand(edx, JSArray::kLengthOffset), | 817 __ add(FieldOperand(edx, JSArray::kLengthOffset), |
| 817 Immediate(Smi::FromInt(1))); | 818 Immediate(Smi::FromInt(1))); |
| 818 } | 819 } |
| 819 __ ret(0); | 820 __ ret(0); |
| 820 | 821 |
| 821 __ bind(&transition_smi_elements); | 822 __ bind(&transition_smi_elements); |
| 822 __ mov(ebx, FieldOperand(edx, HeapObject::kMapOffset)); | 823 __ mov(ebx, FieldOperand(edx, HeapObject::kMapOffset)); |
| 823 | 824 |
| 824 // Transition the array appropriately depending on the value type. | 825 // Transition the array appropriately depending on the value type. |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 940 // edx: receiver, a JSArray | 941 // edx: receiver, a JSArray |
| 941 // ecx: key, a smi. | 942 // ecx: key, a smi. |
| 942 // edi: receiver map | 943 // edi: receiver map |
| 943 __ mov(ebx, FieldOperand(edx, JSObject::kElementsOffset)); | 944 __ mov(ebx, FieldOperand(edx, JSObject::kElementsOffset)); |
| 944 | 945 |
| 945 // Check the key against the length in the array and fall through to the | 946 // Check the key against the length in the array and fall through to the |
| 946 // common store code. | 947 // common store code. |
| 947 __ cmp(ecx, FieldOperand(edx, JSArray::kLengthOffset)); // Compare smis. | 948 __ cmp(ecx, FieldOperand(edx, JSArray::kLengthOffset)); // Compare smis. |
| 948 __ j(above_equal, &extra); | 949 __ j(above_equal, &extra); |
| 949 | 950 |
| 950 KeyedStoreGenerateGenericHelper(masm, &fast_object, &fast_double, &slow, | 951 KeyedStoreGenerateGenericHelper(masm, &fast_object, &fast_double, |
| 951 true, false); | 952 &slow, kCheckMap, kDontIncrementLength); |
| 952 KeyedStoreGenerateGenericHelper(masm, &fast_object_grow, &fast_double_grow, | 953 KeyedStoreGenerateGenericHelper(masm, &fast_object_grow, &fast_double_grow, |
| 953 &slow, false, true); | 954 &slow, kDontCheckMap, kIncrementLength); |
| 954 } | 955 } |
| 955 | 956 |
| 956 | 957 |
| 957 // The generated code does not accept smi keys. | 958 // The generated code does not accept smi keys. |
| 958 // The generated code falls through if both probes miss. | 959 // The generated code falls through if both probes miss. |
| 959 void CallICBase::GenerateMonomorphicCacheProbe(MacroAssembler* masm, | 960 void CallICBase::GenerateMonomorphicCacheProbe(MacroAssembler* masm, |
| 960 int argc, | 961 int argc, |
| 961 Code::Kind kind, | 962 Code::Kind kind, |
| 962 Code::ExtraICState extra_state) { | 963 Code::ExtraICState extra_state) { |
| 963 // ----------- S t a t e ------------- | 964 // ----------- S t a t e ------------- |
| (...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1792 Condition cc = (check == ENABLE_INLINED_SMI_CHECK) | 1793 Condition cc = (check == ENABLE_INLINED_SMI_CHECK) |
| 1793 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) | 1794 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) |
| 1794 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); | 1795 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); |
| 1795 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); | 1796 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); |
| 1796 } | 1797 } |
| 1797 | 1798 |
| 1798 | 1799 |
| 1799 } } // namespace v8::internal | 1800 } } // namespace v8::internal |
| 1800 | 1801 |
| 1801 #endif // V8_TARGET_ARCH_IA32 | 1802 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |