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 5753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5764 // Compute the entry point of the rewritten stub. | 5764 // Compute the entry point of the rewritten stub. |
5765 __ add(r2, r0, Operand(Code::kHeaderSize - kHeapObjectTag)); | 5765 __ add(r2, r0, Operand(Code::kHeaderSize - kHeapObjectTag)); |
5766 // Restore registers. | 5766 // Restore registers. |
5767 __ pop(lr); | 5767 __ pop(lr); |
5768 __ pop(r0); | 5768 __ pop(r0); |
5769 __ pop(r1); | 5769 __ pop(r1); |
5770 __ Jump(r2); | 5770 __ Jump(r2); |
5771 } | 5771 } |
5772 | 5772 |
5773 | 5773 |
| 5774 void GenerateFastPixelArrayLoad(MacroAssembler* masm, |
| 5775 Register receiver, |
| 5776 Register key, |
| 5777 Register elements_map, |
| 5778 Register elements, |
| 5779 Register scratch1, |
| 5780 Register scratch2, |
| 5781 Register result, |
| 5782 Label* not_pixel_array, |
| 5783 Label* key_not_smi, |
| 5784 Label* out_of_range) { |
| 5785 // Register use: |
| 5786 // |
| 5787 // receiver - holds the receiver on entry. |
| 5788 // Unchanged unless 'result' is the same register. |
| 5789 // |
| 5790 // key - holds the smi key on entry. |
| 5791 // Unchanged unless 'result' is the same register. |
| 5792 // |
| 5793 // elements - set to be the receiver's elements on exit. |
| 5794 // |
| 5795 // elements_map - set to be the map of the receiver's elements |
| 5796 // on exit. |
| 5797 // |
| 5798 // result - holds the result of the pixel array load on exit, |
| 5799 // tagged as a smi if successful. |
| 5800 // |
| 5801 // Scratch registers: |
| 5802 // |
| 5803 // scratch1 - used a scratch register in map check, if map |
| 5804 // check is successful, contains the length of the |
| 5805 // pixel array, the pointer to external elements and |
| 5806 // the untagged result. |
| 5807 // |
| 5808 // scratch2 - holds the untaged key. |
| 5809 |
| 5810 // Some callers already have verified that the key is a smi. key_not_smi is |
| 5811 // set to NULL as a sentinel for that case. Otherwise, add an explicit check |
| 5812 // to ensure the key is a smi must be added. |
| 5813 if (key_not_smi != NULL) { |
| 5814 __ JumpIfNotSmi(key, key_not_smi); |
| 5815 } else { |
| 5816 if (FLAG_debug_code) { |
| 5817 __ AbortIfNotSmi(key); |
| 5818 } |
| 5819 } |
| 5820 __ SmiUntag(scratch2, key); |
| 5821 |
| 5822 // Verify that the receiver has pixel array elements. |
| 5823 __ ldr(elements, FieldMemOperand(receiver, JSObject::kElementsOffset)); |
| 5824 __ CheckMap(elements, scratch1, Heap::kPixelArrayMapRootIndex, |
| 5825 not_pixel_array, true); |
| 5826 |
| 5827 // Key must be in range of the pixel array. |
| 5828 __ ldr(scratch1, FieldMemOperand(elements, PixelArray::kLengthOffset)); |
| 5829 __ cmp(scratch2, scratch1); |
| 5830 __ b(hs, out_of_range); // unsigned check handles negative keys. |
| 5831 |
| 5832 // Perform the indexed load and tag the result as a smi. |
| 5833 __ ldr(scratch1, |
| 5834 FieldMemOperand(elements, PixelArray::kExternalPointerOffset)); |
| 5835 __ ldrb(scratch1, MemOperand(scratch1, scratch2)); |
| 5836 __ SmiTag(r0, scratch1); |
| 5837 __ Ret(); |
| 5838 } |
| 5839 |
| 5840 |
5774 #undef __ | 5841 #undef __ |
5775 | 5842 |
5776 } } // namespace v8::internal | 5843 } } // namespace v8::internal |
5777 | 5844 |
5778 #endif // V8_TARGET_ARCH_ARM | 5845 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |