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

Unified 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, 11 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 side-by-side diff with in-line comments
Download patch
Index: src/arm/code-stubs-arm.cc
diff --git a/src/arm/code-stubs-arm.cc b/src/arm/code-stubs-arm.cc
index 0a1ffbda5ff4e683fde565b9fd3d4f6540fddb74..259b4bf8e1ee1050cae96c838a727774454eabfd 100644
--- a/src/arm/code-stubs-arm.cc
+++ b/src/arm/code-stubs-arm.cc
@@ -5718,6 +5718,66 @@ void ICCompareStub::GenerateMiss(MacroAssembler* masm) {
}
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.
+void GenerateFastPixelArrayLoad(MacroAssembler* masm,
+ Register receiver,
+ Register key,
+ Register elements_map,
+ Register elements,
+ Register scratch1,
+ Register scratch2,
+ Register result,
+ Label* not_pixel_array,
+ Label* key_not_smi,
+ Label* out_of_range) {
+ // Register use:
+ //
+ // receiver - holds the receiver on entry.
+ // Unchanged unless 'result' is the same register.
+ //
+ // key - holds the smi key on entry.
+ // Unchanged unless 'result' is the same register.
+ //
+ // elements - set to be the receiver's elements on exit.
+ //
+ // elements_map - set to be the map of the receiver's elements
+ // on exit.
+ //
+ // result - holds the result of the pixel array load on exit,
+ // tagged as a smi if successful.
+ //
+ // Scratch registers:
+ //
+ // scratch1 - holds the receiver's elements, the length of the
+ // pixel array, the pointer to external elements and
+ // the untagged result.
+ //
+ // scratch2 - holds the untaged key.
+
+ // Verify that the receiver has pixel array elements.
+ __ ldr(elements, FieldMemOperand(receiver, JSObject::kElementsOffset));
+ __ 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.
+ __ ldr(elements_map, FieldMemOperand(elements, JSObject::kMapOffset));
+ __ cmp(elements_map, scratch1);
+ __ b(ne, not_pixel_array);
+
+ // Key must be a smi that is in the range of the pixel array.
+ 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.
+ __ JumpIfNotSmi(key, key_not_smi);
+ }
+ __ ldr(scratch1, FieldMemOperand(elements, PixelArray::kLengthOffset));
+ __ SmiUntag(scratch2, key);
+ __ cmp(scratch2, scratch1);
+ __ 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.
+
+ // Perform the indexed load and tag the result as a smi.
+ __ ldr(scratch1,
+ FieldMemOperand(elements, PixelArray::kExternalPointerOffset));
+ __ ldrb(scratch1, MemOperand(scratch1, scratch2));
+ __ SmiTag(r0, scratch1);
+ __ Ret();
+}
+
+
#undef __
} } // namespace v8::internal
« 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