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

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

Issue 15822008: Implements intrinsics for ARM. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 6 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 659 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 670
671 // Optimizations: 671 // Optimizations:
672 // - result is 0 if: 672 // - result is 0 if:
673 // - left is 0 673 // - left is 0
674 // - left equals right 674 // - left equals right
675 // - result is left if 675 // - result is left if
676 // - left > 0 && left < right 676 // - left > 0 && left < right
677 // EAX: Tagged left (dividend). 677 // EAX: Tagged left (dividend).
678 // EBX: Tagged right (divisor). 678 // EBX: Tagged right (divisor).
679 // EDX: Untagged result (remainder). 679 // EDX: Untagged result (remainder).
680 void EmitRemainderOperation(Assembler* assembler) { 680 static void EmitRemainderOperation(Assembler* assembler) {
681 Label return_zero, modulo; 681 Label return_zero, modulo;
682 // Check for quick zero results. 682 // Check for quick zero results.
683 __ cmpl(EAX, Immediate(0)); 683 __ cmpl(EAX, Immediate(0));
684 __ j(EQUAL, &return_zero, Assembler::kNearJump); 684 __ j(EQUAL, &return_zero, Assembler::kNearJump);
685 __ cmpl(EAX, EBX); 685 __ cmpl(EAX, EBX);
686 __ j(EQUAL, &return_zero, Assembler::kNearJump); 686 __ j(EQUAL, &return_zero, Assembler::kNearJump);
687 687
688 // Check if result equals left. 688 // Check if result equals left.
689 __ cmpl(EAX, Immediate(0)); 689 __ cmpl(EAX, Immediate(0));
690 __ j(LESS, &modulo, Assembler::kNearJump); 690 __ j(LESS, &modulo, Assembler::kNearJump);
(...skipping 934 matching lines...) Expand 10 before | Expand all | Expand 10 after
1625 Label* ok, 1625 Label* ok,
1626 Label* failure, 1626 Label* failure,
1627 Register length_reg) { 1627 Register length_reg) {
1628 if (length_reg != EDI) { 1628 if (length_reg != EDI) {
1629 __ movl(EDI, length_reg); 1629 __ movl(EDI, length_reg);
1630 } 1630 }
1631 Label pop_and_fail; 1631 Label pop_and_fail;
1632 __ pushl(EDI); // Preserve length. 1632 __ pushl(EDI); // Preserve length.
1633 __ SmiUntag(EDI); 1633 __ SmiUntag(EDI);
1634 const intptr_t fixed_size = sizeof(RawString) + kObjectAlignment - 1; 1634 const intptr_t fixed_size = sizeof(RawString) + kObjectAlignment - 1;
1635 __ leal(EDI, Address(EDI, TIMES_1, fixed_size)); // EDI is a Smi. 1635 __ leal(EDI, Address(EDI, TIMES_1, fixed_size)); // EDI is untagged.
1636 __ andl(EDI, Immediate(-kObjectAlignment)); 1636 __ andl(EDI, Immediate(-kObjectAlignment));
1637 1637
1638 Isolate* isolate = Isolate::Current(); 1638 Isolate* isolate = Isolate::Current();
1639 Heap* heap = isolate->heap(); 1639 Heap* heap = isolate->heap();
1640 1640
1641 __ movl(EAX, Address::Absolute(heap->TopAddress())); 1641 __ movl(EAX, Address::Absolute(heap->TopAddress()));
1642 __ movl(EBX, EAX); 1642 __ movl(EBX, EAX);
1643 1643
1644 // EDI: allocation size. 1644 // EDI: allocation size.
1645 __ addl(EBX, EDI); 1645 __ addl(EBX, EDI);
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
1761 __ ret(); 1761 __ ret();
1762 1762
1763 __ Bind(&fall_through); 1763 __ Bind(&fall_through);
1764 return false; 1764 return false;
1765 } 1765 }
1766 1766
1767 #undef __ 1767 #undef __
1768 } // namespace dart 1768 } // namespace dart
1769 1769
1770 #endif // defined TARGET_ARCH_IA32 1770 #endif // defined TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698