| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 1632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1643 STATIC_ASSERT(kCharSize == 1); | 1643 STATIC_ASSERT(kCharSize == 1); |
| 1644 return FieldOperand(string, SeqString::kHeaderSize + offset); | 1644 return FieldOperand(string, SeqString::kHeaderSize + offset); |
| 1645 } | 1645 } |
| 1646 return FieldOperand( | 1646 return FieldOperand( |
| 1647 string, ToRegister(index), | 1647 string, ToRegister(index), |
| 1648 encoding == String::ONE_BYTE_ENCODING ? times_1 : times_2, | 1648 encoding == String::ONE_BYTE_ENCODING ? times_1 : times_2, |
| 1649 SeqString::kHeaderSize); | 1649 SeqString::kHeaderSize); |
| 1650 } | 1650 } |
| 1651 | 1651 |
| 1652 | 1652 |
| 1653 void LCodeGen::DoSeqStringGetChar(LSeqStringGetChar* instr) { | |
| 1654 String::Encoding encoding = instr->hydrogen()->encoding(); | |
| 1655 Register result = ToRegister(instr->result()); | |
| 1656 Register string = ToRegister(instr->string()); | |
| 1657 | |
| 1658 if (FLAG_debug_code) { | |
| 1659 __ push(string); | |
| 1660 __ movq(string, FieldOperand(string, HeapObject::kMapOffset)); | |
| 1661 __ movzxbq(string, FieldOperand(string, Map::kInstanceTypeOffset)); | |
| 1662 | |
| 1663 __ andb(string, Immediate(kStringRepresentationMask | kStringEncodingMask)); | |
| 1664 static const uint32_t one_byte_seq_type = kSeqStringTag | kOneByteStringTag; | |
| 1665 static const uint32_t two_byte_seq_type = kSeqStringTag | kTwoByteStringTag; | |
| 1666 __ cmpq(string, Immediate(encoding == String::ONE_BYTE_ENCODING | |
| 1667 ? one_byte_seq_type : two_byte_seq_type)); | |
| 1668 __ Check(equal, kUnexpectedStringType); | |
| 1669 __ pop(string); | |
| 1670 } | |
| 1671 | |
| 1672 Operand operand = BuildSeqStringOperand(string, instr->index(), encoding); | |
| 1673 if (encoding == String::ONE_BYTE_ENCODING) { | |
| 1674 __ movzxbl(result, operand); | |
| 1675 } else { | |
| 1676 __ movw(result, operand); | |
| 1677 } | |
| 1678 } | |
| 1679 | |
| 1680 | |
| 1681 void LCodeGen::DoSeqStringSetChar(LSeqStringSetChar* instr) { | 1653 void LCodeGen::DoSeqStringSetChar(LSeqStringSetChar* instr) { |
| 1682 String::Encoding encoding = instr->hydrogen()->encoding(); | 1654 String::Encoding encoding = instr->hydrogen()->encoding(); |
| 1683 Register string = ToRegister(instr->string()); | 1655 Register string = ToRegister(instr->string()); |
| 1684 | 1656 |
| 1685 if (FLAG_debug_code) { | 1657 if (FLAG_debug_code) { |
| 1686 __ push(string); | 1658 __ push(string); |
| 1687 __ movq(string, FieldOperand(string, HeapObject::kMapOffset)); | 1659 __ movq(string, FieldOperand(string, HeapObject::kMapOffset)); |
| 1688 __ movzxbq(string, FieldOperand(string, Map::kInstanceTypeOffset)); | 1660 __ movzxbq(string, FieldOperand(string, Map::kInstanceTypeOffset)); |
| 1689 | 1661 |
| 1690 __ andb(string, Immediate(kStringRepresentationMask | kStringEncodingMask)); | 1662 __ andb(string, Immediate(kStringRepresentationMask | kStringEncodingMask)); |
| (...skipping 3835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5526 FixedArray::kHeaderSize - kPointerSize)); | 5498 FixedArray::kHeaderSize - kPointerSize)); |
| 5527 __ bind(&done); | 5499 __ bind(&done); |
| 5528 } | 5500 } |
| 5529 | 5501 |
| 5530 | 5502 |
| 5531 #undef __ | 5503 #undef __ |
| 5532 | 5504 |
| 5533 } } // namespace v8::internal | 5505 } } // namespace v8::internal |
| 5534 | 5506 |
| 5535 #endif // V8_TARGET_ARCH_X64 | 5507 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |