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

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

Issue 2105383003: VM: Don't generate allocation stats code in product mode. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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/assembler_ia32.cc ('k') | runtime/vm/assembler_x64.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) 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" // NOLINT 5 #include "vm/globals.h" // NOLINT
6 #if defined(TARGET_ARCH_MIPS) 6 #if defined(TARGET_ARCH_MIPS)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/longjump.h" 9 #include "vm/longjump.h"
10 #include "vm/runtime_entry.h" 10 #include "vm/runtime_entry.h"
(...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after
974 void Assembler::TryAllocate(const Class& cls, 974 void Assembler::TryAllocate(const Class& cls,
975 Label* failure, 975 Label* failure,
976 Register instance_reg, 976 Register instance_reg,
977 Register temp_reg) { 977 Register temp_reg) {
978 ASSERT(!in_delay_slot_); 978 ASSERT(!in_delay_slot_);
979 ASSERT(failure != NULL); 979 ASSERT(failure != NULL);
980 if (FLAG_inline_alloc) { 980 if (FLAG_inline_alloc) {
981 // If this allocation is traced, program will jump to failure path 981 // If this allocation is traced, program will jump to failure path
982 // (i.e. the allocation stub) which will allocate the object and trace the 982 // (i.e. the allocation stub) which will allocate the object and trace the
983 // allocation call site. 983 // allocation call site.
984 MaybeTraceAllocation(cls.id(), temp_reg, failure); 984 NOT_IN_PRODUCT(MaybeTraceAllocation(cls.id(), temp_reg, failure));
985 const intptr_t instance_size = cls.instance_size(); 985 const intptr_t instance_size = cls.instance_size();
986 Heap::Space space = Heap::SpaceForAllocation(cls.id()); 986 Heap::Space space = Heap::SpaceForAllocation(cls.id());
987 lw(temp_reg, Address(THR, Thread::heap_offset())); 987 lw(temp_reg, Address(THR, Thread::heap_offset()));
988 lw(instance_reg, Address(temp_reg, Heap::TopOffset(space))); 988 lw(instance_reg, Address(temp_reg, Heap::TopOffset(space)));
989 // TODO(koda): Protect against unsigned overflow here. 989 // TODO(koda): Protect against unsigned overflow here.
990 AddImmediate(instance_reg, instance_size); 990 AddImmediate(instance_reg, instance_size);
991 991
992 // instance_reg: potential next object start. 992 // instance_reg: potential next object start.
993 lw(TMP, Address(temp_reg, Heap::EndOffset(space))); 993 lw(TMP, Address(temp_reg, Heap::EndOffset(space)));
994 // Fail if heap end unsigned less than or equal to instance_reg. 994 // Fail if heap end unsigned less than or equal to instance_reg.
995 BranchUnsignedLessEqual(TMP, instance_reg, failure); 995 BranchUnsignedLessEqual(TMP, instance_reg, failure);
996 996
997 // Successfully allocated the object, now update top to point to 997 // Successfully allocated the object, now update top to point to
998 // next object start and store the class in the class field of object. 998 // next object start and store the class in the class field of object.
999 sw(instance_reg, Address(temp_reg, Heap::TopOffset(space))); 999 sw(instance_reg, Address(temp_reg, Heap::TopOffset(space)));
1000 1000
1001 ASSERT(instance_size >= kHeapObjectTag); 1001 ASSERT(instance_size >= kHeapObjectTag);
1002 AddImmediate(instance_reg, -instance_size + kHeapObjectTag); 1002 AddImmediate(instance_reg, -instance_size + kHeapObjectTag);
1003 UpdateAllocationStats(cls.id(), temp_reg, space); 1003 NOT_IN_PRODUCT(UpdateAllocationStats(cls.id(), temp_reg, space));
1004 uword tags = 0; 1004 uword tags = 0;
1005 tags = RawObject::SizeTag::update(instance_size, tags); 1005 tags = RawObject::SizeTag::update(instance_size, tags);
1006 ASSERT(cls.id() != kIllegalCid); 1006 ASSERT(cls.id() != kIllegalCid);
1007 tags = RawObject::ClassIdTag::update(cls.id(), tags); 1007 tags = RawObject::ClassIdTag::update(cls.id(), tags);
1008 LoadImmediate(TMP, tags); 1008 LoadImmediate(TMP, tags);
1009 sw(TMP, FieldAddress(instance_reg, Object::tags_offset())); 1009 sw(TMP, FieldAddress(instance_reg, Object::tags_offset()));
1010 } else { 1010 } else {
1011 b(failure); 1011 b(failure);
1012 } 1012 }
1013 } 1013 }
1014 1014
1015 1015
1016 void Assembler::TryAllocateArray(intptr_t cid, 1016 void Assembler::TryAllocateArray(intptr_t cid,
1017 intptr_t instance_size, 1017 intptr_t instance_size,
1018 Label* failure, 1018 Label* failure,
1019 Register instance, 1019 Register instance,
1020 Register end_address, 1020 Register end_address,
1021 Register temp1, 1021 Register temp1,
1022 Register temp2) { 1022 Register temp2) {
1023 if (FLAG_inline_alloc) { 1023 if (FLAG_inline_alloc) {
1024 // If this allocation is traced, program will jump to failure path 1024 // If this allocation is traced, program will jump to failure path
1025 // (i.e. the allocation stub) which will allocate the object and trace the 1025 // (i.e. the allocation stub) which will allocate the object and trace the
1026 // allocation call site. 1026 // allocation call site.
1027 MaybeTraceAllocation(cid, temp1, failure); 1027 NOT_IN_PRODUCT(MaybeTraceAllocation(cid, temp1, failure));
1028 Isolate* isolate = Isolate::Current(); 1028 Isolate* isolate = Isolate::Current();
1029 Heap* heap = isolate->heap(); 1029 Heap* heap = isolate->heap();
1030 Heap::Space space = heap->SpaceForAllocation(cid); 1030 Heap::Space space = heap->SpaceForAllocation(cid);
1031 lw(temp1, Address(THR, Thread::heap_offset())); 1031 lw(temp1, Address(THR, Thread::heap_offset()));
1032 // Potential new object start. 1032 // Potential new object start.
1033 lw(instance, Address(temp1, heap->TopOffset(space))); 1033 lw(instance, Address(temp1, heap->TopOffset(space)));
1034 // Potential next object start. 1034 // Potential next object start.
1035 AddImmediate(end_address, instance, instance_size); 1035 AddImmediate(end_address, instance, instance_size);
1036 // Branch on unsigned overflow. 1036 // Branch on unsigned overflow.
1037 BranchUnsignedLess(end_address, instance, failure); 1037 BranchUnsignedLess(end_address, instance, failure);
1038 1038
1039 // Check if the allocation fits into the remaining space. 1039 // Check if the allocation fits into the remaining space.
1040 // instance: potential new object start, /* inline_isolate = */ false. 1040 // instance: potential new object start, /* inline_isolate = */ false.
1041 // end_address: potential next object start. 1041 // end_address: potential next object start.
1042 lw(temp2, Address(temp1, Heap::EndOffset(space))); 1042 lw(temp2, Address(temp1, Heap::EndOffset(space)));
1043 BranchUnsignedGreaterEqual(end_address, temp2, failure); 1043 BranchUnsignedGreaterEqual(end_address, temp2, failure);
1044 1044
1045 // Successfully allocated the object(s), now update top to point to 1045 // Successfully allocated the object(s), now update top to point to
1046 // next object start and initialize the object. 1046 // next object start and initialize the object.
1047 sw(end_address, Address(temp1, Heap::TopOffset(space))); 1047 sw(end_address, Address(temp1, Heap::TopOffset(space)));
1048 addiu(instance, instance, Immediate(kHeapObjectTag)); 1048 addiu(instance, instance, Immediate(kHeapObjectTag));
1049 LoadImmediate(temp1, instance_size); 1049 LoadImmediate(temp1, instance_size);
1050 UpdateAllocationStatsWithSize(cid, temp1, temp2, space); 1050 NOT_IN_PRODUCT(UpdateAllocationStatsWithSize(cid, temp1, temp2, space));
1051 1051
1052 // Initialize the tags. 1052 // Initialize the tags.
1053 // instance: new object start as a tagged pointer. 1053 // instance: new object start as a tagged pointer.
1054 uword tags = 0; 1054 uword tags = 0;
1055 tags = RawObject::ClassIdTag::update(cid, tags); 1055 tags = RawObject::ClassIdTag::update(cid, tags);
1056 tags = RawObject::SizeTag::update(instance_size, tags); 1056 tags = RawObject::SizeTag::update(instance_size, tags);
1057 LoadImmediate(temp1, tags); 1057 LoadImmediate(temp1, tags);
1058 sw(temp1, FieldAddress(instance, Array::tags_offset())); // Store tags. 1058 sw(temp1, FieldAddress(instance, Array::tags_offset())); // Store tags.
1059 } else { 1059 } else {
1060 b(failure); 1060 b(failure);
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
1306 Label stop; 1306 Label stop;
1307 b(&stop); 1307 b(&stop);
1308 Emit(reinterpret_cast<int32_t>(message)); 1308 Emit(reinterpret_cast<int32_t>(message));
1309 Bind(&stop); 1309 Bind(&stop);
1310 break_(Instr::kStopMessageCode); 1310 break_(Instr::kStopMessageCode);
1311 } 1311 }
1312 1312
1313 } // namespace dart 1313 } // namespace dart
1314 1314
1315 #endif // defined TARGET_ARCH_MIPS 1315 #endif // defined TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « runtime/vm/assembler_ia32.cc ('k') | runtime/vm/assembler_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698