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

Side by Side Diff: vm/stub_code_ia32.cc

Issue 11613009: Changed the API in DartEntry for invoking dart code from C++ to make it more compatible with the re… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years 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" 5 #include "vm/globals.h"
6 #if defined(TARGET_ARCH_IA32) 6 #if defined(TARGET_ARCH_IA32)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/assembler_macros.h" 9 #include "vm/assembler_macros.h"
10 #include "vm/compiler.h" 10 #include "vm/compiler.h"
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 __ LeaveFrame(); 707 __ LeaveFrame();
708 __ ret(); 708 __ ret();
709 } 709 }
710 710
711 711
712 // Called when invoking dart code from C++ (VM code). 712 // Called when invoking dart code from C++ (VM code).
713 // Input parameters: 713 // Input parameters:
714 // ESP : points to return address. 714 // ESP : points to return address.
715 // ESP + 4 : entrypoint of the dart function to call. 715 // ESP + 4 : entrypoint of the dart function to call.
716 // ESP + 8 : arguments descriptor array. 716 // ESP + 8 : arguments descriptor array.
717 // ESP + 12 : pointer to the argument array. 717 // ESP + 12 : arguments array.
718 // ESP + 16 : new context containing the current isolate pointer. 718 // ESP + 16 : new context containing the current isolate pointer.
719 // Uses EAX, EDX, ECX, EDI as temporary registers. 719 // Uses EAX, EDX, ECX, EDI as temporary registers.
720 void StubCode::GenerateInvokeDartCodeStub(Assembler* assembler) { 720 void StubCode::GenerateInvokeDartCodeStub(Assembler* assembler) {
721 const int kEntryPointOffset = 2 * kWordSize; 721 const int kEntryPointOffset = 2 * kWordSize;
722 const int kArgumentsDescOffset = 3 * kWordSize; 722 const int kArgumentsDescOffset = 3 * kWordSize;
723 const int kArgumentsOffset = 4 * kWordSize; 723 const int kArgumentsOffset = 4 * kWordSize;
724 const int kNewContextOffset = 5 * kWordSize; 724 const int kNewContextOffset = 5 * kWordSize;
725 725
726 // Save frame pointer coming in. 726 // Save frame pointer coming in.
727 __ EnterFrame(0); 727 __ EnterFrame(0);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
767 // Load number of arguments into EBX. 767 // Load number of arguments into EBX.
768 __ movl(EBX, FieldAddress(EDX, ArgumentsDescriptor::count_offset())); 768 __ movl(EBX, FieldAddress(EDX, ArgumentsDescriptor::count_offset()));
769 __ SmiUntag(EBX); 769 __ SmiUntag(EBX);
770 770
771 // Set up arguments for the dart call. 771 // Set up arguments for the dart call.
772 Label push_arguments; 772 Label push_arguments;
773 Label done_push_arguments; 773 Label done_push_arguments;
774 __ testl(EBX, EBX); // check if there are arguments. 774 __ testl(EBX, EBX); // check if there are arguments.
775 __ j(ZERO, &done_push_arguments, Assembler::kNearJump); 775 __ j(ZERO, &done_push_arguments, Assembler::kNearJump);
776 __ movl(EAX, Immediate(0)); 776 __ movl(EAX, Immediate(0));
777 __ movl(EDI, Address(EBP, kArgumentsOffset)); // start of arguments. 777
778 // Compute address of 'arguments array' data area into EDI.
779 __ movl(EDI, Address(EBP, kArgumentsOffset));
780 __ movl(EDI, Address(EDI, VMHandles::kOffsetOfRawPtrInHandle));
781 __ leal(EDI, FieldAddress(EDI, Array::data_offset()));
782
778 __ Bind(&push_arguments); 783 __ Bind(&push_arguments);
779 __ movl(ECX, Address(EDI, EAX, TIMES_4, 0)); 784 __ movl(ECX, Address(EDI, EAX, TIMES_4, 0));
780 __ movl(ECX, Address(ECX, VMHandles::kOffsetOfRawPtrInHandle));
781 __ pushl(ECX); 785 __ pushl(ECX);
782 __ incl(EAX); 786 __ incl(EAX);
783 __ cmpl(EAX, EBX); 787 __ cmpl(EAX, EBX);
784 __ j(LESS, &push_arguments, Assembler::kNearJump); 788 __ j(LESS, &push_arguments, Assembler::kNearJump);
785 __ Bind(&done_push_arguments); 789 __ Bind(&done_push_arguments);
786 790
787 // Call the dart code entrypoint. 791 // Call the dart code entrypoint.
788 __ call(Address(EBP, kEntryPointOffset)); 792 __ call(Address(EBP, kEntryPointOffset));
789 793
790 // Reread the Context pointer. 794 // Reread the Context pointer.
(...skipping 1320 matching lines...) Expand 10 before | Expand all | Expand 10 after
2111 __ Bind(&done); 2115 __ Bind(&done);
2112 __ popl(temp); 2116 __ popl(temp);
2113 __ popl(right); 2117 __ popl(right);
2114 __ popl(left); 2118 __ popl(left);
2115 __ ret(); 2119 __ ret();
2116 } 2120 }
2117 2121
2118 } // namespace dart 2122 } // namespace dart
2119 2123
2120 #endif // defined TARGET_ARCH_IA32 2124 #endif // defined TARGET_ARCH_IA32
OLDNEW
« vm/dart_entry.h ('K') | « vm/resolver_test.cc ('k') | vm/stub_code_ia32_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698