OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
815 __ bind(&slow_with_tagged_index); | 815 __ bind(&slow_with_tagged_index); |
816 GenerateRuntimeSetProperty(masm); | 816 GenerateRuntimeSetProperty(masm); |
817 // Never returns to here. | 817 // Never returns to here. |
818 | 818 |
819 // Check whether the elements is a pixel array. | 819 // Check whether the elements is a pixel array. |
820 // rax: value | 820 // rax: value |
821 // rdx: receiver | 821 // rdx: receiver |
822 // rbx: receiver's elements array | 822 // rbx: receiver's elements array |
823 // rcx: index, zero-extended. | 823 // rcx: index, zero-extended. |
824 __ bind(&check_pixel_array); | 824 __ bind(&check_pixel_array); |
825 __ CompareRoot(FieldOperand(rbx, HeapObject::kMapOffset), | 825 GenerateFastPixelArrayStore(masm, |
826 Heap::kPixelArrayMapRootIndex); | 826 rdx, |
827 __ j(not_equal, &slow); | 827 rcx, |
828 // Check that the value is a smi. If a conversion is needed call into the | 828 rax, |
829 // runtime to convert and clamp. | 829 rbx, |
830 __ JumpIfNotSmi(rax, &slow); | 830 rdi, |
831 __ cmpl(rcx, FieldOperand(rbx, PixelArray::kLengthOffset)); | 831 false, |
832 __ j(above_equal, &slow); | 832 true, |
833 // No more bailouts to slow case on this path, so key not needed. | 833 NULL, |
834 __ SmiToInteger32(rdi, rax); | 834 &slow, |
835 { // Clamp the value to [0..255]. | 835 &slow, |
836 NearLabel done; | 836 &slow); |
837 __ testl(rdi, Immediate(0xFFFFFF00)); | |
838 __ j(zero, &done); | |
839 __ setcc(negative, rdi); // 1 if negative, 0 if positive. | |
840 __ decb(rdi); // 0 if negative, 255 if positive. | |
841 __ bind(&done); | |
842 } | |
843 __ movq(rbx, FieldOperand(rbx, PixelArray::kExternalPointerOffset)); | |
844 __ movb(Operand(rbx, rcx, times_1, 0), rdi); | |
845 __ ret(0); | |
846 | 837 |
847 // Extra capacity case: Check if there is extra capacity to | 838 // Extra capacity case: Check if there is extra capacity to |
848 // perform the store and update the length. Used for adding one | 839 // perform the store and update the length. Used for adding one |
849 // element to the array by writing to array[array.length]. | 840 // element to the array by writing to array[array.length]. |
850 __ bind(&extra); | 841 __ bind(&extra); |
851 // rax: value | 842 // rax: value |
852 // rdx: receiver (a JSArray) | 843 // rdx: receiver (a JSArray) |
853 // rbx: receiver's elements array (a FixedArray) | 844 // rbx: receiver's elements array (a FixedArray) |
854 // rcx: index | 845 // rcx: index |
855 // flags: smicompare (rdx.length(), rbx) | 846 // flags: smicompare (rdx.length(), rbx) |
(...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1754 Condition cc = *jmp_address == Assembler::kJncShortOpcode | 1745 Condition cc = *jmp_address == Assembler::kJncShortOpcode |
1755 ? not_zero | 1746 ? not_zero |
1756 : zero; | 1747 : zero; |
1757 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); | 1748 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); |
1758 } | 1749 } |
1759 | 1750 |
1760 | 1751 |
1761 } } // namespace v8::internal | 1752 } } // namespace v8::internal |
1762 | 1753 |
1763 #endif // V8_TARGET_ARCH_X64 | 1754 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |