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

Side by Side Diff: src/mips/code-stubs-mips.cc

Issue 8217011: Fixing issue 1757 (string slices of external strings). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 2 months 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 | « src/ia32/code-stubs-ia32.cc ('k') | src/x64/code-stubs-x64.cc » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 5112 matching lines...) Expand 10 before | Expand all | Expand 10 after
5123 // Check whether the right hand side is the empty string (i.e. if 5123 // Check whether the right hand side is the empty string (i.e. if
5124 // this is really a flat string in a cons string). If that is not 5124 // this is really a flat string in a cons string). If that is not
5125 // the case we would rather go to the runtime system now to flatten 5125 // the case we would rather go to the runtime system now to flatten
5126 // the string. 5126 // the string.
5127 Label assure_seq_string; 5127 Label assure_seq_string;
5128 __ lw(result_, FieldMemOperand(object_, ConsString::kSecondOffset)); 5128 __ lw(result_, FieldMemOperand(object_, ConsString::kSecondOffset));
5129 __ LoadRoot(t0, Heap::kEmptyStringRootIndex); 5129 __ LoadRoot(t0, Heap::kEmptyStringRootIndex);
5130 __ Branch(&call_runtime_, ne, result_, Operand(t0)); 5130 __ Branch(&call_runtime_, ne, result_, Operand(t0));
5131 5131
5132 // Get the first of the two strings and load its instance type. 5132 // Get the first of the two strings and load its instance type.
5133 __ lw(object_, FieldMemOperand(object_, ConsString::kFirstOffset)); 5133 __ lw(result_, FieldMemOperand(object_, ConsString::kFirstOffset));
5134 __ jmp(&assure_seq_string); 5134 __ jmp(&assure_seq_string);
5135 5135
5136 // SlicedString, unpack and add offset. 5136 // SlicedString, unpack and add offset.
5137 __ bind(&sliced_string); 5137 __ bind(&sliced_string);
5138 __ lw(result_, FieldMemOperand(object_, SlicedString::kOffsetOffset)); 5138 __ lw(result_, FieldMemOperand(object_, SlicedString::kOffsetOffset));
5139 __ addu(scratch_, scratch_, result_); 5139 __ addu(scratch_, scratch_, result_);
5140 __ lw(object_, FieldMemOperand(object_, SlicedString::kParentOffset)); 5140 __ lw(result_, FieldMemOperand(object_, SlicedString::kParentOffset));
5141 5141
5142 // Assure that we are dealing with a sequential string. Go to runtime if not. 5142 // Assure that we are dealing with a sequential string. Go to runtime if not.
5143 __ bind(&assure_seq_string); 5143 __ bind(&assure_seq_string);
5144 __ lw(result_, FieldMemOperand(object_, HeapObject::kMapOffset)); 5144 __ lw(result_, FieldMemOperand(result_, HeapObject::kMapOffset));
5145 __ lbu(result_, FieldMemOperand(result_, Map::kInstanceTypeOffset)); 5145 __ lbu(result_, FieldMemOperand(result_, Map::kInstanceTypeOffset));
5146 // Check that parent is not an external string. Go to runtime otherwise. 5146 // Check that parent is not an external string. Go to runtime otherwise.
5147 STATIC_ASSERT(kSeqStringTag == 0); 5147 STATIC_ASSERT(kSeqStringTag == 0);
5148 5148
5149 __ And(t0, result_, Operand(kStringRepresentationMask)); 5149 __ And(t0, result_, Operand(kStringRepresentationMask));
5150 __ Branch(&call_runtime_, ne, t0, Operand(zero_reg)); 5150 __ Branch(&call_runtime_, ne, t0, Operand(zero_reg));
5151 // Actually fetch the parent string if it is confirmed to be sequential.
5152 STATIC_ASSERT(SlicedString::kParentOffset == ConsString::kFirstOffset);
5153 __ lw(object_, FieldMemOperand(object_, SlicedString::kParentOffset));
5151 5154
5152 // Check for 1-byte or 2-byte string. 5155 // Check for 1-byte or 2-byte string.
5153 __ bind(&flat_string); 5156 __ bind(&flat_string);
5154 STATIC_ASSERT((kStringEncodingMask & kAsciiStringTag) != 0); 5157 STATIC_ASSERT((kStringEncodingMask & kAsciiStringTag) != 0);
5155 STATIC_ASSERT((kStringEncodingMask & kTwoByteStringTag) == 0); 5158 STATIC_ASSERT((kStringEncodingMask & kTwoByteStringTag) == 0);
5156 __ And(t0, result_, Operand(kStringEncodingMask)); 5159 __ And(t0, result_, Operand(kStringEncodingMask));
5157 __ Branch(&ascii_string, ne, t0, Operand(zero_reg)); 5160 __ Branch(&ascii_string, ne, t0, Operand(zero_reg));
5158 5161
5159 // 2-byte string. 5162 // 2-byte string.
5160 // Load the 2-byte character code into the result register. We can 5163 // Load the 2-byte character code into the result register. We can
(...skipping 1859 matching lines...) Expand 10 before | Expand all | Expand 10 after
7020 __ mov(result, zero_reg); 7023 __ mov(result, zero_reg);
7021 __ Ret(); 7024 __ Ret();
7022 } 7025 }
7023 7026
7024 7027
7025 #undef __ 7028 #undef __
7026 7029
7027 } } // namespace v8::internal 7030 } } // namespace v8::internal
7028 7031
7029 #endif // V8_TARGET_ARCH_MIPS 7032 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/ia32/code-stubs-ia32.cc ('k') | src/x64/code-stubs-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698