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

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

Issue 2980033002: Moves the top_ and end_ words of the Scavenger into mutator thread. (Closed)
Patch Set: Created 3 years, 5 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
« no previous file with comments | « runtime/vm/stub_code_ia32.cc ('k') | runtime/vm/thread.h » ('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) 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 #include "vm/globals.h" 5 #include "vm/globals.h"
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/compiler.h" 9 #include "vm/compiler.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 __ MaybeTraceAllocation(kArrayCid, &slow_case, Assembler::kFarJump)); 639 __ MaybeTraceAllocation(kArrayCid, &slow_case, Assembler::kFarJump));
640 640
641 const intptr_t fixed_size_plus_alignment_padding = 641 const intptr_t fixed_size_plus_alignment_padding =
642 sizeof(RawArray) + kObjectAlignment - 1; 642 sizeof(RawArray) + kObjectAlignment - 1;
643 // RDI is a Smi. 643 // RDI is a Smi.
644 __ leaq(RDI, Address(RDI, TIMES_4, fixed_size_plus_alignment_padding)); 644 __ leaq(RDI, Address(RDI, TIMES_4, fixed_size_plus_alignment_padding));
645 ASSERT(kSmiTagShift == 1); 645 ASSERT(kSmiTagShift == 1);
646 __ andq(RDI, Immediate(-kObjectAlignment)); 646 __ andq(RDI, Immediate(-kObjectAlignment));
647 647
648 const intptr_t cid = kArrayCid; 648 const intptr_t cid = kArrayCid;
649 Heap::Space space = Heap::kNew; 649 NOT_IN_PRODUCT(Heap::Space space = Heap::kNew);
650 __ movq(R13, Address(THR, Thread::heap_offset())); 650 __ movq(RAX, Address(THR, Thread::top_offset()));
651 __ movq(RAX, Address(R13, Heap::TopOffset(space)));
652 651
653 // RDI: allocation size. 652 // RDI: allocation size.
654 __ movq(RCX, RAX); 653 __ movq(RCX, RAX);
655 __ addq(RCX, RDI); 654 __ addq(RCX, RDI);
656 __ j(CARRY, &slow_case); 655 __ j(CARRY, &slow_case);
657 656
658 // Check if the allocation fits into the remaining space. 657 // Check if the allocation fits into the remaining space.
659 // RAX: potential new object start. 658 // RAX: potential new object start.
660 // RCX: potential next object start. 659 // RCX: potential next object start.
661 // RDI: allocation size. 660 // RDI: allocation size.
662 // R13: heap. 661 __ cmpq(RCX, Address(THR, Thread::end_offset()));
663 __ cmpq(RCX, Address(R13, Heap::EndOffset(space)));
664 __ j(ABOVE_EQUAL, &slow_case); 662 __ j(ABOVE_EQUAL, &slow_case);
665 663
666 // Successfully allocated the object(s), now update top to point to 664 // Successfully allocated the object(s), now update top to point to
667 // next object start and initialize the object. 665 // next object start and initialize the object.
668 __ movq(Address(R13, Heap::TopOffset(space)), RCX); 666 __ movq(Address(THR, Thread::top_offset()), RCX);
669 __ addq(RAX, Immediate(kHeapObjectTag)); 667 __ addq(RAX, Immediate(kHeapObjectTag));
670 NOT_IN_PRODUCT(__ UpdateAllocationStatsWithSize(cid, RDI, space)); 668 NOT_IN_PRODUCT(__ UpdateAllocationStatsWithSize(cid, RDI, space));
671 // Initialize the tags. 669 // Initialize the tags.
672 // RAX: new object start as a tagged pointer. 670 // RAX: new object start as a tagged pointer.
673 // RDI: allocation size. 671 // RDI: allocation size.
674 { 672 {
675 Label size_tag_overflow, done; 673 Label size_tag_overflow, done;
676 __ cmpq(RDI, Immediate(RawObject::SizeTag::kMaxSizeTag)); 674 __ cmpq(RDI, Immediate(RawObject::SizeTag::kMaxSizeTag));
677 __ j(ABOVE, &size_tag_overflow, Assembler::kNearJump); 675 __ j(ABOVE, &size_tag_overflow, Assembler::kNearJump);
678 __ shlq(RDI, Immediate(RawObject::kSizeTagPos - kObjectAlignmentLog2)); 676 __ shlq(RDI, Immediate(RawObject::kSizeTagPos - kObjectAlignmentLog2));
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 __ leaq(R13, Address(R10, TIMES_8, fixed_size_plus_alignment_padding)); 884 __ leaq(R13, Address(R10, TIMES_8, fixed_size_plus_alignment_padding));
887 __ andq(R13, Immediate(-kObjectAlignment)); 885 __ andq(R13, Immediate(-kObjectAlignment));
888 886
889 // Check for allocation tracing. 887 // Check for allocation tracing.
890 NOT_IN_PRODUCT( 888 NOT_IN_PRODUCT(
891 __ MaybeTraceAllocation(kContextCid, &slow_case, Assembler::kFarJump)); 889 __ MaybeTraceAllocation(kContextCid, &slow_case, Assembler::kFarJump));
892 890
893 // Now allocate the object. 891 // Now allocate the object.
894 // R10: number of context variables. 892 // R10: number of context variables.
895 const intptr_t cid = kContextCid; 893 const intptr_t cid = kContextCid;
896 Heap::Space space = Heap::kNew; 894 NOT_IN_PRODUCT(Heap::Space space = Heap::kNew);
897 __ movq(RCX, Address(THR, Thread::heap_offset())); 895 __ movq(RAX, Address(THR, Thread::top_offset()));
898 __ movq(RAX, Address(RCX, Heap::TopOffset(space)));
899 __ addq(R13, RAX); 896 __ addq(R13, RAX);
900 // Check if the allocation fits into the remaining space. 897 // Check if the allocation fits into the remaining space.
901 // RAX: potential new object. 898 // RAX: potential new object.
902 // R13: potential next object start. 899 // R13: potential next object start.
903 // R10: number of context variables. 900 // R10: number of context variables.
904 // RCX: heap. 901 __ cmpq(R13, Address(THR, Thread::end_offset()));
905 __ cmpq(R13, Address(RCX, Heap::EndOffset(space)));
906 if (FLAG_use_slow_path) { 902 if (FLAG_use_slow_path) {
907 __ jmp(&slow_case); 903 __ jmp(&slow_case);
908 } else { 904 } else {
909 __ j(ABOVE_EQUAL, &slow_case); 905 __ j(ABOVE_EQUAL, &slow_case);
910 } 906 }
911 907
912 // Successfully allocated the object, now update top to point to 908 // Successfully allocated the object, now update top to point to
913 // next object start and initialize the object. 909 // next object start and initialize the object.
914 // RAX: new object. 910 // RAX: new object.
915 // R13: next object start. 911 // R13: next object start.
916 // R10: number of context variables. 912 // R10: number of context variables.
917 // RCX: heap. 913 __ movq(Address(THR, Thread::top_offset()), R13);
918 __ movq(Address(RCX, Heap::TopOffset(space)), R13);
919 // R13: Size of allocation in bytes. 914 // R13: Size of allocation in bytes.
920 __ subq(R13, RAX); 915 __ subq(R13, RAX);
921 __ addq(RAX, Immediate(kHeapObjectTag)); 916 __ addq(RAX, Immediate(kHeapObjectTag));
922 // Generate isolate-independent code to allow sharing between isolates. 917 // Generate isolate-independent code to allow sharing between isolates.
923 NOT_IN_PRODUCT(__ UpdateAllocationStatsWithSize(cid, R13, space)); 918 NOT_IN_PRODUCT(__ UpdateAllocationStatsWithSize(cid, R13, space));
924 919
925 // Calculate the size tag. 920 // Calculate the size tag.
926 // RAX: new object. 921 // RAX: new object.
927 // R10: number of context variables. 922 // R10: number of context variables.
928 { 923 {
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
1085 __ movq(RDX, Address(RSP, kObjectTypeArgumentsOffset)); 1080 __ movq(RDX, Address(RSP, kObjectTypeArgumentsOffset));
1086 // RDX: instantiated type arguments. 1081 // RDX: instantiated type arguments.
1087 } 1082 }
1088 Isolate* isolate = Isolate::Current(); 1083 Isolate* isolate = Isolate::Current();
1089 if (FLAG_inline_alloc && Heap::IsAllocatableInNewSpace(instance_size) && 1084 if (FLAG_inline_alloc && Heap::IsAllocatableInNewSpace(instance_size) &&
1090 !cls.TraceAllocation(isolate)) { 1085 !cls.TraceAllocation(isolate)) {
1091 Label slow_case; 1086 Label slow_case;
1092 // Allocate the object and update top to point to 1087 // Allocate the object and update top to point to
1093 // next object start and initialize the allocated object. 1088 // next object start and initialize the allocated object.
1094 // RDX: instantiated type arguments (if is_cls_parameterized). 1089 // RDX: instantiated type arguments (if is_cls_parameterized).
1095 Heap::Space space = Heap::kNew; 1090 NOT_IN_PRODUCT(Heap::Space space = Heap::kNew);
1096 __ movq(RCX, Address(THR, Thread::heap_offset())); 1091 __ movq(RAX, Address(THR, Thread::top_offset()));
1097 __ movq(RAX, Address(RCX, Heap::TopOffset(space)));
1098 __ leaq(RBX, Address(RAX, instance_size)); 1092 __ leaq(RBX, Address(RAX, instance_size));
1099 // Check if the allocation fits into the remaining space. 1093 // Check if the allocation fits into the remaining space.
1100 // RAX: potential new object start. 1094 // RAX: potential new object start.
1101 // RBX: potential next object start. 1095 // RBX: potential next object start.
1102 // RCX: heap. 1096 __ cmpq(RBX, Address(THR, Thread::end_offset()));
1103 __ cmpq(RBX, Address(RCX, Heap::EndOffset(space)));
1104 if (FLAG_use_slow_path) { 1097 if (FLAG_use_slow_path) {
1105 __ jmp(&slow_case); 1098 __ jmp(&slow_case);
1106 } else { 1099 } else {
1107 __ j(ABOVE_EQUAL, &slow_case); 1100 __ j(ABOVE_EQUAL, &slow_case);
1108 } 1101 }
1109 __ movq(Address(RCX, Heap::TopOffset(space)), RBX); 1102 __ movq(Address(THR, Thread::top_offset()), RBX);
1110 NOT_IN_PRODUCT(__ UpdateAllocationStats(cls.id(), space)); 1103 NOT_IN_PRODUCT(__ UpdateAllocationStats(cls.id(), space));
1111 1104
1112 // RAX: new object start (untagged). 1105 // RAX: new object start (untagged).
1113 // RBX: next object start. 1106 // RBX: next object start.
1114 // RDX: new object type arguments (if is_cls_parameterized). 1107 // RDX: new object type arguments (if is_cls_parameterized).
1115 // Set the tags. 1108 // Set the tags.
1116 uint32_t tags = 0; 1109 uint32_t tags = 0;
1117 tags = RawObject::SizeTag::update(instance_size, tags); 1110 tags = RawObject::SizeTag::update(instance_size, tags);
1118 ASSERT(cls.id() != kIllegalCid); 1111 ASSERT(cls.id() != kIllegalCid);
1119 tags = RawObject::ClassIdTag::update(cls.id(), tags); 1112 tags = RawObject::ClassIdTag::update(cls.id(), tags);
(...skipping 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after
2263 __ int3(); 2256 __ int3();
2264 } 2257 }
2265 2258
2266 void StubCode::GenerateAsynchronousGapMarkerStub(Assembler* assembler) { 2259 void StubCode::GenerateAsynchronousGapMarkerStub(Assembler* assembler) {
2267 __ int3(); 2260 __ int3();
2268 } 2261 }
2269 2262
2270 } // namespace dart 2263 } // namespace dart
2271 2264
2272 #endif // defined TARGET_ARCH_X64 2265 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/stub_code_ia32.cc ('k') | runtime/vm/thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698