| 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 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 Register string, | 522 Register string, |
| 523 Register index, | 523 Register index, |
| 524 Register value) { | 524 Register value) { |
| 525 if (FLAG_debug_code) { | 525 if (FLAG_debug_code) { |
| 526 __ And(at, index, Operand(kSmiTagMask)); | 526 __ And(at, index, Operand(kSmiTagMask)); |
| 527 __ Check(eq, "Non-smi index", at, Operand(zero_reg)); | 527 __ Check(eq, "Non-smi index", at, Operand(zero_reg)); |
| 528 __ And(at, value, Operand(kSmiTagMask)); | 528 __ And(at, value, Operand(kSmiTagMask)); |
| 529 __ Check(eq, "Non-smi value", at, Operand(zero_reg)); | 529 __ Check(eq, "Non-smi value", at, Operand(zero_reg)); |
| 530 | 530 |
| 531 __ lw(at, FieldMemOperand(string, String::kLengthOffset)); | 531 __ lw(at, FieldMemOperand(string, String::kLengthOffset)); |
| 532 __ Check(lt, "Index is too large", at, Operand(index)); | 532 __ Check(lt, "Index is too large", index, Operand(at)); |
| 533 | 533 |
| 534 __ Check(ge, "Index is negative", index, Operand(Smi::FromInt(0))); | 534 __ Check(ge, "Index is negative", index, Operand(zero_reg)); |
| 535 | 535 |
| 536 __ lw(at, FieldMemOperand(string, HeapObject::kMapOffset)); | 536 __ lw(at, FieldMemOperand(string, HeapObject::kMapOffset)); |
| 537 __ lbu(at, FieldMemOperand(at, Map::kInstanceTypeOffset)); | 537 __ lbu(at, FieldMemOperand(at, Map::kInstanceTypeOffset)); |
| 538 | 538 |
| 539 __ And(at, at, Operand(kStringRepresentationMask | kStringEncodingMask)); | 539 __ And(at, at, Operand(kStringRepresentationMask | kStringEncodingMask)); |
| 540 static const uint32_t one_byte_seq_type = kSeqStringTag | kOneByteStringTag; | 540 static const uint32_t one_byte_seq_type = kSeqStringTag | kOneByteStringTag; |
| 541 static const uint32_t two_byte_seq_type = kSeqStringTag | kTwoByteStringTag; | 541 static const uint32_t two_byte_seq_type = kSeqStringTag | kTwoByteStringTag; |
| 542 __ Check(eq, "Unexpected string type", at, | 542 __ Subu(at, at, Operand(encoding == String::ONE_BYTE_ENCODING |
| 543 Operand(encoding == String::ONE_BYTE_ENCODING | 543 ? one_byte_seq_type : two_byte_seq_type)); |
| 544 ? one_byte_seq_type : two_byte_seq_type)); | 544 __ Check(eq, "Unexpected string type", at, Operand(zero_reg)); |
| 545 } | 545 } |
| 546 | 546 |
| 547 __ Addu(at, | 547 __ Addu(at, |
| 548 string, | 548 string, |
| 549 Operand(SeqString::kHeaderSize - kHeapObjectTag)); | 549 Operand(SeqString::kHeaderSize - kHeapObjectTag)); |
| 550 __ SmiUntag(value); | 550 __ SmiUntag(value); |
| 551 STATIC_ASSERT(kSmiTagSize == 1 && kSmiTag == 0); | 551 STATIC_ASSERT(kSmiTagSize == 1 && kSmiTag == 0); |
| 552 if (encoding == String::ONE_BYTE_ENCODING) { | 552 if (encoding == String::ONE_BYTE_ENCODING) { |
| 553 __ SmiUntag(index); | 553 __ SmiUntag(index); |
| 554 __ Addu(at, at, index); | 554 __ Addu(at, at, index); |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 704 patcher.masm()->dd(reinterpret_cast<uint32_t>(stub->instruction_start())); | 704 patcher.masm()->dd(reinterpret_cast<uint32_t>(stub->instruction_start())); |
| 705 } | 705 } |
| 706 } | 706 } |
| 707 | 707 |
| 708 | 708 |
| 709 #undef __ | 709 #undef __ |
| 710 | 710 |
| 711 } } // namespace v8::internal | 711 } } // namespace v8::internal |
| 712 | 712 |
| 713 #endif // V8_TARGET_ARCH_MIPS | 713 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |