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 1802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1813 } | 1813 } |
1814 | 1814 |
1815 | 1815 |
1816 void LCodeGen::DoSeqStringSetChar(LSeqStringSetChar* instr) { | 1816 void LCodeGen::DoSeqStringSetChar(LSeqStringSetChar* instr) { |
1817 String::Encoding encoding = instr->hydrogen()->encoding(); | 1817 String::Encoding encoding = instr->hydrogen()->encoding(); |
1818 Register string = ToRegister(instr->string()); | 1818 Register string = ToRegister(instr->string()); |
1819 Register value = ToRegister(instr->value()); | 1819 Register value = ToRegister(instr->value()); |
1820 | 1820 |
1821 if (FLAG_debug_code) { | 1821 if (FLAG_debug_code) { |
1822 Register scratch = scratch0(); | 1822 Register scratch = scratch0(); |
1823 __ lw(scratch, FieldMemOperand(string, HeapObject::kMapOffset)); | 1823 Register index = ToRegister(instr->index()); |
1824 __ lbu(scratch, FieldMemOperand(scratch, Map::kInstanceTypeOffset)); | |
1825 | |
1826 __ And(scratch, scratch, | |
1827 Operand(kStringRepresentationMask | kStringEncodingMask)); | |
1828 static const uint32_t one_byte_seq_type = kSeqStringTag | kOneByteStringTag; | 1824 static const uint32_t one_byte_seq_type = kSeqStringTag | kOneByteStringTag; |
1829 static const uint32_t two_byte_seq_type = kSeqStringTag | kTwoByteStringTag; | 1825 static const uint32_t two_byte_seq_type = kSeqStringTag | kTwoByteStringTag; |
1830 __ Subu(at, scratch, Operand(encoding == String::ONE_BYTE_ENCODING | 1826 int encoding_mask = |
1831 ? one_byte_seq_type : two_byte_seq_type)); | 1827 instr->hydrogen()->encoding() == String::ONE_BYTE_ENCODING |
1832 __ Check(eq, kUnexpectedStringType, at, Operand(zero_reg)); | 1828 ? one_byte_seq_type : two_byte_seq_type; |
| 1829 __ EmitSeqStringSetCharCheck(string, index, value, scratch, encoding_mask); |
1833 } | 1830 } |
1834 | 1831 |
1835 MemOperand operand = BuildSeqStringOperand(string, instr->index(), encoding); | 1832 MemOperand operand = BuildSeqStringOperand(string, instr->index(), encoding); |
1836 if (encoding == String::ONE_BYTE_ENCODING) { | 1833 if (encoding == String::ONE_BYTE_ENCODING) { |
1837 __ sb(value, operand); | 1834 __ sb(value, operand); |
1838 } else { | 1835 } else { |
1839 __ sh(value, operand); | 1836 __ sh(value, operand); |
1840 } | 1837 } |
1841 } | 1838 } |
1842 | 1839 |
(...skipping 4074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5917 __ Subu(scratch, result, scratch); | 5914 __ Subu(scratch, result, scratch); |
5918 __ lw(result, FieldMemOperand(scratch, | 5915 __ lw(result, FieldMemOperand(scratch, |
5919 FixedArray::kHeaderSize - kPointerSize)); | 5916 FixedArray::kHeaderSize - kPointerSize)); |
5920 __ bind(&done); | 5917 __ bind(&done); |
5921 } | 5918 } |
5922 | 5919 |
5923 | 5920 |
5924 #undef __ | 5921 #undef __ |
5925 | 5922 |
5926 } } // namespace v8::internal | 5923 } } // namespace v8::internal |
OLD | NEW |