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 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 685 // Check the key against the length in the array, compute the | 685 // Check the key against the length in the array, compute the |
| 686 // address to store into and fall through to fast case. | 686 // address to store into and fall through to fast case. |
| 687 __ SmiCompareInteger32(FieldOperand(rdx, JSArray::kLengthOffset), rcx); | 687 __ SmiCompareInteger32(FieldOperand(rdx, JSArray::kLengthOffset), rcx); |
| 688 __ j(below_equal, &extra); | 688 __ j(below_equal, &extra); |
| 689 | 689 |
| 690 // Fast case: Do the store. | 690 // Fast case: Do the store. |
| 691 __ bind(&fast); | 691 __ bind(&fast); |
| 692 // rax: value | 692 // rax: value |
| 693 // rbx: receiver's elements array (a FixedArray) | 693 // rbx: receiver's elements array (a FixedArray) |
| 694 // rcx: index | 694 // rcx: index |
| 695 | |
| 696 if (FLAG_smi_only_arrays) { | |
|
William Hesse
2011/09/23 13:25:22
The JumpIfNotSmi can be moved above the guard, tog
Yang
2011/09/23 14:19:12
Done.
| |
| 697 Label not_smi_only; | |
| 698 // Make sure the elements are smi-only. | |
| 699 __ movq(rdi, FieldOperand(rdx, HeapObject::kMapOffset)); | |
| 700 __ CheckFastSmiOnlyElements(rdi, ¬_smi_only, Label::kNear); | |
| 701 // Non-smis need to call into the runtime if the array is smi only. | |
| 702 __ JumpIfNotSmi(rax, &slow); | |
| 703 __ movq(FieldOperand(rbx, rcx, times_pointer_size, FixedArray::kHeaderSize), | |
| 704 rax); | |
| 705 __ ret(0); | |
| 706 __ bind(¬_smi_only); | |
| 707 } | |
| 708 | |
| 695 Label non_smi_value; | 709 Label non_smi_value; |
| 696 __ movq(FieldOperand(rbx, rcx, times_pointer_size, FixedArray::kHeaderSize), | 710 __ movq(FieldOperand(rbx, rcx, times_pointer_size, FixedArray::kHeaderSize), |
| 697 rax); | 711 rax); |
| 698 __ JumpIfNotSmi(rax, &non_smi_value, Label::kNear); | 712 __ JumpIfNotSmi(rax, &non_smi_value, Label::kNear); |
| 699 __ ret(0); | 713 __ ret(0); |
| 700 __ bind(&non_smi_value); | 714 __ bind(&non_smi_value); |
| 701 // Slow case that needs to retain rcx for use by RecordWrite. | 715 // Slow case that needs to retain rcx for use by RecordWrite. |
| 702 // Update write barrier for the elements array address. | 716 // Update write barrier for the elements array address. |
| 703 __ movq(rdx, rax); | 717 __ movq(rdx, rax); |
| 704 __ lea(rcx, | 718 __ lea(rcx, |
| (...skipping 967 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1672 Condition cc = *jmp_address == Assembler::kJncShortOpcode | 1686 Condition cc = *jmp_address == Assembler::kJncShortOpcode |
| 1673 ? not_zero | 1687 ? not_zero |
| 1674 : zero; | 1688 : zero; |
| 1675 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); | 1689 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); |
| 1676 } | 1690 } |
| 1677 | 1691 |
| 1678 | 1692 |
| 1679 } } // namespace v8::internal | 1693 } } // namespace v8::internal |
| 1680 | 1694 |
| 1681 #endif // V8_TARGET_ARCH_X64 | 1695 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |