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

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

Issue 346823003: VM: Optimized context allocation on all platforms. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/assembler_mips.h ('k') | runtime/vm/assembler_x64.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_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
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) {
897 if (FLAG_inline_alloc) {
898 Isolate* isolate = Isolate::Current();
899 Heap* heap = isolate->heap();
900
901 LoadImmediate(temp1, heap->TopAddress());
902 lw(instance, Address(temp1, 0)); // Potential new object start.
903 // Potential next object start.
904 AddImmediateDetectOverflow(end_address, instance, instance_size, CMPRES1);
905 bltz(CMPRES1, failure); // CMPRES1 < 0 on overflow.
906
907 // Check if the allocation fits into the remaining space.
908 // instance: potential new object start.
909 // end_address: potential next object start.
910 LoadImmediate(temp2, heap->EndAddress());
911 lw(temp2, Address(temp2, 0));
912 BranchUnsignedGreaterEqual(end_address, temp2, failure);
913
914
915 // Successfully allocated the object(s), now update top to point to
916 // next object start and initialize the object.
917 sw(end_address, Address(temp1, 0));
918 addiu(instance, instance, Immediate(kHeapObjectTag));
919 LoadImmediate(temp1, instance_size);
920 UpdateAllocationStatsWithSize(cid, temp1, temp2);
921
922 // Initialize the tags.
923 // instance: new object start as a tagged pointer.
924 uword tags = 0;
925 tags = RawObject::ClassIdTag::update(cid, tags);
926 tags = RawObject::SizeTag::update(instance_size, tags);
927 LoadImmediate(temp1, tags);
928 sw(temp1, FieldAddress(instance, Array::tags_offset())); // Store tags.
929 } else {
930 b(failure);
931 }
932 }
933
934
890 void Assembler::CallRuntime(const RuntimeEntry& entry, 935 void Assembler::CallRuntime(const RuntimeEntry& entry,
891 intptr_t argument_count) { 936 intptr_t argument_count) {
892 entry.Call(this, argument_count); 937 entry.Call(this, argument_count);
893 } 938 }
894 939
895 940
896 void Assembler::EnterDartFrame(intptr_t frame_size) { 941 void Assembler::EnterDartFrame(intptr_t frame_size) {
897 ASSERT(!in_delay_slot_); 942 ASSERT(!in_delay_slot_);
898 const intptr_t offset = CodeSize(); 943 const intptr_t offset = CodeSize();
899 944
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
1183 Emit(reinterpret_cast<int32_t>(message)); 1228 Emit(reinterpret_cast<int32_t>(message));
1184 Bind(&msg); 1229 Bind(&msg);
1185 break_(Instr::kMsgMessageCode); 1230 break_(Instr::kMsgMessageCode);
1186 } 1231 }
1187 #endif 1232 #endif
1188 } 1233 }
1189 1234
1190 } // namespace dart 1235 } // namespace dart
1191 1236
1192 #endif // defined TARGET_ARCH_MIPS 1237 #endif // defined TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « runtime/vm/assembler_mips.h ('k') | runtime/vm/assembler_x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698