OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 Register string, | 526 Register string, |
527 Register index, | 527 Register index, |
528 Register value) { | 528 Register value) { |
529 if (FLAG_debug_code) { | 529 if (FLAG_debug_code) { |
530 __ And(at, index, Operand(kSmiTagMask)); | 530 __ And(at, index, Operand(kSmiTagMask)); |
531 __ Check(eq, "Non-smi index", at, Operand(zero_reg)); | 531 __ Check(eq, "Non-smi index", at, Operand(zero_reg)); |
532 __ And(at, value, Operand(kSmiTagMask)); | 532 __ And(at, value, Operand(kSmiTagMask)); |
533 __ Check(eq, "Non-smi value", at, Operand(zero_reg)); | 533 __ Check(eq, "Non-smi value", at, Operand(zero_reg)); |
534 | 534 |
535 __ lw(at, FieldMemOperand(string, String::kLengthOffset)); | 535 __ lw(at, FieldMemOperand(string, String::kLengthOffset)); |
536 __ Check(lt, "Index is too large", at, Operand(index)); | 536 __ Check(lt, "Index is too large", index, Operand(at)); |
537 | 537 |
538 __ Check(ge, "Index is negative", index, Operand(Smi::FromInt(0))); | 538 __ Check(ge, "Index is negative", index, Operand(zero_reg)); |
539 | 539 |
540 __ lw(at, FieldMemOperand(string, HeapObject::kMapOffset)); | 540 __ lw(at, FieldMemOperand(string, HeapObject::kMapOffset)); |
541 __ lbu(at, FieldMemOperand(at, Map::kInstanceTypeOffset)); | 541 __ lbu(at, FieldMemOperand(at, Map::kInstanceTypeOffset)); |
542 | 542 |
543 __ And(at, at, Operand(kStringRepresentationMask | kStringEncodingMask)); | 543 __ And(at, at, Operand(kStringRepresentationMask | kStringEncodingMask)); |
544 static const uint32_t one_byte_seq_type = kSeqStringTag | kOneByteStringTag; | 544 static const uint32_t one_byte_seq_type = kSeqStringTag | kOneByteStringTag; |
545 static const uint32_t two_byte_seq_type = kSeqStringTag | kTwoByteStringTag; | 545 static const uint32_t two_byte_seq_type = kSeqStringTag | kTwoByteStringTag; |
546 __ Check(eq, "Unexpected string type", at, | 546 __ Subu(at, at, Operand(encoding == String::ONE_BYTE_ENCODING |
547 Operand(encoding == String::ONE_BYTE_ENCODING | 547 ? one_byte_seq_type : two_byte_seq_type)); |
548 ? one_byte_seq_type : two_byte_seq_type)); | 548 __ Check(eq, "Unexpected string type", at, Operand(zero_reg)); |
549 } | 549 } |
550 | 550 |
551 __ Addu(at, | 551 __ Addu(at, |
552 string, | 552 string, |
553 Operand(SeqString::kHeaderSize - kHeapObjectTag)); | 553 Operand(SeqString::kHeaderSize - kHeapObjectTag)); |
554 __ SmiUntag(value); | 554 __ SmiUntag(value); |
555 STATIC_ASSERT(kSmiTagSize == 1 && kSmiTag == 0); | 555 STATIC_ASSERT(kSmiTagSize == 1 && kSmiTag == 0); |
556 if (encoding == String::ONE_BYTE_ENCODING) { | 556 if (encoding == String::ONE_BYTE_ENCODING) { |
557 __ SmiUntag(index); | 557 __ SmiUntag(index); |
558 __ Addu(at, at, index); | 558 __ Addu(at, at, index); |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
708 patcher.masm()->dd(reinterpret_cast<uint32_t>(stub->instruction_start())); | 708 patcher.masm()->dd(reinterpret_cast<uint32_t>(stub->instruction_start())); |
709 } | 709 } |
710 } | 710 } |
711 | 711 |
712 | 712 |
713 #undef __ | 713 #undef __ |
714 | 714 |
715 } } // namespace v8::internal | 715 } } // namespace v8::internal |
716 | 716 |
717 #endif // V8_TARGET_ARCH_MIPS | 717 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |