Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(926)

Side by Side Diff: src/arm/code-stubs-arm.cc

Issue 6287030: Create specialized code stubs for PixelArray loads. (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: cleanup before review Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 5699 matching lines...) Expand 10 before | Expand all | Expand 10 after
5710 __ LeaveInternalFrame(); 5710 __ LeaveInternalFrame();
5711 // Compute the entry point of the rewritten stub. 5711 // Compute the entry point of the rewritten stub.
5712 __ add(r2, r0, Operand(Code::kHeaderSize - kHeapObjectTag)); 5712 __ add(r2, r0, Operand(Code::kHeaderSize - kHeapObjectTag));
5713 // Restore registers. 5713 // Restore registers.
5714 __ pop(lr); 5714 __ pop(lr);
5715 __ pop(r0); 5715 __ pop(r0);
5716 __ pop(r1); 5716 __ pop(r1);
5717 __ Jump(r2); 5717 __ Jump(r2);
5718 } 5718 }
5719 5719
5720 5720
Søren Thygesen Gjesse 2011/02/01 12:02:56 Please add a comment and mention how the different
danno 2011/02/03 12:53:26 Done.
5721 void GenerateFastPixelArrayLoad(MacroAssembler* masm,
5722 Register receiver,
5723 Register key,
5724 Register elements_map,
5725 Register elements,
5726 Register scratch1,
5727 Register scratch2,
5728 Register result,
5729 Label* not_pixel_array,
5730 Label* key_not_smi,
5731 Label* out_of_range) {
5732 // Register use:
5733 //
5734 // receiver - holds the receiver on entry.
5735 // Unchanged unless 'result' is the same register.
5736 //
5737 // key - holds the smi key on entry.
5738 // Unchanged unless 'result' is the same register.
5739 //
5740 // elements - set to be the receiver's elements on exit.
5741 //
5742 // elements_map - set to be the map of the receiver's elements
5743 // on exit.
5744 //
5745 // result - holds the result of the pixel array load on exit,
5746 // tagged as a smi if successful.
5747 //
5748 // Scratch registers:
5749 //
5750 // scratch1 - holds the receiver's elements, the length of the
5751 // pixel array, the pointer to external elements and
5752 // the untagged result.
5753 //
5754 // scratch2 - holds the untaged key.
5755
5756 // Verify that the receiver has pixel array elements.
5757 __ ldr(elements, FieldMemOperand(receiver, JSObject::kElementsOffset));
5758 __ LoadRoot(scratch1, Heap::kPixelArrayMapRootIndex);
Mads Ager (chromium) 2011/02/01 12:02:12 Can you use __ CheckMap() that accepts a root arra
danno 2011/02/03 12:53:26 Done.
5759 __ ldr(elements_map, FieldMemOperand(elements, JSObject::kMapOffset));
5760 __ cmp(elements_map, scratch1);
5761 __ b(ne, not_pixel_array);
5762
5763 // Key must be a smi that is in the range of the pixel array.
5764 if (key_not_smi != NULL) {
Søren Thygesen Gjesse 2011/02/01 12:02:56 Please explain the if here. If key_not_smi is NULL
danno 2011/02/03 12:53:26 Done.
5765 __ JumpIfNotSmi(key, key_not_smi);
5766 }
5767 __ ldr(scratch1, FieldMemOperand(elements, PixelArray::kLengthOffset));
5768 __ SmiUntag(scratch2, key);
5769 __ cmp(scratch2, scratch1);
5770 __ b(hs, out_of_range);
Søren Thygesen Gjesse 2011/02/01 12:02:56 Maybe comment that the unsigned check covers negat
danno 2011/02/03 12:53:26 Done.
5771
5772 // Perform the indexed load and tag the result as a smi.
5773 __ ldr(scratch1,
5774 FieldMemOperand(elements, PixelArray::kExternalPointerOffset));
5775 __ ldrb(scratch1, MemOperand(scratch1, scratch2));
5776 __ SmiTag(r0, scratch1);
5777 __ Ret();
5778 }
5779
5780
5721 #undef __ 5781 #undef __
5722 5782
5723 } } // namespace v8::internal 5783 } } // namespace v8::internal
5724 5784
5725 #endif // V8_TARGET_ARCH_ARM 5785 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/code-stubs-arm.h ('k') | src/arm/ic-arm.cc » ('j') | src/arm/stub-cache-arm.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698