OLD | NEW |
---|---|
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
804 __ cmp(ecx, FieldOperand(edx, JSArray::kLengthOffset)); // Compare smis. | 804 __ cmp(ecx, FieldOperand(edx, JSArray::kLengthOffset)); // Compare smis. |
805 __ j(above_equal, &extra); | 805 __ j(above_equal, &extra); |
806 | 806 |
807 // Fast case: Do the store. | 807 // Fast case: Do the store. |
808 __ bind(&fast); | 808 __ bind(&fast); |
809 // eax: value | 809 // eax: value |
810 // ecx: key (a smi) | 810 // ecx: key (a smi) |
811 // edx: receiver | 811 // edx: receiver |
812 // edi: FixedArray receiver->elements | 812 // edi: FixedArray receiver->elements |
813 | 813 |
814 Label non_smi_value; | |
815 __ JumpIfNotSmi(eax, &non_smi_value); | |
816 // It's irrelevant whether array is smi-only or not when writing a smi. | |
817 __ mov(CodeGenerator::FixedArrayElementOperand(edi, ecx), eax); | |
818 __ ret(0); | |
819 | |
820 __ bind(&non_smi_value); | |
814 if (FLAG_smi_only_arrays) { | 821 if (FLAG_smi_only_arrays) { |
Rico
2011/09/24 18:40:36
Move (corrected) comment from ic-arm.cc in here
| |
815 Label not_smi_only; | |
816 // Make sure the elements are smi-only. | |
817 __ mov(ebx, FieldOperand(edx, HeapObject::kMapOffset)); | 822 __ mov(ebx, FieldOperand(edx, HeapObject::kMapOffset)); |
818 __ CheckFastSmiOnlyElements(ebx, ¬_smi_only, Label::kNear); | 823 __ CheckFastObjectElements(ebx, &slow, Label::kNear); |
819 // Non-smis need to call into the runtime if the array is smi only. | |
820 __ JumpIfNotSmi(eax, &slow); | |
821 __ mov(CodeGenerator::FixedArrayElementOperand(edi, ecx), eax); | |
822 __ ret(0); | |
823 __ bind(¬_smi_only); | |
824 } | 824 } |
825 | 825 // Fast elements array, store the value to the elements backing store. |
826 __ mov(CodeGenerator::FixedArrayElementOperand(edi, ecx), eax); | 826 __ mov(CodeGenerator::FixedArrayElementOperand(edi, ecx), eax); |
827 | |
828 // Update write barrier for the elements array address. | 827 // Update write barrier for the elements array address. |
829 __ mov(edx, Operand(eax)); // Preserve the value which is returned. | 828 __ mov(edx, Operand(eax)); // Preserve the value which is returned. |
830 __ RecordWriteArray(edi, edx, ecx, kDontSaveFPRegs); | 829 __ RecordWriteArray( |
830 edi, edx, ecx, kDontSaveFPRegs, EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); | |
831 __ ret(0); | 831 __ ret(0); |
832 } | 832 } |
833 | 833 |
834 | 834 |
835 // The generated code does not accept smi keys. | 835 // The generated code does not accept smi keys. |
836 // The generated code falls through if both probes miss. | 836 // The generated code falls through if both probes miss. |
837 static void GenerateMonomorphicCacheProbe(MacroAssembler* masm, | 837 static void GenerateMonomorphicCacheProbe(MacroAssembler* masm, |
838 int argc, | 838 int argc, |
839 Code::Kind kind, | 839 Code::Kind kind, |
840 Code::ExtraICState extra_ic_state) { | 840 Code::ExtraICState extra_ic_state) { |
(...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1650 Condition cc = *jmp_address == Assembler::kJncShortOpcode | 1650 Condition cc = *jmp_address == Assembler::kJncShortOpcode |
1651 ? not_zero | 1651 ? not_zero |
1652 : zero; | 1652 : zero; |
1653 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); | 1653 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); |
1654 } | 1654 } |
1655 | 1655 |
1656 | 1656 |
1657 } } // namespace v8::internal | 1657 } } // namespace v8::internal |
1658 | 1658 |
1659 #endif // V8_TARGET_ARCH_IA32 | 1659 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |