Chromium Code Reviews| 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 |