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

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

Issue 11415116: Port intrisification of setIndexed on Uint8 and Int8 arrays from ia32 to x64. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 8 years, 1 month 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 | « no previous file | runtime/vm/intrinsifier_x64.cc » ('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 // The intrinsic code below is executed before a method has built its frame. 5 // The intrinsic code below is executed before a method has built its frame.
6 // The return address is on the stack and the arguments below it. 6 // The return address is on the stack and the arguments below it.
7 // Registers EDX (arguments descriptor) and ECX (function) must be preserved. 7 // Registers EDX (arguments descriptor) and ECX (function) must be preserved.
8 // Each intrinsification method returns true if the corresponding 8 // Each intrinsification method returns true if the corresponding
9 // Dart method was intrinsified. 9 // Dart method was intrinsified.
10 10
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 531
532 bool Intrinsifier::Int8Array_setIndexed(Assembler* assembler) { 532 bool Intrinsifier::Int8Array_setIndexed(Assembler* assembler) {
533 Label fall_through; 533 Label fall_through;
534 // Verify that the array index is valid. 534 // Verify that the array index is valid.
535 TestByteArraySetIndex(assembler, &fall_through); 535 TestByteArraySetIndex(assembler, &fall_through);
536 // After TestByteArraySetIndex: 536 // After TestByteArraySetIndex:
537 // * EAX has the base address of the byte array. 537 // * EAX has the base address of the byte array.
538 // * EBX has the index into the array. 538 // * EBX has the index into the array.
539 // EBX contains the SMI index which is shifted by 1. 539 // EBX contains the SMI index which is shifted by 1.
540 __ SmiUntag(EBX); 540 __ SmiUntag(EBX);
541 // Move EBX into EDI. 541 // Free EBX for the value since we want a byte register.
542 __ movl(EDI, EBX); 542 __ movl(EDI, EBX);
543 // Load the value into EBX.
544 __ movl(EBX, Address(ESP, + 1 * kWordSize)); // Value. 543 __ movl(EBX, Address(ESP, + 1 * kWordSize)); // Value.
545 // If EBX is not an Smi, jump to fall through.
546 __ testl(EBX, Immediate(kSmiTagMask)); 544 __ testl(EBX, Immediate(kSmiTagMask));
547 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump); 545 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump);
548 __ SmiUntag(EBX); 546 __ SmiUntag(EBX);
549 // Add 128 to EBX to bring it into 0..FF. 547 // Check that the value is a byte. Add 128 to EBX to bring it into
548 // the range 0..FF.
550 __ addl(EBX, Immediate(128)); 549 __ addl(EBX, Immediate(128));
551 __ cmpl(EBX, Immediate(0xFF)); 550 __ cmpl(EBX, Immediate(0xFF));
552 // If EBX is too large an Int8, jump to fall through.
553 __ j(ABOVE, &fall_through, Assembler::kNearJump); 551 __ j(ABOVE, &fall_through, Assembler::kNearJump);
554 // Remove addition. 552 // Undo addition.
555 __ subl(EBX, Immediate(128)); 553 __ subl(EBX, Immediate(128));
556 // Store BL into array EAX[EDI] = BL.
557 __ movb(FieldAddress(EAX, EDI, TIMES_1, Int8Array::data_offset()), BL); 554 __ movb(FieldAddress(EAX, EDI, TIMES_1, Int8Array::data_offset()), BL);
558 __ ret(); 555 __ ret();
559 __ Bind(&fall_through); 556 __ Bind(&fall_through);
560 return false; 557 return false;
561 } 558 }
562 559
563 560
564 bool Intrinsifier::Uint8Array_getIndexed(Assembler* assembler) { 561 bool Intrinsifier::Uint8Array_getIndexed(Assembler* assembler) {
565 Label fall_through; 562 Label fall_through;
566 TestByteArrayIndex(assembler, &fall_through); 563 TestByteArrayIndex(assembler, &fall_through);
(...skipping 11 matching lines...) Expand all
578 575
579 bool Intrinsifier::Uint8Array_setIndexed(Assembler* assembler) { 576 bool Intrinsifier::Uint8Array_setIndexed(Assembler* assembler) {
580 Label fall_through; 577 Label fall_through;
581 // Verify that the array index is valid. 578 // Verify that the array index is valid.
582 TestByteArraySetIndex(assembler, &fall_through); 579 TestByteArraySetIndex(assembler, &fall_through);
583 // After TestByteArraySetIndex: 580 // After TestByteArraySetIndex:
584 // * EAX has the base address of the byte array. 581 // * EAX has the base address of the byte array.
585 // * EBX has the index into the array. 582 // * EBX has the index into the array.
586 // EBX contains the SMI index which is shifted by 1. 583 // EBX contains the SMI index which is shifted by 1.
587 __ SmiUntag(EBX); 584 __ SmiUntag(EBX);
588 // Move EBX into EDI. 585 // Free EBX for the value since we want a byte register.
589 __ movl(EDI, EBX); 586 __ movl(EDI, EBX);
590 // Load the value into EBX.
591 __ movl(EBX, Address(ESP, + 1 * kWordSize)); // Value. 587 __ movl(EBX, Address(ESP, + 1 * kWordSize)); // Value.
592 // If EBX is not an Smi, jump to fall through.
593 __ testl(EBX, Immediate(kSmiTagMask)); 588 __ testl(EBX, Immediate(kSmiTagMask));
594 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump); 589 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump);
595 __ SmiUntag(EBX); 590 __ SmiUntag(EBX);
596 // If EBX is too large an Uint8, jump to fall through. 591 // Check that the value is a byte.
597 __ cmpl(EBX, Immediate(0xFF)); 592 __ cmpl(EBX, Immediate(0xFF));
598 __ j(ABOVE, &fall_through, Assembler::kNearJump); 593 __ j(ABOVE, &fall_through, Assembler::kNearJump);
599 // Store BL into array EAX[EDI] = BL.
600 __ movb(FieldAddress(EAX, EDI, TIMES_1, Uint8Array::data_offset()), BL); 594 __ movb(FieldAddress(EAX, EDI, TIMES_1, Uint8Array::data_offset()), BL);
601 __ ret(); 595 __ ret();
602 __ Bind(&fall_through); 596 __ Bind(&fall_through);
603 return false; 597 return false;
604 } 598 }
605 599
606 600
607 bool Intrinsifier::Int16Array_getIndexed(Assembler* assembler) { 601 bool Intrinsifier::Int16Array_getIndexed(Assembler* assembler) {
608 Label fall_through; 602 Label fall_through;
609 TestByteArrayIndex(assembler, &fall_through); 603 TestByteArrayIndex(assembler, &fall_through);
(...skipping 1129 matching lines...) Expand 10 before | Expand all | Expand 10 after
1739 __ Bind(&is_true); 1733 __ Bind(&is_true);
1740 __ LoadObject(EAX, bool_true); 1734 __ LoadObject(EAX, bool_true);
1741 __ ret(); 1735 __ ret();
1742 return true; 1736 return true;
1743 } 1737 }
1744 1738
1745 #undef __ 1739 #undef __
1746 } // namespace dart 1740 } // namespace dart
1747 1741
1748 #endif // defined TARGET_ARCH_IA32 1742 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/intrinsifier_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698