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 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 static const intptr_t kSmiCidSource = kSmiCid << RawObject::kClassIdTagPos; |
696 ASSERT(result != TMP); | |
697 | 696 |
698 // Make a copy of object since result and object can be the same register. | 697 LoadImmediate(TMP, reinterpret_cast<int32_t>(&kSmiCidSource) + 1); |
699 mov(TMP, object); | 698 andi(CMPRES1, object, Immediate(kSmiTagMask)); |
700 // Load up a null object. We only need it so we can use LoadClassId on it in | 699 if (result != object) { |
701 // the case that object is a Smi. | 700 mov(result, object); |
702 LoadImmediate(result, reinterpret_cast<intptr_t>(Object::null())); | 701 } |
703 // Check if the object is a Smi. | |
704 andi(CMPRES1, TMP, Immediate(kSmiTagMask)); | |
705 // If the object *is* a Smi, load the null object into tmp. o/w leave alone. | |
706 movz(TMP, result, CMPRES1); | |
707 // 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. | |
709 LoadClassId(result, TMP); | |
710 | |
711 LoadImmediate(TMP, kSmiCid); | |
712 // If object is a Smi, move the Smi cid into result. o/w leave alone. | |
713 movz(result, TMP, CMPRES1); | 702 movz(result, TMP, CMPRES1); |
714 // Finally, tag the result. | 703 LoadClassId(result, result); |
715 SmiTag(result); | 704 SmiTag(result); |
716 } | 705 } |
717 | 706 |
718 | 707 |
719 void Assembler::EnterFrame() { | 708 void Assembler::EnterFrame() { |
720 ASSERT(!in_delay_slot_); | 709 ASSERT(!in_delay_slot_); |
721 addiu(SP, SP, Immediate(-2 * kWordSize)); | 710 addiu(SP, SP, Immediate(-2 * kWordSize)); |
722 sw(RA, Address(SP, 1 * kWordSize)); | 711 sw(RA, Address(SP, 1 * kWordSize)); |
723 sw(FP, Address(SP, 0 * kWordSize)); | 712 sw(FP, Address(SP, 0 * kWordSize)); |
724 mov(FP, SP); | 713 mov(FP, SP); |
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1154 Emit(reinterpret_cast<int32_t>(message)); | 1143 Emit(reinterpret_cast<int32_t>(message)); |
1155 Bind(&msg); | 1144 Bind(&msg); |
1156 break_(Instr::kMsgMessageCode); | 1145 break_(Instr::kMsgMessageCode); |
1157 } | 1146 } |
1158 #endif | 1147 #endif |
1159 } | 1148 } |
1160 | 1149 |
1161 } // namespace dart | 1150 } // namespace dart |
1162 | 1151 |
1163 #endif // defined TARGET_ARCH_MIPS | 1152 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |