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

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

Issue 383443002: Removes branches from LoadTaggedClassIdMayBeSmi. (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
« 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 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 Label load, done; 695 ASSERT(object != TMP);
696 andi(CMPRES1, object, Immediate(kSmiTagMask)); 696 ASSERT(result != TMP);
697 bne(CMPRES1, ZR, &load); 697
698 LoadImmediate(result, Smi::RawValue(kSmiCid)); 698 // Make a copy of object since result and object can be the same register.
699 b(&done); 699 mov(TMP, object);
700 Bind(&load); 700 // Load up a null object. We only need it so we can use LoadClassId on it in
701 LoadClassId(result, object); 701 // the case that object is a Smi.
702 LoadImmediate(result, reinterpret_cast<intptr_t>(Object::null()));
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);
714 // Finally, tag the result.
702 SmiTag(result); 715 SmiTag(result);
703 Bind(&done);
704 } 716 }
705 717
706 718
707 void Assembler::EnterFrame() { 719 void Assembler::EnterFrame() {
708 ASSERT(!in_delay_slot_); 720 ASSERT(!in_delay_slot_);
709 addiu(SP, SP, Immediate(-2 * kWordSize)); 721 addiu(SP, SP, Immediate(-2 * kWordSize));
710 sw(RA, Address(SP, 1 * kWordSize)); 722 sw(RA, Address(SP, 1 * kWordSize));
711 sw(FP, Address(SP, 0 * kWordSize)); 723 sw(FP, Address(SP, 0 * kWordSize));
712 mov(FP, SP); 724 mov(FP, SP);
713 } 725 }
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
1142 Emit(reinterpret_cast<int32_t>(message)); 1154 Emit(reinterpret_cast<int32_t>(message));
1143 Bind(&msg); 1155 Bind(&msg);
1144 break_(Instr::kMsgMessageCode); 1156 break_(Instr::kMsgMessageCode);
1145 } 1157 }
1146 #endif 1158 #endif
1147 } 1159 }
1148 1160
1149 } // namespace dart 1161 } // namespace dart
1150 1162
1151 #endif // defined TARGET_ARCH_MIPS 1163 #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