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 2009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2020 } | 2020 } |
2021 } | 2021 } |
2022 | 2022 |
2023 | 2023 |
2024 void LCodeGen::DoSeqStringSetChar(LSeqStringSetChar* instr) { | 2024 void LCodeGen::DoSeqStringSetChar(LSeqStringSetChar* instr) { |
2025 String::Encoding encoding = instr->hydrogen()->encoding(); | 2025 String::Encoding encoding = instr->hydrogen()->encoding(); |
2026 Register string = ToRegister(instr->string()); | 2026 Register string = ToRegister(instr->string()); |
2027 Register value = ToRegister(instr->value()); | 2027 Register value = ToRegister(instr->value()); |
2028 | 2028 |
2029 if (FLAG_debug_code) { | 2029 if (FLAG_debug_code) { |
2030 Register scratch = scratch0(); | 2030 Register index = ToRegister(instr->index()); |
2031 __ ldr(scratch, FieldMemOperand(string, HeapObject::kMapOffset)); | |
2032 __ ldrb(scratch, FieldMemOperand(scratch, Map::kInstanceTypeOffset)); | |
2033 | |
2034 __ and_(scratch, scratch, | |
2035 Operand(kStringRepresentationMask | kStringEncodingMask)); | |
2036 static const uint32_t one_byte_seq_type = kSeqStringTag | kOneByteStringTag; | 2031 static const uint32_t one_byte_seq_type = kSeqStringTag | kOneByteStringTag; |
2037 static const uint32_t two_byte_seq_type = kSeqStringTag | kTwoByteStringTag; | 2032 static const uint32_t two_byte_seq_type = kSeqStringTag | kTwoByteStringTag; |
2038 __ cmp(scratch, Operand(encoding == String::ONE_BYTE_ENCODING | 2033 int encoding_mask = |
2039 ? one_byte_seq_type : two_byte_seq_type)); | 2034 instr->hydrogen()->encoding() == String::ONE_BYTE_ENCODING |
2040 __ Check(eq, kUnexpectedStringType); | 2035 ? one_byte_seq_type : two_byte_seq_type; |
| 2036 __ EmitSeqStringSetCharCheck(string, index, value, encoding_mask); |
2041 } | 2037 } |
2042 | 2038 |
2043 MemOperand operand = BuildSeqStringOperand(string, instr->index(), encoding); | 2039 MemOperand operand = BuildSeqStringOperand(string, instr->index(), encoding); |
2044 if (encoding == String::ONE_BYTE_ENCODING) { | 2040 if (encoding == String::ONE_BYTE_ENCODING) { |
2045 __ strb(value, operand); | 2041 __ strb(value, operand); |
2046 } else { | 2042 } else { |
2047 __ strh(value, operand); | 2043 __ strh(value, operand); |
2048 } | 2044 } |
2049 } | 2045 } |
2050 | 2046 |
(...skipping 3886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5937 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); | 5933 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); |
5938 __ ldr(result, FieldMemOperand(scratch, | 5934 __ ldr(result, FieldMemOperand(scratch, |
5939 FixedArray::kHeaderSize - kPointerSize)); | 5935 FixedArray::kHeaderSize - kPointerSize)); |
5940 __ bind(&done); | 5936 __ bind(&done); |
5941 } | 5937 } |
5942 | 5938 |
5943 | 5939 |
5944 #undef __ | 5940 #undef __ |
5945 | 5941 |
5946 } } // namespace v8::internal | 5942 } } // namespace v8::internal |
OLD | NEW |