Chromium Code Reviews| 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 __ SmiUntag(value, value); | |
| 548 STATIC_ASSERT(kSmiTagSize == 1 && kSmiTag == 0); | |
| 549 if (encoding == String::ONE_BYTE_ENCODING) { | |
| 550 // Smis are tagged by left shift by 1, thus LSR by 1 to smi-untag inline. | |
|
Yang
2012/12/17 10:27:26
This comment does not apply to MIPS.
palfia
2012/12/17 18:46:55
Done.
| |
| 551 __ srl(at, index, 1); | |
|
Yang
2012/12/17 10:27:26
Isn't there a SmiUntag macro for MIPS as well?
palfia
2012/12/17 18:46:55
Done.
| |
| 552 __ Addu(at, at, string); | |
| 553 __ Addu(at, | |
| 554 at, | |
| 555 Operand(SeqString::kHeaderSize - kHeapObjectTag)); | |
| 556 __ sb(value, MemOperand(at)); | |
| 557 } else { | |
| 558 // No need to untag a smi for two-byte addressing. | |
| 559 __ Addu(at, | |
| 560 string, | |
| 561 Operand(SeqString::kHeaderSize - kHeapObjectTag)); | |
| 562 __ Addu(at, at, index); | |
| 563 __ sh(value, MemOperand(at)); | |
| 564 } | |
| 565 } | |
| 566 | |
| 567 | |
| 520 static MemOperand ExpConstant(int index, Register base) { | 568 static MemOperand ExpConstant(int index, Register base) { |
| 521 return MemOperand(base, index * kDoubleSize); | 569 return MemOperand(base, index * kDoubleSize); |
| 522 } | 570 } |
| 523 | 571 |
| 524 | 572 |
| 525 void MathExpGenerator::EmitMathExp(MacroAssembler* masm, | 573 void MathExpGenerator::EmitMathExp(MacroAssembler* masm, |
| 526 DoubleRegister input, | 574 DoubleRegister input, |
| 527 DoubleRegister result, | 575 DoubleRegister result, |
| 528 DoubleRegister double_scratch1, | 576 DoubleRegister double_scratch1, |
| 529 DoubleRegister double_scratch2, | 577 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())); | 708 patcher.masm()->dd(reinterpret_cast<uint32_t>(stub->instruction_start())); |
| 661 } | 709 } |
| 662 } | 710 } |
| 663 | 711 |
| 664 | 712 |
| 665 #undef __ | 713 #undef __ |
| 666 | 714 |
| 667 } } // namespace v8::internal | 715 } } // namespace v8::internal |
| 668 | 716 |
| 669 #endif // V8_TARGET_ARCH_MIPS | 717 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |