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

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

Issue 410333003: Shorter TryAllocate instruction sequence on ARM/ARM64/MIPS. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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 | Annotate | Revision Log
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 840 matching lines...) Expand 10 before | Expand all | Expand 10 after
851 851
852 void Assembler::TryAllocate(const Class& cls, 852 void Assembler::TryAllocate(const Class& cls,
853 Label* failure, 853 Label* failure,
854 Register instance_reg, 854 Register instance_reg,
855 Register temp_reg) { 855 Register temp_reg) {
856 ASSERT(!in_delay_slot_); 856 ASSERT(!in_delay_slot_);
857 ASSERT(failure != NULL); 857 ASSERT(failure != NULL);
858 if (FLAG_inline_alloc) { 858 if (FLAG_inline_alloc) {
859 Heap* heap = Isolate::Current()->heap(); 859 Heap* heap = Isolate::Current()->heap();
860 const intptr_t instance_size = cls.instance_size(); 860 const intptr_t instance_size = cls.instance_size();
861 LoadImmediate(instance_reg, heap->TopAddress()); 861
862 lw(instance_reg, Address(instance_reg, 0)); 862 LoadImmediate(temp_reg, heap->NewSpaceAddress());
863 lw(instance_reg, Address(temp_reg, Scavenger::top_offset()));
863 AddImmediate(instance_reg, instance_size); 864 AddImmediate(instance_reg, instance_size);
864 865
865 // instance_reg: potential next object start. 866 // instance_reg: potential next object start.
866 LoadImmediate(TMP, heap->EndAddress()); 867 lw(TMP, Address(temp_reg, Scavenger::end_offset()));
867 lw(TMP, Address(TMP, 0));
868 // Fail if heap end unsigned less than or equal to instance_reg. 868 // Fail if heap end unsigned less than or equal to instance_reg.
869 BranchUnsignedLessEqual(TMP, instance_reg, failure); 869 BranchUnsignedLessEqual(TMP, instance_reg, failure);
870 870
871 // Successfully allocated the object, now update top to point to 871 // Successfully allocated the object, now update top to point to
872 // next object start and store the class in the class field of object. 872 // next object start and store the class in the class field of object.
873 LoadImmediate(TMP, heap->TopAddress()); 873 sw(instance_reg, Address(temp_reg, Scavenger::top_offset()));
874 sw(instance_reg, Address(TMP, 0));
875 874
876 ASSERT(instance_size >= kHeapObjectTag); 875 ASSERT(instance_size >= kHeapObjectTag);
877 AddImmediate(instance_reg, -instance_size + kHeapObjectTag); 876 AddImmediate(instance_reg, -instance_size + kHeapObjectTag);
878 UpdateAllocationStats(cls.id(), temp_reg); 877 UpdateAllocationStats(cls.id(), temp_reg);
879 uword tags = 0; 878 uword tags = 0;
880 tags = RawObject::SizeTag::update(instance_size, tags); 879 tags = RawObject::SizeTag::update(instance_size, tags);
881 ASSERT(cls.id() != kIllegalCid); 880 ASSERT(cls.id() != kIllegalCid);
882 tags = RawObject::ClassIdTag::update(cls.id(), tags); 881 tags = RawObject::ClassIdTag::update(cls.id(), tags);
883 LoadImmediate(TMP, tags); 882 LoadImmediate(TMP, tags);
884 sw(TMP, FieldAddress(instance_reg, Object::tags_offset())); 883 sw(TMP, FieldAddress(instance_reg, Object::tags_offset()));
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
1184 Emit(reinterpret_cast<int32_t>(message)); 1183 Emit(reinterpret_cast<int32_t>(message));
1185 Bind(&msg); 1184 Bind(&msg);
1186 break_(Instr::kMsgMessageCode); 1185 break_(Instr::kMsgMessageCode);
1187 } 1186 }
1188 #endif 1187 #endif
1189 } 1188 }
1190 1189
1191 } // namespace dart 1190 } // namespace dart
1192 1191
1193 #endif // defined TARGET_ARCH_MIPS 1192 #endif // defined TARGET_ARCH_MIPS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698