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