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

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

Issue 2974403002: Revert "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 645 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 __ MaybeTraceAllocation(kArrayCid, &slow_case, Assembler::kFarJump)); 656 __ MaybeTraceAllocation(kArrayCid, &slow_case, Assembler::kFarJump));
657 657
658 const intptr_t fixed_size_plus_alignment_padding = 658 const intptr_t fixed_size_plus_alignment_padding =
659 sizeof(RawArray) + kObjectAlignment - 1; 659 sizeof(RawArray) + kObjectAlignment - 1;
660 // RDI is a Smi. 660 // RDI is a Smi.
661 __ leaq(RDI, Address(RDI, TIMES_4, fixed_size_plus_alignment_padding)); 661 __ leaq(RDI, Address(RDI, TIMES_4, fixed_size_plus_alignment_padding));
662 ASSERT(kSmiTagShift == 1); 662 ASSERT(kSmiTagShift == 1);
663 __ andq(RDI, Immediate(-kObjectAlignment)); 663 __ andq(RDI, Immediate(-kObjectAlignment));
664 664
665 const intptr_t cid = kArrayCid; 665 const intptr_t cid = kArrayCid;
666 NOT_IN_PRODUCT(Heap::Space space = Heap::kNew); 666 Heap::Space space = Heap::kNew;
667 __ movq(RAX, Address(THR, Thread::top_offset())); 667 __ movq(R13, Address(THR, Thread::heap_offset()));
668 __ movq(RAX, Address(R13, Heap::TopOffset(space)));
668 669
669 // RDI: allocation size. 670 // RDI: allocation size.
670 __ movq(RCX, RAX); 671 __ movq(RCX, RAX);
671 __ addq(RCX, RDI); 672 __ addq(RCX, RDI);
672 __ j(CARRY, &slow_case); 673 __ j(CARRY, &slow_case);
673 674
674 // Check if the allocation fits into the remaining space. 675 // Check if the allocation fits into the remaining space.
675 // RAX: potential new object start. 676 // RAX: potential new object start.
676 // RCX: potential next object start. 677 // RCX: potential next object start.
677 // RDI: allocation size. 678 // RDI: allocation size.
678 __ cmpq(RCX, Address(THR, Thread::end_offset())); 679 // R13: heap.
680 __ cmpq(RCX, Address(R13, Heap::EndOffset(space)));
679 __ j(ABOVE_EQUAL, &slow_case); 681 __ j(ABOVE_EQUAL, &slow_case);
680 682
681 // Successfully allocated the object(s), now update top to point to 683 // Successfully allocated the object(s), now update top to point to
682 // next object start and initialize the object. 684 // next object start and initialize the object.
683 __ movq(Address(THR, Thread::top_offset()), RCX); 685 __ movq(Address(R13, Heap::TopOffset(space)), RCX);
684 __ addq(RAX, Immediate(kHeapObjectTag)); 686 __ addq(RAX, Immediate(kHeapObjectTag));
685 NOT_IN_PRODUCT(__ UpdateAllocationStatsWithSize(cid, RDI, space)); 687 NOT_IN_PRODUCT(__ UpdateAllocationStatsWithSize(cid, RDI, space));
686 // Initialize the tags. 688 // Initialize the tags.
687 // RAX: new object start as a tagged pointer. 689 // RAX: new object start as a tagged pointer.
688 // RDI: allocation size. 690 // RDI: allocation size.
689 { 691 {
690 Label size_tag_overflow, done; 692 Label size_tag_overflow, done;
691 __ cmpq(RDI, Immediate(RawObject::SizeTag::kMaxSizeTag)); 693 __ cmpq(RDI, Immediate(RawObject::SizeTag::kMaxSizeTag));
692 __ j(ABOVE, &size_tag_overflow, Assembler::kNearJump); 694 __ j(ABOVE, &size_tag_overflow, Assembler::kNearJump);
693 __ shlq(RDI, Immediate(RawObject::kSizeTagPos - kObjectAlignmentLog2)); 695 __ shlq(RDI, Immediate(RawObject::kSizeTagPos - kObjectAlignmentLog2));
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
903 __ leaq(R13, Address(R10, TIMES_8, fixed_size_plus_alignment_padding)); 905 __ leaq(R13, Address(R10, TIMES_8, fixed_size_plus_alignment_padding));
904 __ andq(R13, Immediate(-kObjectAlignment)); 906 __ andq(R13, Immediate(-kObjectAlignment));
905 907
906 // Check for allocation tracing. 908 // Check for allocation tracing.
907 NOT_IN_PRODUCT( 909 NOT_IN_PRODUCT(
908 __ MaybeTraceAllocation(kContextCid, &slow_case, Assembler::kFarJump)); 910 __ MaybeTraceAllocation(kContextCid, &slow_case, Assembler::kFarJump));
909 911
910 // Now allocate the object. 912 // Now allocate the object.
911 // R10: number of context variables. 913 // R10: number of context variables.
912 const intptr_t cid = kContextCid; 914 const intptr_t cid = kContextCid;
913 NOT_IN_PRODUCT(Heap::Space space = Heap::kNew); 915 Heap::Space space = Heap::kNew;
914 __ movq(RAX, Address(THR, Thread::top_offset())); 916 __ movq(RCX, Address(THR, Thread::heap_offset()));
917 __ movq(RAX, Address(RCX, Heap::TopOffset(space)));
915 __ addq(R13, RAX); 918 __ addq(R13, RAX);
916 // Check if the allocation fits into the remaining space. 919 // Check if the allocation fits into the remaining space.
917 // RAX: potential new object. 920 // RAX: potential new object.
918 // R13: potential next object start. 921 // R13: potential next object start.
919 // R10: number of context variables. 922 // R10: number of context variables.
920 __ cmpq(R13, Address(THR, Thread::end_offset())); 923 // RCX: heap.
924 __ cmpq(R13, Address(RCX, Heap::EndOffset(space)));
921 if (FLAG_use_slow_path) { 925 if (FLAG_use_slow_path) {
922 __ jmp(&slow_case); 926 __ jmp(&slow_case);
923 } else { 927 } else {
924 __ j(ABOVE_EQUAL, &slow_case); 928 __ j(ABOVE_EQUAL, &slow_case);
925 } 929 }
926 930
927 // Successfully allocated the object, now update top to point to 931 // Successfully allocated the object, now update top to point to
928 // next object start and initialize the object. 932 // next object start and initialize the object.
929 // RAX: new object. 933 // RAX: new object.
930 // R13: next object start. 934 // R13: next object start.
931 // R10: number of context variables. 935 // R10: number of context variables.
932 __ movq(Address(THR, Thread::top_offset()), R13); 936 // RCX: heap.
937 __ movq(Address(RCX, Heap::TopOffset(space)), R13);
933 // R13: Size of allocation in bytes. 938 // R13: Size of allocation in bytes.
934 __ subq(R13, RAX); 939 __ subq(R13, RAX);
935 __ addq(RAX, Immediate(kHeapObjectTag)); 940 __ addq(RAX, Immediate(kHeapObjectTag));
936 // Generate isolate-independent code to allow sharing between isolates. 941 // Generate isolate-independent code to allow sharing between isolates.
937 NOT_IN_PRODUCT(__ UpdateAllocationStatsWithSize(cid, R13, space)); 942 NOT_IN_PRODUCT(__ UpdateAllocationStatsWithSize(cid, R13, space));
938 943
939 // Calculate the size tag. 944 // Calculate the size tag.
940 // RAX: new object. 945 // RAX: new object.
941 // R10: number of context variables. 946 // R10: number of context variables.
942 { 947 {
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
1101 __ movq(RDX, Address(RSP, kObjectTypeArgumentsOffset)); 1106 __ movq(RDX, Address(RSP, kObjectTypeArgumentsOffset));
1102 // RDX: instantiated type arguments. 1107 // RDX: instantiated type arguments.
1103 } 1108 }
1104 Isolate* isolate = Isolate::Current(); 1109 Isolate* isolate = Isolate::Current();
1105 if (FLAG_inline_alloc && Heap::IsAllocatableInNewSpace(instance_size) && 1110 if (FLAG_inline_alloc && Heap::IsAllocatableInNewSpace(instance_size) &&
1106 !cls.TraceAllocation(isolate)) { 1111 !cls.TraceAllocation(isolate)) {
1107 Label slow_case; 1112 Label slow_case;
1108 // Allocate the object and update top to point to 1113 // Allocate the object and update top to point to
1109 // next object start and initialize the allocated object. 1114 // next object start and initialize the allocated object.
1110 // RDX: instantiated type arguments (if is_cls_parameterized). 1115 // RDX: instantiated type arguments (if is_cls_parameterized).
1111 NOT_IN_PRODUCT(Heap::Space space = Heap::kNew); 1116 Heap::Space space = Heap::kNew;
1112 __ movq(RAX, Address(THR, Thread::top_offset())); 1117 __ movq(RCX, Address(THR, Thread::heap_offset()));
1118 __ movq(RAX, Address(RCX, Heap::TopOffset(space)));
1113 __ leaq(RBX, Address(RAX, instance_size)); 1119 __ leaq(RBX, Address(RAX, instance_size));
1114 // Check if the allocation fits into the remaining space. 1120 // Check if the allocation fits into the remaining space.
1115 // RAX: potential new object start. 1121 // RAX: potential new object start.
1116 // RBX: potential next object start. 1122 // RBX: potential next object start.
1117 __ cmpq(RBX, Address(THR, Thread::end_offset())); 1123 // RCX: heap.
1124 __ cmpq(RBX, Address(RCX, Heap::EndOffset(space)));
1118 if (FLAG_use_slow_path) { 1125 if (FLAG_use_slow_path) {
1119 __ jmp(&slow_case); 1126 __ jmp(&slow_case);
1120 } else { 1127 } else {
1121 __ j(ABOVE_EQUAL, &slow_case); 1128 __ j(ABOVE_EQUAL, &slow_case);
1122 } 1129 }
1123 __ movq(Address(THR, Thread::top_offset()), RBX); 1130 __ movq(Address(RCX, Heap::TopOffset(space)), RBX);
1124 NOT_IN_PRODUCT(__ UpdateAllocationStats(cls.id(), space)); 1131 NOT_IN_PRODUCT(__ UpdateAllocationStats(cls.id(), space));
1125 1132
1126 // RAX: new object start (untagged). 1133 // RAX: new object start (untagged).
1127 // RBX: next object start. 1134 // RBX: next object start.
1128 // RDX: new object type arguments (if is_cls_parameterized). 1135 // RDX: new object type arguments (if is_cls_parameterized).
1129 // Set the tags. 1136 // Set the tags.
1130 uint32_t tags = 0; 1137 uint32_t tags = 0;
1131 tags = RawObject::SizeTag::update(instance_size, tags); 1138 tags = RawObject::SizeTag::update(instance_size, tags);
1132 ASSERT(cls.id() != kIllegalCid); 1139 ASSERT(cls.id() != kIllegalCid);
1133 tags = RawObject::ClassIdTag::update(cls.id(), tags); 1140 tags = RawObject::ClassIdTag::update(cls.id(), tags);
(...skipping 1182 matching lines...) Expand 10 before | Expand all | Expand 10 after
2316 } 2323 }
2317 2324
2318 2325
2319 void StubCode::GenerateAsynchronousGapMarkerStub(Assembler* assembler) { 2326 void StubCode::GenerateAsynchronousGapMarkerStub(Assembler* assembler) {
2320 __ int3(); 2327 __ int3();
2321 } 2328 }
2322 2329
2323 } // namespace dart 2330 } // namespace dart
2324 2331
2325 #endif // defined TARGET_ARCH_X64 2332 #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