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 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
727 | 727 |
728 | 728 |
729 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm, | 729 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm, |
730 StrictModeFlag strict_mode) { | 730 StrictModeFlag strict_mode) { |
731 // ----------- S t a t e ------------- | 731 // ----------- S t a t e ------------- |
732 // -- eax : value | 732 // -- eax : value |
733 // -- ecx : key | 733 // -- ecx : key |
734 // -- edx : receiver | 734 // -- edx : receiver |
735 // -- esp[0] : return address | 735 // -- esp[0] : return address |
736 // ----------------------------------- | 736 // ----------------------------------- |
737 Label slow, fast, array, extra; | 737 Label slow, fast, array, extra, not_smi_only; |
Yang
2011/09/21 14:47:50
Only the if-block uses not_smi_only. Put it there
danno
2011/09/22 11:23:15
Done.
| |
738 | 738 |
739 // Check that the object isn't a smi. | 739 // Check that the object isn't a smi. |
740 __ JumpIfSmi(edx, &slow); | 740 __ JumpIfSmi(edx, &slow); |
741 // Get the map from the receiver. | 741 // Get the map from the receiver. |
742 __ mov(edi, FieldOperand(edx, HeapObject::kMapOffset)); | 742 __ mov(edi, FieldOperand(edx, HeapObject::kMapOffset)); |
743 // Check that the receiver does not require access checks. We need | 743 // Check that the receiver does not require access checks. We need |
744 // to do this because this generic stub does not perform map checks. | 744 // to do this because this generic stub does not perform map checks. |
745 __ test_b(FieldOperand(edi, Map::kBitFieldOffset), | 745 __ test_b(FieldOperand(edi, Map::kBitFieldOffset), |
746 1 << Map::kIsAccessCheckNeeded); | 746 1 << Map::kIsAccessCheckNeeded); |
747 __ j(not_zero, &slow); | 747 __ j(not_zero, &slow); |
(...skipping 55 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 // Make sure the elements are smi-only. | |
816 __ mov(ebx, FieldOperand(edx, HeapObject::kMapOffset)); | |
817 __ CheckFastSmiOnlyElements(ebx, ¬_smi_only, Label::kNear); | |
818 // Non-smis need to call into the runtime if the array is smi only | |
Yang
2011/09/21 14:47:50
Nit: comment should end with a period.
danno
2011/09/22 11:23:15
Done.
| |
819 __ JumpIfNotSmi(eax, &slow); | |
820 __ mov(CodeGenerator::FixedArrayElementOperand(edi, ecx), eax); | |
821 __ ret(0); | |
822 __ bind(¬_smi_only); | |
823 } | |
824 | |
813 __ mov(CodeGenerator::FixedArrayElementOperand(edi, ecx), eax); | 825 __ mov(CodeGenerator::FixedArrayElementOperand(edi, ecx), eax); |
814 | 826 |
815 // Update write barrier for the elements array address. | 827 // Update write barrier for the elements array address. |
816 __ mov(edx, Operand(eax)); // Preserve the value which is returned. | 828 __ mov(edx, Operand(eax)); // Preserve the value which is returned. |
817 __ RecordWriteArray(edi, edx, ecx, kDontSaveFPRegs); | 829 __ RecordWriteArray(edi, edx, ecx, kDontSaveFPRegs); |
818 __ ret(0); | 830 __ ret(0); |
819 } | 831 } |
820 | 832 |
821 | 833 |
822 // The generated code does not accept smi keys. | 834 // 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 | 1649 Condition cc = *jmp_address == Assembler::kJncShortOpcode |
1638 ? not_zero | 1650 ? not_zero |
1639 : zero; | 1651 : zero; |
1640 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); | 1652 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); |
1641 } | 1653 } |
1642 | 1654 |
1643 | 1655 |
1644 } } // namespace v8::internal | 1656 } } // namespace v8::internal |
1645 | 1657 |
1646 #endif // V8_TARGET_ARCH_IA32 | 1658 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |