| OLD | NEW |
| 1 // Copyright 2011 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 |
| 11 // with the distribution. | 11 // with the distribution. |
| (...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 758 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm, | 758 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm, |
| 759 StrictModeFlag strict_mode) { | 759 StrictModeFlag strict_mode) { |
| 760 // ----------- S t a t e ------------- | 760 // ----------- S t a t e ------------- |
| 761 // -- eax : value | 761 // -- eax : value |
| 762 // -- ecx : key | 762 // -- ecx : key |
| 763 // -- edx : receiver | 763 // -- edx : receiver |
| 764 // -- esp[0] : return address | 764 // -- esp[0] : return address |
| 765 // ----------------------------------- | 765 // ----------------------------------- |
| 766 Label slow, fast_object_with_map_check, fast_object_without_map_check; | 766 Label slow, fast_object_with_map_check, fast_object_without_map_check; |
| 767 Label fast_double_with_map_check, fast_double_without_map_check; | 767 Label fast_double_with_map_check, fast_double_without_map_check; |
| 768 Label check_if_double_array, array, extra; | 768 Label check_if_double_array, array, extra, transition_smi_elements; |
| 769 Label finish_object_store, non_double_value, transition_double_elements; |
| 769 | 770 |
| 770 // Check that the object isn't a smi. | 771 // Check that the object isn't a smi. |
| 771 __ JumpIfSmi(edx, &slow); | 772 __ JumpIfSmi(edx, &slow); |
| 772 // Get the map from the receiver. | 773 // Get the map from the receiver. |
| 773 __ mov(edi, FieldOperand(edx, HeapObject::kMapOffset)); | 774 __ mov(edi, FieldOperand(edx, HeapObject::kMapOffset)); |
| 774 // Check that the receiver does not require access checks. We need | 775 // Check that the receiver does not require access checks. We need |
| 775 // to do this because this generic stub does not perform map checks. | 776 // to do this because this generic stub does not perform map checks. |
| 776 __ test_b(FieldOperand(edi, Map::kBitFieldOffset), | 777 __ test_b(FieldOperand(edi, Map::kBitFieldOffset), |
| 777 1 << Map::kIsAccessCheckNeeded); | 778 1 << Map::kIsAccessCheckNeeded); |
| 778 __ j(not_zero, &slow); | 779 __ j(not_zero, &slow); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 855 __ j(not_equal, &fast_double_with_map_check); | 856 __ j(not_equal, &fast_double_with_map_check); |
| 856 __ bind(&fast_object_without_map_check); | 857 __ bind(&fast_object_without_map_check); |
| 857 // Smi stores don't require further checks. | 858 // Smi stores don't require further checks. |
| 858 Label non_smi_value; | 859 Label non_smi_value; |
| 859 __ JumpIfNotSmi(eax, &non_smi_value); | 860 __ JumpIfNotSmi(eax, &non_smi_value); |
| 860 // It's irrelevant whether array is smi-only or not when writing a smi. | 861 // It's irrelevant whether array is smi-only or not when writing a smi. |
| 861 __ mov(CodeGenerator::FixedArrayElementOperand(ebx, ecx), eax); | 862 __ mov(CodeGenerator::FixedArrayElementOperand(ebx, ecx), eax); |
| 862 __ ret(0); | 863 __ ret(0); |
| 863 | 864 |
| 864 __ bind(&non_smi_value); | 865 __ bind(&non_smi_value); |
| 865 // Escape to slow case when writing non-smi into smi-only array. | 866 // Escape to elements kind transition case. |
| 866 __ mov(edi, FieldOperand(edx, HeapObject::kMapOffset)); | 867 __ mov(edi, FieldOperand(edx, HeapObject::kMapOffset)); |
| 867 __ CheckFastObjectElements(edi, &slow, Label::kNear); | 868 __ CheckFastObjectElements(edi, &transition_smi_elements); |
| 868 | 869 |
| 869 // Fast elements array, store the value to the elements backing store. | 870 // Fast elements array, store the value to the elements backing store. |
| 871 __ bind(&finish_object_store); |
| 870 __ mov(CodeGenerator::FixedArrayElementOperand(ebx, ecx), eax); | 872 __ mov(CodeGenerator::FixedArrayElementOperand(ebx, ecx), eax); |
| 871 // Update write barrier for the elements array address. | 873 // Update write barrier for the elements array address. |
| 872 __ mov(edx, eax); // Preserve the value which is returned. | 874 __ mov(edx, eax); // Preserve the value which is returned. |
| 873 __ RecordWriteArray( | 875 __ RecordWriteArray( |
| 874 ebx, edx, ecx, kDontSaveFPRegs, EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); | 876 ebx, edx, ecx, kDontSaveFPRegs, EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); |
| 875 __ ret(0); | 877 __ ret(0); |
| 876 | 878 |
| 877 __ bind(&fast_double_with_map_check); | 879 __ bind(&fast_double_with_map_check); |
| 878 // Check for fast double array case. If this fails, call through to the | 880 // Check for fast double array case. If this fails, call through to the |
| 879 // runtime. | 881 // runtime. |
| 880 __ cmp(edi, masm->isolate()->factory()->fixed_double_array_map()); | 882 __ cmp(edi, masm->isolate()->factory()->fixed_double_array_map()); |
| 881 __ j(not_equal, &slow); | 883 __ j(not_equal, &slow); |
| 882 __ bind(&fast_double_without_map_check); | 884 __ bind(&fast_double_without_map_check); |
| 883 // If the value is a number, store it as a double in the FastDoubleElements | 885 // If the value is a number, store it as a double in the FastDoubleElements |
| 884 // array. | 886 // array. |
| 885 __ StoreNumberToDoubleElements(eax, ebx, ecx, edx, xmm0, &slow, false); | 887 __ StoreNumberToDoubleElements(eax, ebx, ecx, edx, xmm0, |
| 888 &transition_double_elements, false); |
| 886 __ ret(0); | 889 __ ret(0); |
| 890 |
| 891 __ bind(&transition_smi_elements); |
| 892 __ mov(ebx, FieldOperand(edx, HeapObject::kMapOffset)); |
| 893 |
| 894 // Transition the array appropriately depending on the value type. |
| 895 __ CheckMap(eax, |
| 896 masm->isolate()->factory()->heap_number_map(), |
| 897 &non_double_value, |
| 898 DONT_DO_SMI_CHECK); |
| 899 |
| 900 // Value is a double. Transition FAST_SMI_ONLY_ELEMENTS -> |
| 901 // FAST_DOUBLE_ELEMENTS and complete the store. |
| 902 __ LoadTransitionedArrayMapConditional(FAST_SMI_ONLY_ELEMENTS, |
| 903 FAST_DOUBLE_ELEMENTS, |
| 904 ebx, |
| 905 edi, |
| 906 &slow); |
| 907 ElementsTransitionGenerator::GenerateSmiOnlyToDouble(masm, &slow); |
| 908 __ mov(ebx, FieldOperand(edx, JSObject::kElementsOffset)); |
| 909 __ jmp(&fast_double_without_map_check); |
| 910 |
| 911 __ bind(&non_double_value); |
| 912 // Value is not a double, FAST_SMI_ONLY_ELEMENTS -> FAST_ELEMENTS |
| 913 __ LoadTransitionedArrayMapConditional(FAST_SMI_ONLY_ELEMENTS, |
| 914 FAST_ELEMENTS, |
| 915 ebx, |
| 916 edi, |
| 917 &slow); |
| 918 ElementsTransitionGenerator::GenerateSmiOnlyToObject(masm); |
| 919 __ mov(ebx, FieldOperand(edx, JSObject::kElementsOffset)); |
| 920 __ jmp(&finish_object_store); |
| 921 |
| 922 __ bind(&transition_double_elements); |
| 923 // Elements are FAST_DOUBLE_ELEMENTS, but value is an Object that's not a |
| 924 // HeapNumber. Make sure that the receiver is a Array with FAST_ELEMENTS and |
| 925 // transition array from FAST_DOUBLE_ELEMENTS to FAST_ELEMENTS |
| 926 __ mov(ebx, FieldOperand(edx, HeapObject::kMapOffset)); |
| 927 __ LoadTransitionedArrayMapConditional(FAST_DOUBLE_ELEMENTS, |
| 928 FAST_ELEMENTS, |
| 929 ebx, |
| 930 edi, |
| 931 &slow); |
| 932 ElementsTransitionGenerator::GenerateDoubleToObject(masm, &slow); |
| 933 __ mov(ebx, FieldOperand(edx, JSObject::kElementsOffset)); |
| 934 __ jmp(&finish_object_store); |
| 887 } | 935 } |
| 888 | 936 |
| 889 | 937 |
| 890 // The generated code does not accept smi keys. | 938 // The generated code does not accept smi keys. |
| 891 // The generated code falls through if both probes miss. | 939 // The generated code falls through if both probes miss. |
| 892 void CallICBase::GenerateMonomorphicCacheProbe(MacroAssembler* masm, | 940 void CallICBase::GenerateMonomorphicCacheProbe(MacroAssembler* masm, |
| 893 int argc, | 941 int argc, |
| 894 Code::Kind kind, | 942 Code::Kind kind, |
| 895 Code::ExtraICState extra_state) { | 943 Code::ExtraICState extra_state) { |
| 896 // ----------- S t a t e ------------- | 944 // ----------- S t a t e ------------- |
| (...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1715 Condition cc = *jmp_address == Assembler::kJncShortOpcode | 1763 Condition cc = *jmp_address == Assembler::kJncShortOpcode |
| 1716 ? not_zero | 1764 ? not_zero |
| 1717 : zero; | 1765 : zero; |
| 1718 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); | 1766 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); |
| 1719 } | 1767 } |
| 1720 | 1768 |
| 1721 | 1769 |
| 1722 } } // namespace v8::internal | 1770 } } // namespace v8::internal |
| 1723 | 1771 |
| 1724 #endif // V8_TARGET_ARCH_IA32 | 1772 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |