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

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

Issue 306483005: - Use isolate where it is appropriate. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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) 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/cpu.h" 9 #include "vm/cpu.h"
10 #include "vm/os.h" 10 #include "vm/os.h"
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after
703 return 42; 703 return 42;
704 } 704 }
705 705
706 706
707 static int LeafReturnArgument(int x) { 707 static int LeafReturnArgument(int x) {
708 return x + 87; 708 return x + 87;
709 } 709 }
710 710
711 711
712 ASSEMBLER_TEST_GENERATE(CallSimpleLeaf, assembler) { 712 ASSEMBLER_TEST_GENERATE(CallSimpleLeaf, assembler) {
713 ExternalLabel call1("LeafReturn42", reinterpret_cast<uword>(LeafReturn42)); 713 ExternalLabel call1(reinterpret_cast<uword>(LeafReturn42));
714 ExternalLabel call2("LeafReturnArgument", 714 ExternalLabel call2(reinterpret_cast<uword>(LeafReturnArgument));
715 reinterpret_cast<uword>(LeafReturnArgument));
716 int space = ComputeStackSpaceReservation(0, 4); 715 int space = ComputeStackSpaceReservation(0, 4);
717 __ AddImmediate(ESP, Immediate(-space)); 716 __ AddImmediate(ESP, Immediate(-space));
718 __ call(&call1); 717 __ call(&call1);
719 __ AddImmediate(ESP, Immediate(space)); 718 __ AddImmediate(ESP, Immediate(space));
720 space = ComputeStackSpaceReservation(4, 4); 719 space = ComputeStackSpaceReservation(4, 4);
721 __ AddImmediate(ESP, Immediate(-space)); 720 __ AddImmediate(ESP, Immediate(-space));
722 __ movl(Address(ESP, 0), EAX); 721 __ movl(Address(ESP, 0), EAX);
723 __ call(&call2); 722 __ call(&call2);
724 __ AddImmediate(ESP, Immediate(space)); 723 __ AddImmediate(ESP, Immediate(space));
725 __ ret(); 724 __ ret();
726 } 725 }
727 726
728 727
729 ASSEMBLER_TEST_RUN(CallSimpleLeaf, test) { 728 ASSEMBLER_TEST_RUN(CallSimpleLeaf, test) {
730 typedef int (*CallSimpleLeafCode)(); 729 typedef int (*CallSimpleLeafCode)();
731 EXPECT_EQ(42 + 87, reinterpret_cast<CallSimpleLeafCode>(test->entry())()); 730 EXPECT_EQ(42 + 87, reinterpret_cast<CallSimpleLeafCode>(test->entry())());
732 } 731 }
733 732
734 733
735 ASSEMBLER_TEST_GENERATE(JumpSimpleLeaf, assembler) { 734 ASSEMBLER_TEST_GENERATE(JumpSimpleLeaf, assembler) {
736 ExternalLabel call1("LeafReturn42", reinterpret_cast<uword>(LeafReturn42)); 735 ExternalLabel call1(reinterpret_cast<uword>(LeafReturn42));
737 Label L; 736 Label L;
738 int space = ComputeStackSpaceReservation(0, 4); 737 int space = ComputeStackSpaceReservation(0, 4);
739 __ AddImmediate(ESP, Immediate(-space)); 738 __ AddImmediate(ESP, Immediate(-space));
740 __ call(&L); 739 __ call(&L);
741 __ AddImmediate(ESP, Immediate(space)); 740 __ AddImmediate(ESP, Immediate(space));
742 __ ret(); 741 __ ret();
743 __ Bind(&L); 742 __ Bind(&L);
744 __ jmp(&call1); 743 __ jmp(&call1);
745 } 744 }
746 745
747 746
748 ASSEMBLER_TEST_RUN(JumpSimpleLeaf, test) { 747 ASSEMBLER_TEST_RUN(JumpSimpleLeaf, test) {
749 typedef int (*JumpSimpleLeafCode)(); 748 typedef int (*JumpSimpleLeafCode)();
750 EXPECT_EQ(42, reinterpret_cast<JumpSimpleLeafCode>(test->entry())()); 749 EXPECT_EQ(42, reinterpret_cast<JumpSimpleLeafCode>(test->entry())());
751 } 750 }
752 751
753 752
754 ASSEMBLER_TEST_GENERATE(JumpConditionalSimpleLeaf, assembler) { 753 ASSEMBLER_TEST_GENERATE(JumpConditionalSimpleLeaf, assembler) {
755 ExternalLabel call1("LeafReturn42", reinterpret_cast<uword>(LeafReturn42)); 754 ExternalLabel call1(reinterpret_cast<uword>(LeafReturn42));
756 Label L; 755 Label L;
757 int space = ComputeStackSpaceReservation(0, 4); 756 int space = ComputeStackSpaceReservation(0, 4);
758 __ AddImmediate(ESP, Immediate(-space)); 757 __ AddImmediate(ESP, Immediate(-space));
759 __ call(&L); 758 __ call(&L);
760 __ AddImmediate(ESP, Immediate(space)); 759 __ AddImmediate(ESP, Immediate(space));
761 __ ret(); 760 __ ret();
762 __ Bind(&L); 761 __ Bind(&L);
763 __ cmpl(EAX, EAX); 762 __ cmpl(EAX, EAX);
764 __ j(EQUAL, &call1); 763 __ j(EQUAL, &call1);
765 __ int3(); 764 __ int3();
(...skipping 2455 matching lines...) Expand 10 before | Expand all | Expand 10 after
3221 FieldAddress(ECX, GrowableObjectArray::data_offset()), 3220 FieldAddress(ECX, GrowableObjectArray::data_offset()),
3222 EAX); 3221 EAX);
3223 __ popl(EAX); 3222 __ popl(EAX);
3224 __ popl(CTX); 3223 __ popl(CTX);
3225 __ ret(); 3224 __ ret();
3226 } 3225 }
3227 3226
3228 } // namespace dart 3227 } // namespace dart
3229 3228
3230 #endif // defined TARGET_ARCH_IA32 3229 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/assembler.h ('k') | runtime/vm/assembler_x64_test.cc » ('j') | runtime/vm/parser.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698