Chromium Code Reviews| 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" | 5 #include "vm/globals.h" |
| 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 869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 880 ASSERT(cls.id() != kIllegalCid); | 880 ASSERT(cls.id() != kIllegalCid); |
| 881 tags = RawObject::ClassIdTag::update(cls.id(), tags); | 881 tags = RawObject::ClassIdTag::update(cls.id(), tags); |
| 882 LoadImmediate(TMP, tags); | 882 LoadImmediate(TMP, tags); |
| 883 sw(TMP, FieldAddress(instance_reg, Object::tags_offset())); | 883 sw(TMP, FieldAddress(instance_reg, Object::tags_offset())); |
| 884 } else { | 884 } else { |
| 885 b(failure); | 885 b(failure); |
| 886 } | 886 } |
| 887 } | 887 } |
| 888 | 888 |
| 889 | 889 |
| 890 void Assembler::TryAllocateArray(intptr_t cid, | |
| 891 intptr_t instance_size, | |
| 892 Label* failure, | |
| 893 Register instance, | |
| 894 Register end_address, | |
| 895 Register temp1, | |
| 896 Register temp2) { | |
|
srdjan
2014/08/11 21:42:34
Guard with FLAG_inline_alloc.
Florian Schneider
2014/08/13 14:56:12
Done.
| |
| 897 Isolate* isolate = Isolate::Current(); | |
| 898 Heap* heap = isolate->heap(); | |
| 899 | |
| 900 LoadImmediate(temp1, heap->TopAddress()); | |
| 901 lw(instance, Address(temp1, 0)); // Potential new object start. | |
| 902 // Potential next object start. | |
| 903 AddImmediateDetectOverflow(end_address, instance, instance_size, CMPRES1); | |
| 904 bltz(CMPRES1, failure); // CMPRES1 < 0 on overflow. | |
| 905 | |
| 906 // Check if the allocation fits into the remaining space. | |
| 907 // instance: potential new object start. | |
| 908 // end_address: potential next object start. | |
| 909 LoadImmediate(temp2, heap->EndAddress()); | |
| 910 lw(temp2, Address(temp2, 0)); | |
| 911 BranchUnsignedGreaterEqual(end_address, temp2, failure); | |
| 912 | |
| 913 | |
| 914 // Successfully allocated the object(s), now update top to point to | |
| 915 // next object start and initialize the object. | |
| 916 sw(end_address, Address(temp1, 0)); | |
| 917 addiu(instance, instance, Immediate(kHeapObjectTag)); | |
| 918 LoadImmediate(temp1, instance_size); | |
| 919 UpdateAllocationStatsWithSize(cid, temp1, temp2); | |
| 920 | |
| 921 // Initialize the tags. | |
| 922 // instance: new object start as a tagged pointer. | |
| 923 uword tags = 0; | |
| 924 tags = RawObject::ClassIdTag::update(cid, tags); | |
| 925 tags = RawObject::SizeTag::update(instance_size, tags); | |
| 926 LoadImmediate(temp1, tags); | |
| 927 sw(temp1, FieldAddress(instance, Array::tags_offset())); // Store tags. | |
| 928 } | |
| 929 | |
| 930 | |
| 890 void Assembler::CallRuntime(const RuntimeEntry& entry, | 931 void Assembler::CallRuntime(const RuntimeEntry& entry, |
| 891 intptr_t argument_count) { | 932 intptr_t argument_count) { |
| 892 entry.Call(this, argument_count); | 933 entry.Call(this, argument_count); |
| 893 } | 934 } |
| 894 | 935 |
| 895 | 936 |
| 896 void Assembler::EnterDartFrame(intptr_t frame_size) { | 937 void Assembler::EnterDartFrame(intptr_t frame_size) { |
| 897 ASSERT(!in_delay_slot_); | 938 ASSERT(!in_delay_slot_); |
| 898 const intptr_t offset = CodeSize(); | 939 const intptr_t offset = CodeSize(); |
| 899 | 940 |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1183 Emit(reinterpret_cast<int32_t>(message)); | 1224 Emit(reinterpret_cast<int32_t>(message)); |
| 1184 Bind(&msg); | 1225 Bind(&msg); |
| 1185 break_(Instr::kMsgMessageCode); | 1226 break_(Instr::kMsgMessageCode); |
| 1186 } | 1227 } |
| 1187 #endif | 1228 #endif |
| 1188 } | 1229 } |
| 1189 | 1230 |
| 1190 } // namespace dart | 1231 } // namespace dart |
| 1191 | 1232 |
| 1192 #endif // defined TARGET_ARCH_MIPS | 1233 #endif // defined TARGET_ARCH_MIPS |
| OLD | NEW |