Chromium Code Reviews| 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; |
| 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 that the elements are not smi-only | |
|
Sven Panne
2011/09/16 09:19:32
Hmmm, we make sure that the elements *are* smi-onl
danno
2011/09/21 14:32:04
Done.
| |
| 816 __ mov(ebx, FieldOperand(edx, HeapObject::kMapOffset)); | |
| 817 __ CheckFastSmiOnlyElements(ebx, ¬_smi_only, Label::kNear); | |
| 818 } | |
| 819 | |
| 820 // Non-smis need to call into the runtime if the array is smi only | |
| 821 __ JumpIfNotSmi(eax, &slow); | |
|
Jakob Kummerow
2011/09/16 16:30:34
I think all these added lines (up to and including
danno
2011/09/21 14:32:04
Done.
| |
| 822 __ mov(CodeGenerator::FixedArrayElementOperand(edi, ecx), eax); | |
| 823 __ ret(0); | |
| 824 | |
| 825 __ bind(¬_smi_only); | |
| 813 __ mov(CodeGenerator::FixedArrayElementOperand(edi, ecx), eax); | 826 __ mov(CodeGenerator::FixedArrayElementOperand(edi, ecx), eax); |
| 814 // Update write barrier for the elements array address. | 827 // Update write barrier for the elements array address. |
| 815 __ mov(edx, Operand(eax)); | 828 __ mov(edx, Operand(eax)); |
| 816 __ RecordWrite(edi, 0, edx, ecx); | 829 __ RecordWrite(edi, 0, edx, ecx); |
| 817 __ ret(0); | 830 __ ret(0); |
| 818 } | 831 } |
| 819 | 832 |
| 820 | 833 |
| 821 // The generated code does not accept smi keys. | 834 // The generated code does not accept smi keys. |
| 822 // The generated code falls through if both probes miss. | 835 // The generated code falls through if both probes miss. |
| (...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 |