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

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

Issue 593363003: Expands the use of Immediate and Operand wrappers. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 2 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" // Needed here to get TARGET_ARCH_MIPS. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS.
6 #if defined(TARGET_ARCH_MIPS) 6 #if defined(TARGET_ARCH_MIPS)
7 7
8 #include "vm/intrinsifier.h" 8 #include "vm/intrinsifier.h"
9 9
10 #include "vm/assembler.h" 10 #include "vm/assembler.h"
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 void Intrinsifier::GrowableArraySetData(Assembler* assembler) { 207 void Intrinsifier::GrowableArraySetData(Assembler* assembler) {
208 if (FLAG_enable_type_checks) { 208 if (FLAG_enable_type_checks) {
209 return; 209 return;
210 } 210 }
211 Label fall_through; 211 Label fall_through;
212 __ lw(T1, Address(SP, 0 * kWordSize)); // Data. 212 __ lw(T1, Address(SP, 0 * kWordSize)); // Data.
213 // Check that data is an ObjectArray. 213 // Check that data is an ObjectArray.
214 __ andi(CMPRES1, T1, Immediate(kSmiTagMask)); 214 __ andi(CMPRES1, T1, Immediate(kSmiTagMask));
215 __ beq(CMPRES1, ZR, &fall_through); // Data is Smi. 215 __ beq(CMPRES1, ZR, &fall_through); // Data is Smi.
216 __ LoadClassId(CMPRES1, T1); 216 __ LoadClassId(CMPRES1, T1);
217 __ BranchNotEqual(CMPRES1, kArrayCid, &fall_through); 217 __ BranchNotEqual(CMPRES1, Immediate(kArrayCid), &fall_through);
218 __ lw(T0, Address(SP, 1 * kWordSize)); // Growable array. 218 __ lw(T0, Address(SP, 1 * kWordSize)); // Growable array.
219 __ StoreIntoObject(T0, 219 __ StoreIntoObject(T0,
220 FieldAddress(T0, GrowableObjectArray::data_offset()), 220 FieldAddress(T0, GrowableObjectArray::data_offset()),
221 T1); 221 T1);
222 __ Ret(); 222 __ Ret();
223 __ Bind(&fall_through); 223 __ Bind(&fall_through);
224 } 224 }
225 225
226 226
227 // Add an element to growable array if it doesn't need to grow, otherwise 227 // Add an element to growable array if it doesn't need to grow, otherwise
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 259
260 260
261 #define TYPED_ARRAY_ALLOCATION(type_name, cid, max_len, scale_shift) \ 261 #define TYPED_ARRAY_ALLOCATION(type_name, cid, max_len, scale_shift) \
262 Label fall_through; \ 262 Label fall_through; \
263 const intptr_t kArrayLengthStackOffset = 0 * kWordSize; \ 263 const intptr_t kArrayLengthStackOffset = 0 * kWordSize; \
264 __ lw(T2, Address(SP, kArrayLengthStackOffset)); /* Array length. */ \ 264 __ lw(T2, Address(SP, kArrayLengthStackOffset)); /* Array length. */ \
265 /* Check that length is a positive Smi. */ \ 265 /* Check that length is a positive Smi. */ \
266 /* T2: requested array length argument. */ \ 266 /* T2: requested array length argument. */ \
267 __ andi(CMPRES1, T2, Immediate(kSmiTagMask)); \ 267 __ andi(CMPRES1, T2, Immediate(kSmiTagMask)); \
268 __ bne(CMPRES1, ZR, &fall_through); \ 268 __ bne(CMPRES1, ZR, &fall_through); \
269 __ BranchSignedLess(T2, 0, &fall_through); \ 269 __ BranchSignedLess(T2, Immediate(0), &fall_through); \
270 __ SmiUntag(T2); \ 270 __ SmiUntag(T2); \
271 /* Check for maximum allowed length. */ \ 271 /* Check for maximum allowed length. */ \
272 /* T2: untagged array length. */ \ 272 /* T2: untagged array length. */ \
273 __ BranchSignedGreater(T2, max_len, &fall_through); \ 273 __ BranchSignedGreater(T2, Immediate(max_len), &fall_through); \
274 __ sll(T2, T2, scale_shift); \ 274 __ sll(T2, T2, scale_shift); \
275 const intptr_t fixed_size = sizeof(Raw##type_name) + kObjectAlignment - 1; \ 275 const intptr_t fixed_size = sizeof(Raw##type_name) + kObjectAlignment - 1; \
276 __ AddImmediate(T2, fixed_size); \ 276 __ AddImmediate(T2, fixed_size); \
277 __ LoadImmediate(TMP, -kObjectAlignment); \ 277 __ LoadImmediate(TMP, -kObjectAlignment); \
278 __ and_(T2, T2, TMP); \ 278 __ and_(T2, T2, TMP); \
279 Heap* heap = Isolate::Current()->heap(); \ 279 Heap* heap = Isolate::Current()->heap(); \
280 Heap::Space space = heap->SpaceForAllocation(cid); \ 280 Heap::Space space = heap->SpaceForAllocation(cid); \
281 __ LoadImmediate(V0, heap->TopAddress(space)); \ 281 __ LoadImmediate(V0, heap->TopAddress(space)); \
282 __ lw(V0, Address(V0, 0)); \ 282 __ lw(V0, Address(V0, 0)); \
283 \ 283 \
(...skipping 14 matching lines...) Expand all
298 __ LoadImmediate(T3, heap->TopAddress(space)); \ 298 __ LoadImmediate(T3, heap->TopAddress(space)); \
299 __ sw(T1, Address(T3, 0)); \ 299 __ sw(T1, Address(T3, 0)); \
300 __ AddImmediate(V0, kHeapObjectTag); \ 300 __ AddImmediate(V0, kHeapObjectTag); \
301 __ UpdateAllocationStatsWithSize(cid, T2, T4, space); \ 301 __ UpdateAllocationStatsWithSize(cid, T2, T4, space); \
302 /* Initialize the tags. */ \ 302 /* Initialize the tags. */ \
303 /* V0: new object start as a tagged pointer. */ \ 303 /* V0: new object start as a tagged pointer. */ \
304 /* T1: new object end address. */ \ 304 /* T1: new object end address. */ \
305 /* T2: allocation size. */ \ 305 /* T2: allocation size. */ \
306 { \ 306 { \
307 Label size_tag_overflow, done; \ 307 Label size_tag_overflow, done; \
308 __ BranchUnsignedGreater(T2, RawObject::SizeTag::kMaxSizeTag, \ 308 __ BranchUnsignedGreater(T2, Immediate(RawObject::SizeTag::kMaxSizeTag), \
309 &size_tag_overflow); \ 309 &size_tag_overflow); \
310 __ b(&done); \ 310 __ b(&done); \
311 __ delay_slot()->sll(T2, T2, \ 311 __ delay_slot()->sll(T2, T2, \
312 RawObject::kSizeTagPos - kObjectAlignmentLog2); \ 312 RawObject::kSizeTagPos - kObjectAlignmentLog2); \
313 \ 313 \
314 __ Bind(&size_tag_overflow); \ 314 __ Bind(&size_tag_overflow); \
315 __ mov(T2, ZR); \ 315 __ mov(T2, ZR); \
316 __ Bind(&done); \ 316 __ Bind(&done); \
317 \ 317 \
318 /* Get the class index and insert it into the tags. */ \ 318 /* Get the class index and insert it into the tags. */ \
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 533
534 TestBothArgumentsSmis(assembler, &fall_through); 534 TestBothArgumentsSmis(assembler, &fall_through);
535 __ beq(T0, ZR, &fall_through); // If b is 0, fall through. 535 __ beq(T0, ZR, &fall_through); // If b is 0, fall through.
536 536
537 __ SmiUntag(T0); 537 __ SmiUntag(T0);
538 __ SmiUntag(T1); 538 __ SmiUntag(T1);
539 __ div(T1, T0); // LO <- T1 / T0 539 __ div(T1, T0); // LO <- T1 / T0
540 __ mflo(V0); // V0 <- LO 540 __ mflo(V0); // V0 <- LO
541 // Check the corner case of dividing the 'MIN_SMI' with -1, in which case we 541 // Check the corner case of dividing the 'MIN_SMI' with -1, in which case we
542 // cannot tag the result. 542 // cannot tag the result.
543 __ BranchEqual(V0, 0x40000000, &fall_through); 543 __ BranchEqual(V0, Immediate(0x40000000), &fall_through);
544 __ Ret(); 544 __ Ret();
545 __ delay_slot()->SmiTag(V0); 545 __ delay_slot()->SmiTag(V0);
546 __ Bind(&fall_through); 546 __ Bind(&fall_through);
547 } 547 }
548 548
549 549
550 void Intrinsifier::Integer_negate(Assembler* assembler) { 550 void Intrinsifier::Integer_negate(Assembler* assembler) {
551 Label fall_through; 551 Label fall_through;
552 552
553 __ lw(T0, Address(SP, + 0 * kWordSize)); // Grabs first argument. 553 __ lw(T0, Address(SP, + 0 * kWordSize)); // Grabs first argument.
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 Integer_bitXorFromInteger(assembler); 604 Integer_bitXorFromInteger(assembler);
605 } 605 }
606 606
607 607
608 void Intrinsifier::Integer_shl(Assembler* assembler) { 608 void Intrinsifier::Integer_shl(Assembler* assembler) {
609 ASSERT(kSmiTagShift == 1); 609 ASSERT(kSmiTagShift == 1);
610 ASSERT(kSmiTag == 0); 610 ASSERT(kSmiTag == 0);
611 Label fall_through, overflow; 611 Label fall_through, overflow;
612 612
613 TestBothArgumentsSmis(assembler, &fall_through); 613 TestBothArgumentsSmis(assembler, &fall_through);
614 __ BranchUnsignedGreater(T0, Smi::RawValue(Smi::kBits), &fall_through); 614 __ BranchUnsignedGreater(
615 T0, Immediate(Smi::RawValue(Smi::kBits)), &fall_through);
615 __ SmiUntag(T0); 616 __ SmiUntag(T0);
616 617
617 // Check for overflow by shifting left and shifting back arithmetically. 618 // Check for overflow by shifting left and shifting back arithmetically.
618 // If the result is different from the original, there was overflow. 619 // If the result is different from the original, there was overflow.
619 __ sllv(TMP, T1, T0); 620 __ sllv(TMP, T1, T0);
620 __ srav(CMPRES1, TMP, T0); 621 __ srav(CMPRES1, TMP, T0);
621 __ bne(CMPRES1, T1, &overflow); 622 __ bne(CMPRES1, T1, &overflow);
622 623
623 // No overflow, result in V0. 624 // No overflow, result in V0.
624 __ Ret(); 625 __ Ret();
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 __ bne(CMPRES1, ZR, &not_smi); 666 __ bne(CMPRES1, ZR, &not_smi);
666 __ SmiUntag(reg); 667 __ SmiUntag(reg);
667 668
668 // Sign extend to 64 bit 669 // Sign extend to 64 bit
669 __ mov(res_lo, reg); 670 __ mov(res_lo, reg);
670 __ b(&done); 671 __ b(&done);
671 __ delay_slot()->sra(res_hi, reg, 31); 672 __ delay_slot()->sra(res_hi, reg, 31);
672 673
673 __ Bind(&not_smi); 674 __ Bind(&not_smi);
674 __ LoadClassId(CMPRES1, reg); 675 __ LoadClassId(CMPRES1, reg);
675 __ BranchNotEqual(CMPRES1, kMintCid, not_smi_or_mint); 676 __ BranchNotEqual(CMPRES1, Immediate(kMintCid), not_smi_or_mint);
676 677
677 // Mint. 678 // Mint.
678 __ lw(res_lo, FieldAddress(reg, Mint::value_offset())); 679 __ lw(res_lo, FieldAddress(reg, Mint::value_offset()));
679 __ lw(res_hi, FieldAddress(reg, Mint::value_offset() + kWordSize)); 680 __ lw(res_hi, FieldAddress(reg, Mint::value_offset() + kWordSize));
680 __ Bind(&done); 681 __ Bind(&done);
681 return; 682 return;
682 } 683 }
683 684
684 685
685 static void CompareIntegers(Assembler* assembler, Condition true_condition) { 686 static void CompareIntegers(Assembler* assembler, Condition true_condition) {
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
805 __ Bind(&check_for_mint); 806 __ Bind(&check_for_mint);
806 807
807 __ andi(CMPRES1, T1, Immediate(kSmiTagMask)); 808 __ andi(CMPRES1, T1, Immediate(kSmiTagMask));
808 __ bne(CMPRES1, ZR, &receiver_not_smi); // Check receiver. 809 __ bne(CMPRES1, ZR, &receiver_not_smi); // Check receiver.
809 810
810 // Left (receiver) is Smi, return false if right is not Double. 811 // Left (receiver) is Smi, return false if right is not Double.
811 // Note that an instance of Mint or Bigint never contains a value that can be 812 // Note that an instance of Mint or Bigint never contains a value that can be
812 // represented by Smi. 813 // represented by Smi.
813 814
814 __ LoadClassId(CMPRES1, T0); 815 __ LoadClassId(CMPRES1, T0);
815 __ BranchEqual(CMPRES1, kDoubleCid, &fall_through); 816 __ BranchEqual(CMPRES1, Immediate(kDoubleCid), &fall_through);
816 __ LoadObject(V0, Bool::False()); // Smi == Mint -> false. 817 __ LoadObject(V0, Bool::False()); // Smi == Mint -> false.
817 __ Ret(); 818 __ Ret();
818 819
819 __ Bind(&receiver_not_smi); 820 __ Bind(&receiver_not_smi);
820 // T1:: receiver. 821 // T1:: receiver.
821 822
822 __ LoadClassId(CMPRES1, T1); 823 __ LoadClassId(CMPRES1, T1);
823 __ BranchNotEqual(CMPRES1, kMintCid, &fall_through); 824 __ BranchNotEqual(CMPRES1, Immediate(kMintCid), &fall_through);
824 // Receiver is Mint, return false if right is Smi. 825 // Receiver is Mint, return false if right is Smi.
825 __ andi(CMPRES1, T0, Immediate(kSmiTagMask)); 826 __ andi(CMPRES1, T0, Immediate(kSmiTagMask));
826 __ bne(CMPRES1, ZR, &fall_through); 827 __ bne(CMPRES1, ZR, &fall_through);
827 __ LoadObject(V0, Bool::False()); 828 __ LoadObject(V0, Bool::False());
828 __ Ret(); 829 __ Ret();
829 // TODO(srdjan): Implement Mint == Mint comparison. 830 // TODO(srdjan): Implement Mint == Mint comparison.
830 831
831 __ Bind(&fall_through); 832 __ Bind(&fall_through);
832 } 833 }
833 834
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
903 // Check if the last argument is a double, jump to label 'is_smi' if smi 904 // Check if the last argument is a double, jump to label 'is_smi' if smi
904 // (easy to convert to double), otherwise jump to label 'not_double_smi', 905 // (easy to convert to double), otherwise jump to label 'not_double_smi',
905 // Returns the last argument in T0. 906 // Returns the last argument in T0.
906 static void TestLastArgumentIsDouble(Assembler* assembler, 907 static void TestLastArgumentIsDouble(Assembler* assembler,
907 Label* is_smi, 908 Label* is_smi,
908 Label* not_double_smi) { 909 Label* not_double_smi) {
909 __ lw(T0, Address(SP, 0 * kWordSize)); 910 __ lw(T0, Address(SP, 0 * kWordSize));
910 __ andi(CMPRES1, T0, Immediate(kSmiTagMask)); 911 __ andi(CMPRES1, T0, Immediate(kSmiTagMask));
911 __ beq(CMPRES1, ZR, is_smi); 912 __ beq(CMPRES1, ZR, is_smi);
912 __ LoadClassId(CMPRES1, T0); 913 __ LoadClassId(CMPRES1, T0);
913 __ BranchNotEqual(CMPRES1, kDoubleCid, not_double_smi); 914 __ BranchNotEqual(CMPRES1, Immediate(kDoubleCid), not_double_smi);
914 // Fall through with Double in T0. 915 // Fall through with Double in T0.
915 } 916 }
916 917
917 918
918 // Both arguments on stack, arg0 (left) is a double, arg1 (right) is of unknown 919 // Both arguments on stack, arg0 (left) is a double, arg1 (right) is of unknown
919 // type. Return true or false object in the register V0. Any NaN argument 920 // type. Return true or false object in the register V0. Any NaN argument
920 // returns false. Any non-double arg1 causes control flow to fall through to the 921 // returns false. Any non-double arg1 causes control flow to fall through to the
921 // slow case (compiled method body). 922 // slow case (compiled method body).
922 static void CompareDoubles(Assembler* assembler, Condition true_condition) { 923 static void CompareDoubles(Assembler* assembler, Condition true_condition) {
923 Label is_smi, double_op, no_NaN, fall_through; 924 Label is_smi, double_op, no_NaN, fall_through;
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
1262 __ lw(T1, Address(SP, 0 * kWordSize)); // Index. 1263 __ lw(T1, Address(SP, 0 * kWordSize)); // Index.
1263 __ lw(T0, Address(SP, 1 * kWordSize)); // String. 1264 __ lw(T0, Address(SP, 1 * kWordSize)); // String.
1264 1265
1265 // Checks. 1266 // Checks.
1266 __ andi(CMPRES1, T1, Immediate(kSmiTagMask)); 1267 __ andi(CMPRES1, T1, Immediate(kSmiTagMask));
1267 __ bne(T1, ZR, &fall_through); // Index is not a Smi. 1268 __ bne(T1, ZR, &fall_through); // Index is not a Smi.
1268 __ lw(T2, FieldAddress(T0, String::length_offset())); // Range check. 1269 __ lw(T2, FieldAddress(T0, String::length_offset())); // Range check.
1269 // Runtime throws exception. 1270 // Runtime throws exception.
1270 __ BranchUnsignedGreaterEqual(T1, T2, &fall_through); 1271 __ BranchUnsignedGreaterEqual(T1, T2, &fall_through);
1271 __ LoadClassId(CMPRES1, T0); // Class ID check. 1272 __ LoadClassId(CMPRES1, T0); // Class ID check.
1272 __ BranchNotEqual(CMPRES1, kOneByteStringCid, &try_two_byte_string); 1273 __ BranchNotEqual(
1274 CMPRES1, Immediate(kOneByteStringCid), &try_two_byte_string);
1273 1275
1274 // Grab byte and return. 1276 // Grab byte and return.
1275 __ SmiUntag(T1); 1277 __ SmiUntag(T1);
1276 __ addu(T2, T0, T1); 1278 __ addu(T2, T0, T1);
1277 __ lbu(V0, FieldAddress(T2, OneByteString::data_offset())); 1279 __ lbu(V0, FieldAddress(T2, OneByteString::data_offset()));
1278 __ Ret(); 1280 __ Ret();
1279 __ delay_slot()->SmiTag(V0); 1281 __ delay_slot()->SmiTag(V0);
1280 1282
1281 __ Bind(&try_two_byte_string); 1283 __ Bind(&try_two_byte_string);
1282 __ BranchNotEqual(CMPRES1, kTwoByteStringCid, &fall_through); 1284 __ BranchNotEqual(CMPRES1, Immediate(kTwoByteStringCid), &fall_through);
1283 ASSERT(kSmiTagShift == 1); 1285 ASSERT(kSmiTagShift == 1);
1284 __ addu(T2, T0, T1); 1286 __ addu(T2, T0, T1);
1285 __ lhu(V0, FieldAddress(T2, TwoByteString::data_offset())); 1287 __ lhu(V0, FieldAddress(T2, TwoByteString::data_offset()));
1286 __ Ret(); 1288 __ Ret();
1287 __ delay_slot()->SmiTag(V0); 1289 __ delay_slot()->SmiTag(V0);
1288 1290
1289 __ Bind(&fall_through); 1291 __ Bind(&fall_through);
1290 } 1292 }
1291 1293
1292 1294
1293 void Intrinsifier::StringBaseCharAt(Assembler* assembler) { 1295 void Intrinsifier::StringBaseCharAt(Assembler* assembler) {
1294 Label fall_through, try_two_byte_string; 1296 Label fall_through, try_two_byte_string;
1295 1297
1296 __ lw(T1, Address(SP, 0 * kWordSize)); // Index. 1298 __ lw(T1, Address(SP, 0 * kWordSize)); // Index.
1297 __ lw(T0, Address(SP, 1 * kWordSize)); // String. 1299 __ lw(T0, Address(SP, 1 * kWordSize)); // String.
1298 1300
1299 // Checks. 1301 // Checks.
1300 __ andi(CMPRES1, T1, Immediate(kSmiTagMask)); 1302 __ andi(CMPRES1, T1, Immediate(kSmiTagMask));
1301 __ bne(T1, ZR, &fall_through); // Index is not a Smi. 1303 __ bne(T1, ZR, &fall_through); // Index is not a Smi.
1302 __ lw(T2, FieldAddress(T0, String::length_offset())); // Range check. 1304 __ lw(T2, FieldAddress(T0, String::length_offset())); // Range check.
1303 // Runtime throws exception. 1305 // Runtime throws exception.
1304 __ BranchUnsignedGreaterEqual(T1, T2, &fall_through); 1306 __ BranchUnsignedGreaterEqual(T1, T2, &fall_through);
1305 __ LoadClassId(CMPRES1, T0); // Class ID check. 1307 __ LoadClassId(CMPRES1, T0); // Class ID check.
1306 __ BranchNotEqual(CMPRES1, kOneByteStringCid, &try_two_byte_string); 1308 __ BranchNotEqual(
1309 CMPRES1, Immediate(kOneByteStringCid), &try_two_byte_string);
1307 1310
1308 // Grab byte and return. 1311 // Grab byte and return.
1309 __ SmiUntag(T1); 1312 __ SmiUntag(T1);
1310 __ addu(T2, T0, T1); 1313 __ addu(T2, T0, T1);
1311 __ lbu(T2, FieldAddress(T2, OneByteString::data_offset())); 1314 __ lbu(T2, FieldAddress(T2, OneByteString::data_offset()));
1312 __ BranchUnsignedGreaterEqual( 1315 __ BranchUnsignedGreaterEqual(
1313 T2, Symbols::kNumberOfOneCharCodeSymbols, &fall_through); 1316 T2, Immediate(Symbols::kNumberOfOneCharCodeSymbols), &fall_through);
1314 __ LoadImmediate( 1317 __ LoadImmediate(
1315 V0, reinterpret_cast<uword>(Symbols::PredefinedAddress())); 1318 V0, reinterpret_cast<uword>(Symbols::PredefinedAddress()));
1316 __ AddImmediate(V0, Symbols::kNullCharCodeSymbolOffset * kWordSize); 1319 __ AddImmediate(V0, Symbols::kNullCharCodeSymbolOffset * kWordSize);
1317 __ sll(T2, T2, 2); 1320 __ sll(T2, T2, 2);
1318 __ addu(T2, T2, V0); 1321 __ addu(T2, T2, V0);
1319 __ Ret(); 1322 __ Ret();
1320 __ delay_slot()->lw(V0, Address(T2)); 1323 __ delay_slot()->lw(V0, Address(T2));
1321 1324
1322 __ Bind(&try_two_byte_string); 1325 __ Bind(&try_two_byte_string);
1323 __ BranchNotEqual(CMPRES1, kTwoByteStringCid, &fall_through); 1326 __ BranchNotEqual(CMPRES1, Immediate(kTwoByteStringCid), &fall_through);
1324 ASSERT(kSmiTagShift == 1); 1327 ASSERT(kSmiTagShift == 1);
1325 __ addu(T2, T0, T1); 1328 __ addu(T2, T0, T1);
1326 __ lhu(T2, FieldAddress(T2, TwoByteString::data_offset())); 1329 __ lhu(T2, FieldAddress(T2, TwoByteString::data_offset()));
1327 __ BranchUnsignedGreaterEqual( 1330 __ BranchUnsignedGreaterEqual(
1328 T2, Symbols::kNumberOfOneCharCodeSymbols, &fall_through); 1331 T2, Immediate(Symbols::kNumberOfOneCharCodeSymbols), &fall_through);
1329 __ LoadImmediate(V0, 1332 __ LoadImmediate(V0,
1330 reinterpret_cast<uword>(Symbols::PredefinedAddress())); 1333 reinterpret_cast<uword>(Symbols::PredefinedAddress()));
1331 __ AddImmediate(V0, Symbols::kNullCharCodeSymbolOffset * kWordSize); 1334 __ AddImmediate(V0, Symbols::kNullCharCodeSymbolOffset * kWordSize);
1332 __ sll(T2, T2, 2); 1335 __ sll(T2, T2, 2);
1333 __ addu(T2, T2, V0); 1336 __ addu(T2, T2, V0);
1334 __ Ret(); 1337 __ Ret();
1335 __ delay_slot()->lw(V0, Address(T2)); 1338 __ delay_slot()->lw(V0, Address(T2));
1336 1339
1337 __ Bind(&fall_through); 1340 __ Bind(&fall_through);
1338 } 1341 }
(...skipping 20 matching lines...) Expand all
1359 __ lw(T1, Address(SP, 0 * kWordSize)); 1362 __ lw(T1, Address(SP, 0 * kWordSize));
1360 __ lw(V0, FieldAddress(T1, String::hash_offset())); 1363 __ lw(V0, FieldAddress(T1, String::hash_offset()));
1361 __ beq(V0, ZR, &no_hash); 1364 __ beq(V0, ZR, &no_hash);
1362 __ Ret(); // Return if already computed. 1365 __ Ret(); // Return if already computed.
1363 __ Bind(&no_hash); 1366 __ Bind(&no_hash);
1364 1367
1365 __ lw(T2, FieldAddress(T1, String::length_offset())); 1368 __ lw(T2, FieldAddress(T1, String::length_offset()));
1366 1369
1367 Label done; 1370 Label done;
1368 // If the string is empty, set the hash to 1, and return. 1371 // If the string is empty, set the hash to 1, and return.
1369 __ BranchEqual(T2, Smi::RawValue(0), &done); 1372 __ BranchEqual(T2, Immediate(Smi::RawValue(0)), &done);
1370 __ delay_slot()->mov(V0, ZR); 1373 __ delay_slot()->mov(V0, ZR);
1371 1374
1372 __ SmiUntag(T2); 1375 __ SmiUntag(T2);
1373 __ AddImmediate(T3, T1, OneByteString::data_offset() - kHeapObjectTag); 1376 __ AddImmediate(T3, T1, OneByteString::data_offset() - kHeapObjectTag);
1374 __ addu(T4, T3, T2); 1377 __ addu(T4, T3, T2);
1375 // V0: Hash code, untagged integer. 1378 // V0: Hash code, untagged integer.
1376 // T1: Instance of OneByteString. 1379 // T1: Instance of OneByteString.
1377 // T2: String length, untagged integer. 1380 // T2: String length, untagged integer.
1378 // T3: String data start. 1381 // T3: String data start.
1379 // T4: String data end. 1382 // T4: String data end.
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
1463 __ UpdateAllocationStatsWithSize(cid, T2, T3, space); 1466 __ UpdateAllocationStatsWithSize(cid, T2, T3, space);
1464 1467
1465 // Initialize the tags. 1468 // Initialize the tags.
1466 // V0: new object start as a tagged pointer. 1469 // V0: new object start as a tagged pointer.
1467 // T1: new object end address. 1470 // T1: new object end address.
1468 // T2: allocation size. 1471 // T2: allocation size.
1469 { 1472 {
1470 Label overflow, done; 1473 Label overflow, done;
1471 const intptr_t shift = RawObject::kSizeTagPos - kObjectAlignmentLog2; 1474 const intptr_t shift = RawObject::kSizeTagPos - kObjectAlignmentLog2;
1472 1475
1473 __ BranchUnsignedGreater(T2, RawObject::SizeTag::kMaxSizeTag, &overflow); 1476 __ BranchUnsignedGreater(
1477 T2, Immediate(RawObject::SizeTag::kMaxSizeTag), &overflow);
1474 __ b(&done); 1478 __ b(&done);
1475 __ delay_slot()->sll(T2, T2, shift); 1479 __ delay_slot()->sll(T2, T2, shift);
1476 __ Bind(&overflow); 1480 __ Bind(&overflow);
1477 __ mov(T2, ZR); 1481 __ mov(T2, ZR);
1478 __ Bind(&done); 1482 __ Bind(&done);
1479 1483
1480 // Get the class index and insert it into the tags. 1484 // Get the class index and insert it into the tags.
1481 // T2: size and bit tags. 1485 // T2: size and bit tags.
1482 __ LoadImmediate(TMP, RawObject::ClassIdTag::encode(cid)); 1486 __ LoadImmediate(TMP, RawObject::ClassIdTag::encode(cid));
1483 __ or_(T2, T2, TMP); 1487 __ or_(T2, T2, TMP);
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
1583 __ lw(T0, Address(SP, 1 * kWordSize)); // This. 1587 __ lw(T0, Address(SP, 1 * kWordSize)); // This.
1584 __ lw(T1, Address(SP, 0 * kWordSize)); // Other. 1588 __ lw(T1, Address(SP, 0 * kWordSize)); // Other.
1585 1589
1586 // Are identical? 1590 // Are identical?
1587 __ beq(T0, T1, &is_true); 1591 __ beq(T0, T1, &is_true);
1588 1592
1589 // Is other OneByteString? 1593 // Is other OneByteString?
1590 __ andi(CMPRES1, T1, Immediate(kSmiTagMask)); 1594 __ andi(CMPRES1, T1, Immediate(kSmiTagMask));
1591 __ beq(CMPRES1, ZR, &fall_through); // Other is Smi. 1595 __ beq(CMPRES1, ZR, &fall_through); // Other is Smi.
1592 __ LoadClassId(CMPRES1, T1); // Class ID check. 1596 __ LoadClassId(CMPRES1, T1); // Class ID check.
1593 __ BranchNotEqual(CMPRES1, string_cid, &fall_through); 1597 __ BranchNotEqual(CMPRES1, Immediate(string_cid), &fall_through);
1594 1598
1595 // Have same length? 1599 // Have same length?
1596 __ lw(T2, FieldAddress(T0, String::length_offset())); 1600 __ lw(T2, FieldAddress(T0, String::length_offset()));
1597 __ lw(T3, FieldAddress(T1, String::length_offset())); 1601 __ lw(T3, FieldAddress(T1, String::length_offset()));
1598 __ bne(T2, T3, &is_false); 1602 __ bne(T2, T3, &is_false);
1599 1603
1600 // Check contents, no fall-through possible. 1604 // Check contents, no fall-through possible.
1601 ASSERT((string_cid == kOneByteStringCid) || 1605 ASSERT((string_cid == kOneByteStringCid) ||
1602 (string_cid == kTwoByteStringCid)); 1606 (string_cid == kTwoByteStringCid));
1603 __ SmiUntag(T2); 1607 __ SmiUntag(T2);
1604 __ Bind(&loop); 1608 __ Bind(&loop);
1605 __ AddImmediate(T2, -1); 1609 __ AddImmediate(T2, -1);
1606 __ BranchSignedLess(T2, 0, &is_true); 1610 __ BranchSignedLess(T2, Immediate(0), &is_true);
1607 if (string_cid == kOneByteStringCid) { 1611 if (string_cid == kOneByteStringCid) {
1608 __ lbu(V0, FieldAddress(T0, OneByteString::data_offset())); 1612 __ lbu(V0, FieldAddress(T0, OneByteString::data_offset()));
1609 __ lbu(V1, FieldAddress(T1, OneByteString::data_offset())); 1613 __ lbu(V1, FieldAddress(T1, OneByteString::data_offset()));
1610 __ AddImmediate(T0, 1); 1614 __ AddImmediate(T0, 1);
1611 __ AddImmediate(T1, 1); 1615 __ AddImmediate(T1, 1);
1612 } else if (string_cid == kTwoByteStringCid) { 1616 } else if (string_cid == kTwoByteStringCid) {
1613 __ lhu(V0, FieldAddress(T0, OneByteString::data_offset())); 1617 __ lhu(V0, FieldAddress(T0, OneByteString::data_offset()));
1614 __ lhu(V1, FieldAddress(T1, OneByteString::data_offset())); 1618 __ lhu(V1, FieldAddress(T1, OneByteString::data_offset()));
1615 __ AddImmediate(T0, 2); 1619 __ AddImmediate(T0, 2);
1616 __ AddImmediate(T1, 2); 1620 __ AddImmediate(T1, 2);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
1675 Isolate* isolate = Isolate::Current(); 1679 Isolate* isolate = Isolate::Current();
1676 __ LoadImmediate(V0, reinterpret_cast<uword>(isolate)); 1680 __ LoadImmediate(V0, reinterpret_cast<uword>(isolate));
1677 // Set return value. 1681 // Set return value.
1678 __ Ret(); 1682 __ Ret();
1679 __ delay_slot()->lw(V0, Address(V0, Isolate::current_tag_offset())); 1683 __ delay_slot()->lw(V0, Address(V0, Isolate::current_tag_offset()));
1680 } 1684 }
1681 1685
1682 } // namespace dart 1686 } // namespace dart
1683 1687
1684 #endif // defined TARGET_ARCH_MIPS 1688 #endif // defined TARGET_ARCH_MIPS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698