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

Side by Side Diff: runtime/vm/intrinsifier_x64.cc

Issue 11783006: Intrinsify Uint8ClampedArray's store and load indexed, inline load indexed. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64.
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
7 7
8 #include "vm/intrinsifier.h" 8 #include "vm/intrinsifier.h"
9 9
10 #include "vm/assembler.h" 10 #include "vm/assembler.h"
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 // Check that value is a byte. 512 // Check that value is a byte.
513 __ cmpq(RDI, Immediate(0xFF)); 513 __ cmpq(RDI, Immediate(0xFF));
514 __ j(ABOVE, &fall_through, Assembler::kNearJump); 514 __ j(ABOVE, &fall_through, Assembler::kNearJump);
515 __ movb(FieldAddress(RAX, R12, TIMES_1, Uint8Array::data_offset()), RDI); 515 __ movb(FieldAddress(RAX, R12, TIMES_1, Uint8Array::data_offset()), RDI);
516 __ ret(); 516 __ ret();
517 __ Bind(&fall_through); 517 __ Bind(&fall_through);
518 return false; 518 return false;
519 } 519 }
520 520
521 521
522 bool Intrinsifier::UintClamped8Array_getIndexed(Assembler* assembler) {
523 return Uint8Array_setIndexed(assembler);
524 }
525
526
527 bool Intrinsifier::Uint8ClampedArray_setIndexed(Assembler* assembler) {
528 Label fall_through, store_value, load_0xff;
529 // Verify that the array index is valid.
530 TestByteArraySetIndex(assembler, &fall_through);
531 // After TestByteArraySetIndex:
532 // * RAX has the base address of the byte array.
533 // * R12 has the index into the array.
534 // R12 contains the SMI index which is shifted by 1.
535 __ SmiUntag(R12);
536 __ movq(RDI, Address(RSP, + 1 * kWordSize)); // Value.
537 __ testq(RDI, Immediate(kSmiTagMask));
538 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump);
539
540 __ SmiUntag(RDI);
541 __ cmpq(RDI, Immediate(0xFF));
542 __ j(BELOW_EQUAL, &store_value, Assembler::kNearJump);
543 __ j(GREATER, &load_0xff, Assembler::kNearJump);
544 __ xorq(RDI, RDI); // Zero.
545 __ jmp(&store_value, Assembler::kNearJump);
546 __ Bind(&load_0xff);
547 __ movq(RDI, Immediate(0xFF));
548
549 __ Bind(&store_value);
550 __ movb(FieldAddress(RAX, R12, TIMES_1, Uint8Array::data_offset()), RDI);
551 __ ret();
552 __ Bind(&fall_through);
553 return false;
554 }
555
556
522 bool Intrinsifier::Uint8Array_getIndexed(Assembler* assembler) { 557 bool Intrinsifier::Uint8Array_getIndexed(Assembler* assembler) {
523 Label fall_through; 558 Label fall_through;
524 TestByteArrayIndex(assembler, &fall_through); 559 TestByteArrayIndex(assembler, &fall_through);
525 __ SmiUntag(R12); 560 __ SmiUntag(R12);
526 __ movzxb(RAX, FieldAddress(RAX, 561 __ movzxb(RAX, FieldAddress(RAX,
527 R12, 562 R12,
528 TIMES_1, 563 TIMES_1,
529 Uint8Array::data_offset())); 564 Uint8Array::data_offset()));
530 __ SmiTag(RAX); 565 __ SmiTag(RAX);
531 __ ret(); 566 __ ret();
(...skipping 1060 matching lines...) Expand 10 before | Expand all | Expand 10 after
1592 __ LoadObject(RAX, Bool::True()); 1627 __ LoadObject(RAX, Bool::True());
1593 __ ret(); 1628 __ ret();
1594 return true; 1629 return true;
1595 } 1630 }
1596 1631
1597 #undef __ 1632 #undef __
1598 1633
1599 } // namespace dart 1634 } // namespace dart
1600 1635
1601 #endif // defined TARGET_ARCH_X64 1636 #endif // defined TARGET_ARCH_X64
OLDNEW
« runtime/vm/intrinsifier_ia32.cc ('K') | « runtime/vm/intrinsifier_ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698