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

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

Issue 392343002: Cleanup of class id loading sequences. (Closed) Base URL: http://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 674 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 const intptr_t table_offset_in_isolate = 685 const intptr_t table_offset_in_isolate =
686 Isolate::class_table_offset() + ClassTable::table_offset(); 686 Isolate::class_table_offset() + ClassTable::table_offset();
687 lw(result, Address(result, table_offset_in_isolate)); 687 lw(result, Address(result, table_offset_in_isolate));
688 sll(TMP, TMP, 2); 688 sll(TMP, TMP, 2);
689 addu(result, result, TMP); 689 addu(result, result, TMP);
690 lw(result, Address(result)); 690 lw(result, Address(result));
691 } 691 }
692 692
693 693
694 void Assembler::LoadTaggedClassIdMayBeSmi(Register result, Register object) { 694 void Assembler::LoadTaggedClassIdMayBeSmi(Register result, Register object) {
695 ASSERT(object != TMP); 695 ASSERT(result != object);
696 ASSERT(result != TMP);
697 696
698 // Make a copy of object since result and object can be the same register.
699 mov(TMP, object);
700 // Load up a null object. We only need it so we can use LoadClassId on it in 697 // Load up a null object. We only need it so we can use LoadClassId on it in
701 // the case that object is a Smi. 698 // the case that object is a Smi.
702 LoadImmediate(result, reinterpret_cast<intptr_t>(Object::null())); 699 LoadImmediate(result, reinterpret_cast<intptr_t>(Object::null()));
703 // Check if the object is a Smi. 700 // Check if the object is a Smi.
704 andi(CMPRES1, TMP, Immediate(kSmiTagMask)); 701 andi(CMPRES1, object, Immediate(kSmiTagMask));
705 // If the object *is* a Smi, load the null object into tmp. o/w leave alone. 702 // If the object *is* a Smi, use the null object instead. o/w leave alone.
706 movz(TMP, result, CMPRES1); 703 movz(object, result, CMPRES1);
707 // Loads either the cid of the object if it isn't a Smi, or the cid of null 704 // Loads either the cid of the object if it isn't a Smi, or the cid of null
708 // if it is a Smi, which will be ignored. 705 // if it is a Smi, which will be ignored.
709 LoadClassId(result, TMP); 706 LoadClassId(result, object);
710 707
711 LoadImmediate(TMP, kSmiCid); 708 LoadImmediate(object, kSmiCid);
712 // If object is a Smi, move the Smi cid into result. o/w leave alone. 709 // If object is a Smi, move the Smi cid into result. o/w leave alone.
713 movz(result, TMP, CMPRES1); 710 movz(result, object, CMPRES1);
714 // Finally, tag the result. 711 // Finally, tag the result.
715 SmiTag(result); 712 SmiTag(result);
716 } 713 }
717 714
718 715
719 void Assembler::EnterFrame() { 716 void Assembler::EnterFrame() {
720 ASSERT(!in_delay_slot_); 717 ASSERT(!in_delay_slot_);
721 addiu(SP, SP, Immediate(-2 * kWordSize)); 718 addiu(SP, SP, Immediate(-2 * kWordSize));
722 sw(RA, Address(SP, 1 * kWordSize)); 719 sw(RA, Address(SP, 1 * kWordSize));
723 sw(FP, Address(SP, 0 * kWordSize)); 720 sw(FP, Address(SP, 0 * kWordSize));
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
1154 Emit(reinterpret_cast<int32_t>(message)); 1151 Emit(reinterpret_cast<int32_t>(message));
1155 Bind(&msg); 1152 Bind(&msg);
1156 break_(Instr::kMsgMessageCode); 1153 break_(Instr::kMsgMessageCode);
1157 } 1154 }
1158 #endif 1155 #endif
1159 } 1156 }
1160 1157
1161 } // namespace dart 1158 } // namespace dart
1162 1159
1163 #endif // defined TARGET_ARCH_MIPS 1160 #endif // defined TARGET_ARCH_MIPS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698