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 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
803 // address to store into and fall through to fast case. | 803 // address to store into and fall through to fast case. |
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 |
| 814 if (FLAG_smi_only_arrays) { |
| 815 Label not_smi_only; |
| 816 // Make sure the elements are smi-only. |
| 817 __ mov(ebx, FieldOperand(edx, HeapObject::kMapOffset)); |
| 818 __ CheckFastSmiOnlyElements(ebx, ¬_smi_only, 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 } |
| 825 |
813 __ mov(CodeGenerator::FixedArrayElementOperand(edi, ecx), eax); | 826 __ mov(CodeGenerator::FixedArrayElementOperand(edi, ecx), eax); |
814 | 827 |
815 // Update write barrier for the elements array address. | 828 // Update write barrier for the elements array address. |
816 __ mov(edx, Operand(eax)); // Preserve the value which is returned. | 829 __ mov(edx, Operand(eax)); // Preserve the value which is returned. |
817 __ RecordWriteArray(edi, edx, ecx, kDontSaveFPRegs); | 830 __ RecordWriteArray(edi, edx, ecx, kDontSaveFPRegs); |
818 __ ret(0); | 831 __ ret(0); |
819 } | 832 } |
820 | 833 |
821 | 834 |
822 // The generated code does not accept smi keys. | 835 // The generated code does not accept smi keys. |
(...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1637 Condition cc = *jmp_address == Assembler::kJncShortOpcode | 1650 Condition cc = *jmp_address == Assembler::kJncShortOpcode |
1638 ? not_zero | 1651 ? not_zero |
1639 : zero; | 1652 : zero; |
1640 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); | 1653 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); |
1641 } | 1654 } |
1642 | 1655 |
1643 | 1656 |
1644 } } // namespace v8::internal | 1657 } } // namespace v8::internal |
1645 | 1658 |
1646 #endif // V8_TARGET_ARCH_IA32 | 1659 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |