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 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 __ lhu(result, MemOperand(at)); | 510 __ lhu(result, MemOperand(at)); |
511 __ jmp(&done); | 511 __ jmp(&done); |
512 __ bind(&ascii); | 512 __ bind(&ascii); |
513 // Ascii string. | 513 // Ascii string. |
514 __ Addu(at, string, index); | 514 __ Addu(at, string, index); |
515 __ lbu(result, MemOperand(at)); | 515 __ lbu(result, MemOperand(at)); |
516 __ bind(&done); | 516 __ bind(&done); |
517 } | 517 } |
518 | 518 |
519 | 519 |
| 520 void SeqStringSetCharGenerator::Generate(MacroAssembler* masm, |
| 521 String::Encoding encoding, |
| 522 Register string, |
| 523 Register index, |
| 524 Register value) { |
| 525 if (FLAG_debug_code) { |
| 526 __ And(at, index, Operand(kSmiTagMask)); |
| 527 __ Check(eq, "Non-smi index", at, Operand(zero_reg)); |
| 528 __ And(at, value, Operand(kSmiTagMask)); |
| 529 __ Check(eq, "Non-smi value", at, Operand(zero_reg)); |
| 530 |
| 531 __ lw(at, FieldMemOperand(string, String::kLengthOffset)); |
| 532 __ Check(lt, "Index is too large", at, Operand(index)); |
| 533 |
| 534 __ Check(ge, "Index is negative", index, Operand(Smi::FromInt(0))); |
| 535 |
| 536 __ lw(at, FieldMemOperand(string, HeapObject::kMapOffset)); |
| 537 __ lbu(at, FieldMemOperand(at, Map::kInstanceTypeOffset)); |
| 538 |
| 539 __ And(at, at, Operand(kStringRepresentationMask | kStringEncodingMask)); |
| 540 static const uint32_t one_byte_seq_type = kSeqStringTag | kOneByteStringTag; |
| 541 static const uint32_t two_byte_seq_type = kSeqStringTag | kTwoByteStringTag; |
| 542 __ Check(eq, "Unexpected string type", at, |
| 543 Operand(encoding == String::ONE_BYTE_ENCODING |
| 544 ? one_byte_seq_type : two_byte_seq_type)); |
| 545 } |
| 546 |
| 547 __ Addu(at, |
| 548 string, |
| 549 Operand(SeqString::kHeaderSize - kHeapObjectTag)); |
| 550 __ SmiUntag(value); |
| 551 STATIC_ASSERT(kSmiTagSize == 1 && kSmiTag == 0); |
| 552 if (encoding == String::ONE_BYTE_ENCODING) { |
| 553 __ SmiUntag(index); |
| 554 __ Addu(at, at, index); |
| 555 __ sb(value, MemOperand(at)); |
| 556 } else { |
| 557 // No need to untag a smi for two-byte addressing. |
| 558 __ Addu(at, at, index); |
| 559 __ sh(value, MemOperand(at)); |
| 560 } |
| 561 } |
| 562 |
| 563 |
520 static MemOperand ExpConstant(int index, Register base) { | 564 static MemOperand ExpConstant(int index, Register base) { |
521 return MemOperand(base, index * kDoubleSize); | 565 return MemOperand(base, index * kDoubleSize); |
522 } | 566 } |
523 | 567 |
524 | 568 |
525 void MathExpGenerator::EmitMathExp(MacroAssembler* masm, | 569 void MathExpGenerator::EmitMathExp(MacroAssembler* masm, |
526 DoubleRegister input, | 570 DoubleRegister input, |
527 DoubleRegister result, | 571 DoubleRegister result, |
528 DoubleRegister double_scratch1, | 572 DoubleRegister double_scratch1, |
529 DoubleRegister double_scratch2, | 573 DoubleRegister double_scratch2, |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
660 patcher.masm()->dd(reinterpret_cast<uint32_t>(stub->instruction_start())); | 704 patcher.masm()->dd(reinterpret_cast<uint32_t>(stub->instruction_start())); |
661 } | 705 } |
662 } | 706 } |
663 | 707 |
664 | 708 |
665 #undef __ | 709 #undef __ |
666 | 710 |
667 } } // namespace v8::internal | 711 } } // namespace v8::internal |
668 | 712 |
669 #endif // V8_TARGET_ARCH_MIPS | 713 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |