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 1771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1782 __ PrepareCallCFunction(2, scratch); | 1782 __ PrepareCallCFunction(2, scratch); |
1783 __ li(a1, Operand(index)); | 1783 __ li(a1, Operand(index)); |
1784 __ CallCFunction(ExternalReference::get_date_field_function(isolate()), 2); | 1784 __ CallCFunction(ExternalReference::get_date_field_function(isolate()), 2); |
1785 __ bind(&done); | 1785 __ bind(&done); |
1786 } | 1786 } |
1787 } | 1787 } |
1788 | 1788 |
1789 | 1789 |
1790 void LCodeGen::DoSeqStringSetChar(LSeqStringSetChar* instr) { | 1790 void LCodeGen::DoSeqStringSetChar(LSeqStringSetChar* instr) { |
1791 Register string = ToRegister(instr->string()); | 1791 Register string = ToRegister(instr->string()); |
1792 LOperand* index_op = instr->index(); | 1792 Register index = ToRegister(instr->index()); |
1793 Register value = ToRegister(instr->value()); | 1793 Register value = ToRegister(instr->value()); |
1794 Register scratch = scratch0(); | 1794 Register scratch = scratch0(); |
1795 String::Encoding encoding = instr->encoding(); | 1795 String::Encoding encoding = instr->encoding(); |
1796 | 1796 |
1797 if (FLAG_debug_code) { | 1797 if (FLAG_debug_code) { |
1798 __ lw(scratch, FieldMemOperand(string, HeapObject::kMapOffset)); | 1798 __ lw(at, FieldMemOperand(string, HeapObject::kMapOffset)); |
1799 __ lbu(scratch, FieldMemOperand(scratch, Map::kInstanceTypeOffset)); | 1799 __ lbu(at, FieldMemOperand(at, Map::kInstanceTypeOffset)); |
1800 | 1800 |
1801 __ And(scratch, scratch, | 1801 __ And(at, at, Operand(kStringRepresentationMask | kStringEncodingMask)); |
1802 Operand(kStringRepresentationMask | kStringEncodingMask)); | |
1803 static const uint32_t one_byte_seq_type = kSeqStringTag | kOneByteStringTag; | 1802 static const uint32_t one_byte_seq_type = kSeqStringTag | kOneByteStringTag; |
1804 static const uint32_t two_byte_seq_type = kSeqStringTag | kTwoByteStringTag; | 1803 static const uint32_t two_byte_seq_type = kSeqStringTag | kTwoByteStringTag; |
1805 __ Subu(at, scratch, Operand(encoding == String::ONE_BYTE_ENCODING | 1804 __ Subu(at, at, Operand(encoding == String::ONE_BYTE_ENCODING |
1806 ? one_byte_seq_type : two_byte_seq_type)); | 1805 ? one_byte_seq_type : two_byte_seq_type)); |
1807 __ Check(eq, kUnexpectedStringType, at, Operand(zero_reg)); | 1806 __ Check(eq, kUnexpectedStringType, at, Operand(zero_reg)); |
1808 } | 1807 } |
1809 | 1808 |
1810 if (index_op->IsConstantOperand()) { | 1809 __ Addu(scratch, |
1811 int constant_index = ToInteger32(LConstantOperand::cast(index_op)); | 1810 string, |
1812 if (encoding == String::ONE_BYTE_ENCODING) { | 1811 Operand(SeqString::kHeaderSize - kHeapObjectTag)); |
1813 __ sb(value, | 1812 if (encoding == String::ONE_BYTE_ENCODING) { |
1814 FieldMemOperand(string, SeqString::kHeaderSize + constant_index)); | 1813 __ Addu(at, scratch, index); |
1815 } else { | 1814 __ sb(value, MemOperand(at)); |
1816 __ sh(value, | |
1817 FieldMemOperand(string, SeqString::kHeaderSize + constant_index * 2)); | |
1818 } | |
1819 } else { | 1815 } else { |
1820 Register index = ToRegister(index_op); | 1816 __ sll(at, index, 1); |
1821 if (encoding == String::ONE_BYTE_ENCODING) { | 1817 __ Addu(at, scratch, at); |
1822 __ Addu(scratch, string, Operand(index)); | 1818 __ sh(value, MemOperand(at)); |
1823 __ sb(value, FieldMemOperand(scratch, SeqString::kHeaderSize)); | |
1824 } else { | |
1825 __ sll(scratch, index, 1); | |
1826 __ Addu(scratch, string, scratch); | |
1827 __ sh(value, FieldMemOperand(scratch, SeqString::kHeaderSize)); | |
1828 } | |
1829 } | 1819 } |
1830 } | 1820 } |
1831 | 1821 |
1832 | 1822 |
1833 void LCodeGen::DoThrow(LThrow* instr) { | 1823 void LCodeGen::DoThrow(LThrow* instr) { |
1834 Register input_reg = EmitLoadRegister(instr->value(), at); | 1824 Register input_reg = EmitLoadRegister(instr->value(), at); |
1835 __ push(input_reg); | 1825 __ push(input_reg); |
1836 CallRuntime(Runtime::kThrow, 1, instr); | 1826 CallRuntime(Runtime::kThrow, 1, instr); |
1837 | 1827 |
1838 if (FLAG_debug_code) { | 1828 if (FLAG_debug_code) { |
(...skipping 3944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5783 __ Subu(scratch, result, scratch); | 5773 __ Subu(scratch, result, scratch); |
5784 __ lw(result, FieldMemOperand(scratch, | 5774 __ lw(result, FieldMemOperand(scratch, |
5785 FixedArray::kHeaderSize - kPointerSize)); | 5775 FixedArray::kHeaderSize - kPointerSize)); |
5786 __ bind(&done); | 5776 __ bind(&done); |
5787 } | 5777 } |
5788 | 5778 |
5789 | 5779 |
5790 #undef __ | 5780 #undef __ |
5791 | 5781 |
5792 } } // namespace v8::internal | 5782 } } // namespace v8::internal |
OLD | NEW |