OLD | NEW |
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 872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
883 lw(TMP, Address(temp_reg, count_field_offset)); | 883 lw(TMP, Address(temp_reg, count_field_offset)); |
884 AddImmediate(TMP, 1); | 884 AddImmediate(TMP, 1); |
885 sw(TMP, Address(temp_reg, count_field_offset)); | 885 sw(TMP, Address(temp_reg, count_field_offset)); |
886 lw(TMP, Address(temp_reg, size_field_offset)); | 886 lw(TMP, Address(temp_reg, size_field_offset)); |
887 addu(TMP, TMP, size_reg); | 887 addu(TMP, TMP, size_reg); |
888 sw(TMP, Address(temp_reg, size_field_offset)); | 888 sw(TMP, Address(temp_reg, size_field_offset)); |
889 } | 889 } |
890 } | 890 } |
891 | 891 |
892 | 892 |
| 893 void Assembler::MaybeTraceAllocation(intptr_t cid, |
| 894 Register temp_reg, |
| 895 Label* trace) { |
| 896 ASSERT(cid > 0); |
| 897 ASSERT(!in_delay_slot_); |
| 898 ASSERT(temp_reg != kNoRegister); |
| 899 ASSERT(temp_reg != TMP); |
| 900 Isolate* isolate = Isolate::Current(); |
| 901 ClassTable* class_table = isolate->class_table(); |
| 902 const uword class_offset = cid * sizeof(ClassHeapStats); // NOLINT |
| 903 if (cid < kNumPredefinedCids) { |
| 904 const uword class_heap_stats_table_address = |
| 905 class_table->PredefinedClassHeapStatsTableAddress(); |
| 906 LoadImmediate(temp_reg, class_heap_stats_table_address + class_offset); |
| 907 } else { |
| 908 LoadImmediate(temp_reg, class_table->ClassStatsTableAddress()); |
| 909 lw(temp_reg, Address(temp_reg, 0)); |
| 910 AddImmediate(temp_reg, class_offset); |
| 911 } |
| 912 const uword state_offset = ClassHeapStats::state_offset(); |
| 913 const Address& state_address = Address(temp_reg, state_offset); |
| 914 lw(temp_reg, state_address); |
| 915 andi(CMPRES1, temp_reg, Immediate(ClassHeapStats::TraceAllocationMask())); |
| 916 bne(CMPRES1, ZR, trace); |
| 917 } |
| 918 |
| 919 |
893 void Assembler::TryAllocate(const Class& cls, | 920 void Assembler::TryAllocate(const Class& cls, |
894 Label* failure, | 921 Label* failure, |
895 Register instance_reg, | 922 Register instance_reg, |
896 Register temp_reg) { | 923 Register temp_reg) { |
897 ASSERT(!in_delay_slot_); | 924 ASSERT(!in_delay_slot_); |
898 ASSERT(failure != NULL); | 925 ASSERT(failure != NULL); |
899 if (FLAG_inline_alloc) { | 926 if (FLAG_inline_alloc) { |
| 927 // If this allocation is traced, program will jump to failure path |
| 928 // (i.e. the allocation stub) which will allocate the object and trace the |
| 929 // allocation call site. |
| 930 MaybeTraceAllocation(cls.id(), temp_reg, failure); |
900 const intptr_t instance_size = cls.instance_size(); | 931 const intptr_t instance_size = cls.instance_size(); |
901 Heap* heap = Isolate::Current()->heap(); | 932 Heap* heap = Isolate::Current()->heap(); |
902 Heap::Space space = heap->SpaceForAllocation(cls.id()); | 933 Heap::Space space = heap->SpaceForAllocation(cls.id()); |
903 const uword top_address = heap->TopAddress(space); | 934 const uword top_address = heap->TopAddress(space); |
904 LoadImmediate(temp_reg, top_address); | 935 LoadImmediate(temp_reg, top_address); |
905 lw(instance_reg, Address(temp_reg)); | 936 lw(instance_reg, Address(temp_reg)); |
906 // TODO(koda): Protect against unsigned overflow here. | 937 // TODO(koda): Protect against unsigned overflow here. |
907 AddImmediate(instance_reg, instance_size); | 938 AddImmediate(instance_reg, instance_size); |
908 | 939 |
909 // instance_reg: potential next object start. | 940 // instance_reg: potential next object start. |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1242 Label stop; | 1273 Label stop; |
1243 b(&stop); | 1274 b(&stop); |
1244 Emit(reinterpret_cast<int32_t>(message)); | 1275 Emit(reinterpret_cast<int32_t>(message)); |
1245 Bind(&stop); | 1276 Bind(&stop); |
1246 break_(Instr::kStopMessageCode); | 1277 break_(Instr::kStopMessageCode); |
1247 } | 1278 } |
1248 | 1279 |
1249 } // namespace dart | 1280 } // namespace dart |
1250 | 1281 |
1251 #endif // defined TARGET_ARCH_MIPS | 1282 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |