Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/mips/lithium-codegen-mips.cc

Issue 65483002: MIPS: Add new HSeqStringGetChar instruction. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/mips/lithium-mips.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1738 matching lines...) Expand 10 before | Expand all | Expand 10 after
1749 __ Addu(scratch, string, ToRegister(index)); 1749 __ Addu(scratch, string, ToRegister(index));
1750 } else { 1750 } else {
1751 STATIC_ASSERT(kUC16Size == 2); 1751 STATIC_ASSERT(kUC16Size == 2);
1752 __ sll(scratch, ToRegister(index), 1); 1752 __ sll(scratch, ToRegister(index), 1);
1753 __ Addu(scratch, string, scratch); 1753 __ Addu(scratch, string, scratch);
1754 } 1754 }
1755 return FieldMemOperand(scratch, SeqString::kHeaderSize); 1755 return FieldMemOperand(scratch, SeqString::kHeaderSize);
1756 } 1756 }
1757 1757
1758 1758
1759 void LCodeGen::DoSeqStringGetChar(LSeqStringGetChar* instr) {
1760 String::Encoding encoding = instr->hydrogen()->encoding();
1761 Register string = ToRegister(instr->string());
1762 Register result = ToRegister(instr->result());
1763
1764 if (FLAG_debug_code) {
1765 Register scratch = scratch0();
1766 __ lw(scratch, FieldMemOperand(string, HeapObject::kMapOffset));
1767 __ lbu(scratch, FieldMemOperand(scratch, Map::kInstanceTypeOffset));
1768
1769 __ And(scratch, scratch,
1770 Operand(kStringRepresentationMask | kStringEncodingMask));
1771 static const uint32_t one_byte_seq_type = kSeqStringTag | kOneByteStringTag;
1772 static const uint32_t two_byte_seq_type = kSeqStringTag | kTwoByteStringTag;
1773 __ Subu(at, scratch, Operand(encoding == String::ONE_BYTE_ENCODING
1774 ? one_byte_seq_type : two_byte_seq_type));
1775 __ Check(eq, kUnexpectedStringType, at, Operand(zero_reg));
1776 }
1777
1778 MemOperand operand = BuildSeqStringOperand(string, instr->index(), encoding);
1779 if (encoding == String::ONE_BYTE_ENCODING) {
1780 __ lbu(result, operand);
1781 } else {
1782 __ lhu(result, operand);
1783 }
1784 }
1785
1786
1759 void LCodeGen::DoSeqStringSetChar(LSeqStringSetChar* instr) { 1787 void LCodeGen::DoSeqStringSetChar(LSeqStringSetChar* instr) {
1760 String::Encoding encoding = instr->hydrogen()->encoding(); 1788 String::Encoding encoding = instr->hydrogen()->encoding();
1761 Register string = ToRegister(instr->string()); 1789 Register string = ToRegister(instr->string());
1762 Register value = ToRegister(instr->value()); 1790 Register value = ToRegister(instr->value());
1763 1791
1764 if (FLAG_debug_code) { 1792 if (FLAG_debug_code) {
1765 Register scratch = scratch0(); 1793 Register scratch = scratch0();
1766 __ lw(scratch, FieldMemOperand(string, HeapObject::kMapOffset)); 1794 __ lw(scratch, FieldMemOperand(string, HeapObject::kMapOffset));
1767 __ lbu(scratch, FieldMemOperand(scratch, Map::kInstanceTypeOffset)); 1795 __ lbu(scratch, FieldMemOperand(scratch, Map::kInstanceTypeOffset));
1768 1796
(...skipping 4054 matching lines...) Expand 10 before | Expand all | Expand 10 after
5823 __ Subu(scratch, result, scratch); 5851 __ Subu(scratch, result, scratch);
5824 __ lw(result, FieldMemOperand(scratch, 5852 __ lw(result, FieldMemOperand(scratch,
5825 FixedArray::kHeaderSize - kPointerSize)); 5853 FixedArray::kHeaderSize - kPointerSize));
5826 __ bind(&done); 5854 __ bind(&done);
5827 } 5855 }
5828 5856
5829 5857
5830 #undef __ 5858 #undef __
5831 5859
5832 } } // namespace v8::internal 5860 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/mips/lithium-mips.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698