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 __ movzx_b(result, operand); | |
2103 } else { | |
2104 __ mov_w(result, operand); | |
2105 } | |
2106 } | |
2107 | |
2108 | |
2109 void LCodeGen::DoSeqStringSetChar(LSeqStringSetChar* instr) { | 2081 void LCodeGen::DoSeqStringSetChar(LSeqStringSetChar* instr) { |
2110 String::Encoding encoding = instr->hydrogen()->encoding(); | 2082 String::Encoding encoding = instr->hydrogen()->encoding(); |
2111 Register string = ToRegister(instr->string()); | 2083 Register string = ToRegister(instr->string()); |
2112 | 2084 |
2113 if (FLAG_debug_code) { | 2085 if (FLAG_debug_code) { |
2114 __ push(string); | 2086 __ push(string); |
2115 __ mov(string, FieldOperand(string, HeapObject::kMapOffset)); | 2087 __ mov(string, FieldOperand(string, HeapObject::kMapOffset)); |
2116 __ movzx_b(string, FieldOperand(string, Map::kInstanceTypeOffset)); | 2088 __ movzx_b(string, FieldOperand(string, Map::kInstanceTypeOffset)); |
2117 | 2089 |
2118 __ and_(string, Immediate(kStringRepresentationMask | kStringEncodingMask)); | 2090 __ and_(string, Immediate(kStringRepresentationMask | kStringEncodingMask)); |
(...skipping 4328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6447 FixedArray::kHeaderSize - kPointerSize)); | 6419 FixedArray::kHeaderSize - kPointerSize)); |
6448 __ bind(&done); | 6420 __ bind(&done); |
6449 } | 6421 } |
6450 | 6422 |
6451 | 6423 |
6452 #undef __ | 6424 #undef __ |
6453 | 6425 |
6454 } } // namespace v8::internal | 6426 } } // namespace v8::internal |
6455 | 6427 |
6456 #endif // V8_TARGET_ARCH_IA32 | 6428 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |