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 2060 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2071 STATIC_ASSERT(kCharSize == 1); | 2071 STATIC_ASSERT(kCharSize == 1); |
2072 return FieldOperand(string, SeqString::kHeaderSize + offset); | 2072 return FieldOperand(string, SeqString::kHeaderSize + offset); |
2073 } | 2073 } |
2074 return FieldOperand( | 2074 return FieldOperand( |
2075 string, ToRegister(index), | 2075 string, ToRegister(index), |
2076 encoding == String::ONE_BYTE_ENCODING ? times_1 : times_2, | 2076 encoding == String::ONE_BYTE_ENCODING ? times_1 : times_2, |
2077 SeqString::kHeaderSize); | 2077 SeqString::kHeaderSize); |
2078 } | 2078 } |
2079 | 2079 |
2080 | 2080 |
| 2081 void LCodeGen::DoSeqStringGetChar(LSeqStringGetChar* instr) { |
| 2082 String::Encoding encoding = instr->hydrogen()->encoding(); |
| 2083 Register result = ToRegister(instr->result()); |
| 2084 Register string = ToRegister(instr->string()); |
| 2085 |
| 2086 if (FLAG_debug_code) { |
| 2087 __ push(string); |
| 2088 __ mov(string, FieldOperand(string, HeapObject::kMapOffset)); |
| 2089 __ movzx_b(string, FieldOperand(string, Map::kInstanceTypeOffset)); |
| 2090 |
| 2091 __ and_(string, Immediate(kStringRepresentationMask | kStringEncodingMask)); |
| 2092 static const uint32_t one_byte_seq_type = kSeqStringTag | kOneByteStringTag; |
| 2093 static const uint32_t two_byte_seq_type = kSeqStringTag | kTwoByteStringTag; |
| 2094 __ cmp(string, Immediate(encoding == String::ONE_BYTE_ENCODING |
| 2095 ? one_byte_seq_type : two_byte_seq_type)); |
| 2096 __ Check(equal, kUnexpectedStringType); |
| 2097 __ pop(string); |
| 2098 } |
| 2099 |
| 2100 Operand operand = BuildSeqStringOperand(string, instr->index(), encoding); |
| 2101 if (encoding == String::ONE_BYTE_ENCODING) { |
| 2102 if (result.is_byte_register()) { |
| 2103 __ mov_b(result, operand); |
| 2104 } else { |
| 2105 __ movzx_b(result, operand); |
| 2106 } |
| 2107 } else { |
| 2108 __ mov_w(result, operand); |
| 2109 } |
| 2110 } |
| 2111 |
| 2112 |
2081 void LCodeGen::DoSeqStringSetChar(LSeqStringSetChar* instr) { | 2113 void LCodeGen::DoSeqStringSetChar(LSeqStringSetChar* instr) { |
2082 String::Encoding encoding = instr->hydrogen()->encoding(); | 2114 String::Encoding encoding = instr->hydrogen()->encoding(); |
2083 Register string = ToRegister(instr->string()); | 2115 Register string = ToRegister(instr->string()); |
2084 | 2116 |
2085 if (FLAG_debug_code) { | 2117 if (FLAG_debug_code) { |
2086 __ push(string); | 2118 __ push(string); |
2087 __ mov(string, FieldOperand(string, HeapObject::kMapOffset)); | 2119 __ mov(string, FieldOperand(string, HeapObject::kMapOffset)); |
2088 __ movzx_b(string, FieldOperand(string, Map::kInstanceTypeOffset)); | 2120 __ movzx_b(string, FieldOperand(string, Map::kInstanceTypeOffset)); |
2089 | 2121 |
2090 __ and_(string, Immediate(kStringRepresentationMask | kStringEncodingMask)); | 2122 __ and_(string, Immediate(kStringRepresentationMask | kStringEncodingMask)); |
(...skipping 4328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6419 FixedArray::kHeaderSize - kPointerSize)); | 6451 FixedArray::kHeaderSize - kPointerSize)); |
6420 __ bind(&done); | 6452 __ bind(&done); |
6421 } | 6453 } |
6422 | 6454 |
6423 | 6455 |
6424 #undef __ | 6456 #undef __ |
6425 | 6457 |
6426 } } // namespace v8::internal | 6458 } } // namespace v8::internal |
6427 | 6459 |
6428 #endif // V8_TARGET_ARCH_IA32 | 6460 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |