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

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

Issue 11794038: Bug fix and improvements to clamped arrays. (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
« no previous file with comments | « runtime/vm/intrinsifier_ia32.cc ('k') | tests/standalone/byte_array_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
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) { 522 bool Intrinsifier::UintClamped8Array_getIndexed(Assembler* assembler) {
523 return Uint8Array_setIndexed(assembler); 523 Label fall_through;
524 TestByteArrayIndex(assembler, &fall_through);
525 __ SmiUntag(R12);
526 __ movzxb(RAX, FieldAddress(RAX,
527 R12,
528 TIMES_1,
529 Uint8ClampedArray::data_offset()));
530 __ SmiTag(RAX);
531 __ ret();
532 __ Bind(&fall_through);
533 return false;
524 } 534 }
525 535
526 536
527 bool Intrinsifier::Uint8ClampedArray_setIndexed(Assembler* assembler) { 537 bool Intrinsifier::Uint8ClampedArray_setIndexed(Assembler* assembler) {
528 Label fall_through, store_value, load_0xff; 538 Label fall_through, store_value, load_0xff;
529 // Verify that the array index is valid. 539 // Verify that the array index is valid.
530 TestByteArraySetIndex(assembler, &fall_through); 540 TestByteArraySetIndex(assembler, &fall_through);
531 // After TestByteArraySetIndex: 541 // After TestByteArraySetIndex:
532 // * RAX has the base address of the byte array. 542 // * RAX has the base address of the byte array.
533 // * R12 has the index into the array. 543 // * R12 has the index into the array.
534 // R12 contains the SMI index which is shifted by 1. 544 // R12 contains the SMI index which is shifted by 1.
535 __ SmiUntag(R12); 545 __ SmiUntag(R12);
536 __ movq(RDI, Address(RSP, + 1 * kWordSize)); // Value. 546 __ movq(RDI, Address(RSP, + 1 * kWordSize)); // Value.
537 __ testq(RDI, Immediate(kSmiTagMask)); 547 __ testq(RDI, Immediate(kSmiTagMask));
538 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump); 548 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump);
539 549
540 __ SmiUntag(RDI); 550 __ SmiUntag(RDI);
541 __ cmpq(RDI, Immediate(0xFF)); 551 __ cmpq(RDI, Immediate(0xFF));
542 __ j(BELOW_EQUAL, &store_value, Assembler::kNearJump); 552 __ j(BELOW_EQUAL, &store_value, Assembler::kNearJump);
543 __ j(GREATER, &load_0xff, Assembler::kNearJump); 553 __ j(GREATER, &load_0xff, Assembler::kNearJump);
544 __ xorq(RDI, RDI); // Zero. 554 __ xorq(RDI, RDI); // Zero.
545 __ jmp(&store_value, Assembler::kNearJump); 555 __ jmp(&store_value, Assembler::kNearJump);
546 __ Bind(&load_0xff); 556 __ Bind(&load_0xff);
547 __ movq(RDI, Immediate(0xFF)); 557 __ movq(RDI, Immediate(0xFF));
548 558
549 __ Bind(&store_value); 559 __ Bind(&store_value);
550 __ movb(FieldAddress(RAX, R12, TIMES_1, Uint8Array::data_offset()), RDI); 560 __ movb(
561 FieldAddress(RAX, R12, TIMES_1, Uint8ClampedArray::data_offset()), RDI);
551 __ ret(); 562 __ ret();
552 __ Bind(&fall_through); 563 __ Bind(&fall_through);
553 return false; 564 return false;
554 } 565 }
555 566
556 567
557 bool Intrinsifier::Uint8Array_getIndexed(Assembler* assembler) { 568 bool Intrinsifier::Uint8Array_getIndexed(Assembler* assembler) {
558 Label fall_through; 569 Label fall_through;
559 TestByteArrayIndex(assembler, &fall_through); 570 TestByteArrayIndex(assembler, &fall_through);
560 __ SmiUntag(R12); 571 __ SmiUntag(R12);
(...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after
1535 __ LoadObject(RAX, Bool::True()); 1546 __ LoadObject(RAX, Bool::True());
1536 __ ret(); 1547 __ ret();
1537 return true; 1548 return true;
1538 } 1549 }
1539 1550
1540 #undef __ 1551 #undef __
1541 1552
1542 } // namespace dart 1553 } // namespace dart
1543 1554
1544 #endif // defined TARGET_ARCH_X64 1555 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/intrinsifier_ia32.cc ('k') | tests/standalone/byte_array_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698