Index: src/x64/ic-x64.cc |
=================================================================== |
--- src/x64/ic-x64.cc (revision 6456) |
+++ src/x64/ic-x64.cc (working copy) |
@@ -767,6 +767,41 @@ |
} |
+void KeyedLoadIC::GeneratePixelArray(MacroAssembler* masm) { |
+ // ----------- S t a t e ------------- |
+ // -- rax : key |
+ // -- rdx : receiver |
+ // -- rsp[0] : return address |
+ // ----------------------------------- |
+ Label slow; |
+ |
+ // Verify that it's safe to access the receiver's elements. |
+ GenerateKeyedLoadReceiverCheck( |
+ masm, rdx, rcx, Map::kHasNamedInterceptor, &slow); |
+ |
+ // Verify that the receiver has pixel array elements. |
+ __ movq(rcx, FieldOperand(rdx, JSObject::kElementsOffset)); |
+ __ CompareRoot(FieldOperand(rcx, HeapObject::kMapOffset), |
+ Heap::kPixelArrayMapRootIndex); |
+ __ j(not_equal, &slow); |
+ |
+ // Check that the key is a smi and in range. |
+ __ JumpIfNotSmi(rax, &slow); |
+ __ SmiToInteger32(rbx, rax); |
+ __ cmpl(rbx, FieldOperand(rcx, PixelArray::kLengthOffset)); |
+ __ j(above_equal, &slow); |
+ |
+ // Load and tag the element as a smi. |
+ __ movq(rax, FieldOperand(rcx, PixelArray::kExternalPointerOffset)); |
+ __ movzxbq(rax, Operand(rax, rbx, times_1, 0)); |
+ __ Integer32ToSmi(rax, rax); |
+ __ ret(0); |
+ |
+ __ bind(&slow); |
+ GenerateMiss(masm); |
+} |
+ |
+ |
void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm) { |
// ----------- S t a t e ------------- |
// -- rax : value |