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

Side by Side Diff: runtime/vm/stub_code_arm64.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_arm.cc ('k') | runtime/vm/stub_code_ia32.cc » ('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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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_ARM64) 6 #if defined(TARGET_ARCH_ARM64)
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 703 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 714
715 // Check for maximum allowed length. 715 // Check for maximum allowed length.
716 const intptr_t max_len = 716 const intptr_t max_len =
717 reinterpret_cast<intptr_t>(Smi::New(Array::kMaxElements)); 717 reinterpret_cast<intptr_t>(Smi::New(Array::kMaxElements));
718 __ CompareImmediate(R2, max_len); 718 __ CompareImmediate(R2, max_len);
719 __ b(&slow_case, GT); 719 __ b(&slow_case, GT);
720 720
721 const intptr_t cid = kArrayCid; 721 const intptr_t cid = kArrayCid;
722 NOT_IN_PRODUCT(__ MaybeTraceAllocation(kArrayCid, R4, &slow_case)); 722 NOT_IN_PRODUCT(__ MaybeTraceAllocation(kArrayCid, R4, &slow_case));
723 723
724 NOT_IN_PRODUCT(Heap::Space space = Heap::kNew); 724 Heap::Space space = Heap::kNew;
725 __ ldr(R8, Address(THR, Thread::heap_offset()));
725 726
726 // Calculate and align allocation size. 727 // Calculate and align allocation size.
727 // Load new object start and calculate next object start. 728 // Load new object start and calculate next object start.
728 // R1: array element type. 729 // R1: array element type.
729 // R2: array length as Smi. 730 // R2: array length as Smi.
730 __ ldr(R0, Address(THR, Thread::top_offset())); 731 // R8: heap.
732 __ LoadFromOffset(R0, R8, Heap::TopOffset(space));
731 intptr_t fixed_size_plus_alignment_padding = 733 intptr_t fixed_size_plus_alignment_padding =
732 sizeof(RawArray) + kObjectAlignment - 1; 734 sizeof(RawArray) + kObjectAlignment - 1;
733 __ LoadImmediate(R3, fixed_size_plus_alignment_padding); 735 __ LoadImmediate(R3, fixed_size_plus_alignment_padding);
734 __ add(R3, R3, Operand(R2, LSL, 2)); // R2 is Smi. 736 __ add(R3, R3, Operand(R2, LSL, 2)); // R2 is Smi.
735 ASSERT(kSmiTagShift == 1); 737 ASSERT(kSmiTagShift == 1);
736 __ andi(R3, R3, Immediate(~(kObjectAlignment - 1))); 738 __ andi(R3, R3, Immediate(~(kObjectAlignment - 1)));
737 // R0: potential new object start. 739 // R0: potential new object start.
738 // R3: object size in bytes. 740 // R3: object size in bytes.
739 __ adds(R7, R3, Operand(R0)); 741 __ adds(R7, R3, Operand(R0));
740 __ b(&slow_case, CS); // Branch if unsigned overflow. 742 __ b(&slow_case, CS); // Branch if unsigned overflow.
741 743
742 // Check if the allocation fits into the remaining space. 744 // Check if the allocation fits into the remaining space.
743 // R0: potential new object start. 745 // R0: potential new object start.
744 // R1: array element type. 746 // R1: array element type.
745 // R2: array length as Smi. 747 // R2: array length as Smi.
746 // R3: array size. 748 // R3: array size.
747 // R7: potential next object start. 749 // R7: potential next object start.
748 __ LoadFromOffset(TMP, THR, Thread::end_offset()); 750 // R8: heap.
751 __ LoadFromOffset(TMP, R8, Heap::EndOffset(space));
749 __ CompareRegisters(R7, TMP); 752 __ CompareRegisters(R7, TMP);
750 __ b(&slow_case, CS); // Branch if unsigned higher or equal. 753 __ b(&slow_case, CS); // Branch if unsigned higher or equal.
751 754
752 // Successfully allocated the object(s), now update top to point to 755 // Successfully allocated the object(s), now update top to point to
753 // next object start and initialize the object. 756 // next object start and initialize the object.
754 // R0: potential new object start. 757 // R0: potential new object start.
755 // R3: array size. 758 // R3: array size.
756 // R7: potential next object start. 759 // R7: potential next object start.
757 __ str(R7, Address(THR, Thread::top_offset())); 760 // R8: heap.
761 __ StoreToOffset(R7, R8, Heap::TopOffset(space));
758 __ add(R0, R0, Operand(kHeapObjectTag)); 762 __ add(R0, R0, Operand(kHeapObjectTag));
759 NOT_IN_PRODUCT(__ UpdateAllocationStatsWithSize(cid, R3, space)); 763 NOT_IN_PRODUCT(__ UpdateAllocationStatsWithSize(cid, R3, space));
760 764
761 // R0: new object start as a tagged pointer. 765 // R0: new object start as a tagged pointer.
762 // R1: array element type. 766 // R1: array element type.
763 // R2: array length as Smi. 767 // R2: array length as Smi.
764 // R3: array size. 768 // R3: array size.
765 // R7: new object end address. 769 // R7: new object end address.
766 770
767 // Store the type argument field. 771 // Store the type argument field.
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
979 __ LoadImmediate(R2, fixed_size_plus_alignment_padding); 983 __ LoadImmediate(R2, fixed_size_plus_alignment_padding);
980 __ add(R2, R2, Operand(R1, LSL, 3)); 984 __ add(R2, R2, Operand(R1, LSL, 3));
981 ASSERT(kSmiTagShift == 1); 985 ASSERT(kSmiTagShift == 1);
982 __ andi(R2, R2, Immediate(~(kObjectAlignment - 1))); 986 __ andi(R2, R2, Immediate(~(kObjectAlignment - 1)));
983 987
984 NOT_IN_PRODUCT(__ MaybeTraceAllocation(kContextCid, R4, &slow_case)); 988 NOT_IN_PRODUCT(__ MaybeTraceAllocation(kContextCid, R4, &slow_case));
985 // Now allocate the object. 989 // Now allocate the object.
986 // R1: number of context variables. 990 // R1: number of context variables.
987 // R2: object size. 991 // R2: object size.
988 const intptr_t cid = kContextCid; 992 const intptr_t cid = kContextCid;
989 NOT_IN_PRODUCT(Heap::Space space = Heap::kNew); 993 Heap::Space space = Heap::kNew;
990 __ ldr(R0, Address(THR, Thread::top_offset())); 994 __ ldr(R5, Address(THR, Thread::heap_offset()));
995 __ ldr(R0, Address(R5, Heap::TopOffset(space)));
991 __ add(R3, R2, Operand(R0)); 996 __ add(R3, R2, Operand(R0));
992 // Check if the allocation fits into the remaining space. 997 // Check if the allocation fits into the remaining space.
993 // R0: potential new object. 998 // R0: potential new object.
994 // R1: number of context variables. 999 // R1: number of context variables.
995 // R2: object size. 1000 // R2: object size.
996 // R3: potential next object start. 1001 // R3: potential next object start.
997 __ ldr(TMP, Address(THR, Thread::end_offset())); 1002 // R5: heap.
1003 __ ldr(TMP, Address(R5, Heap::EndOffset(space)));
998 __ CompareRegisters(R3, TMP); 1004 __ CompareRegisters(R3, TMP);
999 if (FLAG_use_slow_path) { 1005 if (FLAG_use_slow_path) {
1000 __ b(&slow_case); 1006 __ b(&slow_case);
1001 } else { 1007 } else {
1002 __ b(&slow_case, CS); // Branch if unsigned higher or equal. 1008 __ b(&slow_case, CS); // Branch if unsigned higher or equal.
1003 } 1009 }
1004 1010
1005 // Successfully allocated the object, now update top to point to 1011 // Successfully allocated the object, now update top to point to
1006 // next object start and initialize the object. 1012 // next object start and initialize the object.
1007 // R0: new object. 1013 // R0: new object.
1008 // R1: number of context variables. 1014 // R1: number of context variables.
1009 // R2: object size. 1015 // R2: object size.
1010 // R3: next object start. 1016 // R3: next object start.
1011 __ str(R3, Address(THR, Thread::top_offset())); 1017 // R5: heap.
1018 __ str(R3, Address(R5, Heap::TopOffset(space)));
1012 __ add(R0, R0, Operand(kHeapObjectTag)); 1019 __ add(R0, R0, Operand(kHeapObjectTag));
1013 NOT_IN_PRODUCT(__ UpdateAllocationStatsWithSize(cid, R2, space)); 1020 NOT_IN_PRODUCT(__ UpdateAllocationStatsWithSize(cid, R2, space));
1014 1021
1015 // Calculate the size tag. 1022 // Calculate the size tag.
1016 // R0: new object. 1023 // R0: new object.
1017 // R1: number of context variables. 1024 // R1: number of context variables.
1018 // R2: object size. 1025 // R2: object size.
1019 const intptr_t shift = RawObject::kSizeTagPos - kObjectAlignmentLog2; 1026 const intptr_t shift = RawObject::kSizeTagPos - kObjectAlignmentLog2;
1020 __ CompareImmediate(R2, RawObject::SizeTag::kMaxSizeTag); 1027 __ CompareImmediate(R2, RawObject::SizeTag::kMaxSizeTag);
1021 // If no size tag overflow, shift R2 left, else set R2 to zero. 1028 // If no size tag overflow, shift R2 left, else set R2 to zero.
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
1162 __ ldr(R1, Address(SP)); 1169 __ ldr(R1, Address(SP));
1163 // R1: instantiated type arguments. 1170 // R1: instantiated type arguments.
1164 } 1171 }
1165 Isolate* isolate = Isolate::Current(); 1172 Isolate* isolate = Isolate::Current();
1166 if (FLAG_inline_alloc && Heap::IsAllocatableInNewSpace(instance_size) && 1173 if (FLAG_inline_alloc && Heap::IsAllocatableInNewSpace(instance_size) &&
1167 !cls.TraceAllocation(isolate)) { 1174 !cls.TraceAllocation(isolate)) {
1168 Label slow_case; 1175 Label slow_case;
1169 // Allocate the object and update top to point to 1176 // Allocate the object and update top to point to
1170 // next object start and initialize the allocated object. 1177 // next object start and initialize the allocated object.
1171 // R1: instantiated type arguments (if is_cls_parameterized). 1178 // R1: instantiated type arguments (if is_cls_parameterized).
1172 NOT_IN_PRODUCT(Heap::Space space = Heap::kNew); 1179 Heap::Space space = Heap::kNew;
1173 __ ldr(R2, Address(THR, Thread::top_offset())); 1180 __ ldr(R5, Address(THR, Thread::heap_offset()));
1181 __ ldr(R2, Address(R5, Heap::TopOffset(space)));
1174 __ AddImmediate(R3, R2, instance_size); 1182 __ AddImmediate(R3, R2, instance_size);
1175 // Check if the allocation fits into the remaining space. 1183 // Check if the allocation fits into the remaining space.
1176 // R2: potential new object start. 1184 // R2: potential new object start.
1177 // R3: potential next object start. 1185 // R3: potential next object start.
1178 __ ldr(TMP, Address(THR, Thread::end_offset())); 1186 // R5: heap.
1187 __ ldr(TMP, Address(R5, Heap::EndOffset(space)));
1179 __ CompareRegisters(R3, TMP); 1188 __ CompareRegisters(R3, TMP);
1180 if (FLAG_use_slow_path) { 1189 if (FLAG_use_slow_path) {
1181 __ b(&slow_case); 1190 __ b(&slow_case);
1182 } else { 1191 } else {
1183 __ b(&slow_case, CS); // Unsigned higher or equal. 1192 __ b(&slow_case, CS); // Unsigned higher or equal.
1184 } 1193 }
1185 __ str(R3, Address(THR, Thread::top_offset())); 1194 __ str(R3, Address(R5, Heap::TopOffset(space)));
1186 NOT_IN_PRODUCT(__ UpdateAllocationStats(cls.id(), space)); 1195 NOT_IN_PRODUCT(__ UpdateAllocationStats(cls.id(), space));
1187 1196
1188 // R2: new object start. 1197 // R2: new object start.
1189 // R3: next object start. 1198 // R3: next object start.
1190 // R1: new object type arguments (if is_cls_parameterized). 1199 // R1: new object type arguments (if is_cls_parameterized).
1191 // Set the tags. 1200 // Set the tags.
1192 uint32_t tags = 0; 1201 uint32_t tags = 0;
1193 tags = RawObject::SizeTag::update(instance_size, tags); 1202 tags = RawObject::SizeTag::update(instance_size, tags);
1194 ASSERT(cls.id() != kIllegalCid); 1203 ASSERT(cls.id() != kIllegalCid);
1195 tags = RawObject::ClassIdTag::update(cls.id(), tags); 1204 tags = RawObject::ClassIdTag::update(cls.id(), tags);
(...skipping 1175 matching lines...) Expand 10 before | Expand all | Expand 10 after
2371 } 2380 }
2372 2381
2373 2382
2374 void StubCode::GenerateAsynchronousGapMarkerStub(Assembler* assembler) { 2383 void StubCode::GenerateAsynchronousGapMarkerStub(Assembler* assembler) {
2375 __ brk(0); 2384 __ brk(0);
2376 } 2385 }
2377 2386
2378 } // namespace dart 2387 } // namespace dart
2379 2388
2380 #endif // defined TARGET_ARCH_ARM64 2389 #endif // defined TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « runtime/vm/stub_code_arm.cc ('k') | runtime/vm/stub_code_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698