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