OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #if V8_TARGET_ARCH_MIPS64 | 5 #if V8_TARGET_ARCH_MIPS64 |
6 | 6 |
7 #include "src/code-stubs.h" | 7 #include "src/code-stubs.h" |
8 #include "src/api-arguments.h" | 8 #include "src/api-arguments.h" |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 2192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2203 __ push(code_); | 2203 __ push(code_); |
2204 __ CallRuntime(Runtime::kStringCharFromCode); | 2204 __ CallRuntime(Runtime::kStringCharFromCode); |
2205 __ Move(result_, v0); | 2205 __ Move(result_, v0); |
2206 | 2206 |
2207 call_helper.AfterCall(masm); | 2207 call_helper.AfterCall(masm); |
2208 __ Branch(&exit_); | 2208 __ Branch(&exit_); |
2209 | 2209 |
2210 __ Abort(kUnexpectedFallthroughFromCharFromCodeSlowCase); | 2210 __ Abort(kUnexpectedFallthroughFromCharFromCodeSlowCase); |
2211 } | 2211 } |
2212 | 2212 |
2213 | |
2214 enum CopyCharactersFlags { COPY_ONE_BYTE = 1, DEST_ALWAYS_ALIGNED = 2 }; | |
2215 | |
2216 | |
2217 void StringHelper::GenerateCopyCharacters(MacroAssembler* masm, | |
2218 Register dest, | |
2219 Register src, | |
2220 Register count, | |
2221 Register scratch, | |
2222 String::Encoding encoding) { | |
2223 if (FLAG_debug_code) { | |
2224 // Check that destination is word aligned. | |
2225 __ And(scratch, dest, Operand(kPointerAlignmentMask)); | |
2226 __ Check(eq, | |
2227 kDestinationOfCopyNotAligned, | |
2228 scratch, | |
2229 Operand(zero_reg)); | |
2230 } | |
2231 | |
2232 // Assumes word reads and writes are little endian. | |
2233 // Nothing to do for zero characters. | |
2234 Label done; | |
2235 | |
2236 if (encoding == String::TWO_BYTE_ENCODING) { | |
2237 __ Daddu(count, count, count); | |
2238 } | |
2239 | |
2240 Register limit = count; // Read until dest equals this. | |
2241 __ Daddu(limit, dest, Operand(count)); | |
2242 | |
2243 Label loop_entry, loop; | |
2244 // Copy bytes from src to dest until dest hits limit. | |
2245 __ Branch(&loop_entry); | |
2246 __ bind(&loop); | |
2247 __ lbu(scratch, MemOperand(src)); | |
2248 __ daddiu(src, src, 1); | |
2249 __ sb(scratch, MemOperand(dest)); | |
2250 __ daddiu(dest, dest, 1); | |
2251 __ bind(&loop_entry); | |
2252 __ Branch(&loop, lt, dest, Operand(limit)); | |
2253 | |
2254 __ bind(&done); | |
2255 } | |
2256 | |
2257 | |
2258 void StringHelper::GenerateFlatOneByteStringEquals( | 2213 void StringHelper::GenerateFlatOneByteStringEquals( |
2259 MacroAssembler* masm, Register left, Register right, Register scratch1, | 2214 MacroAssembler* masm, Register left, Register right, Register scratch1, |
2260 Register scratch2, Register scratch3) { | 2215 Register scratch2, Register scratch3) { |
2261 Register length = scratch1; | 2216 Register length = scratch1; |
2262 | 2217 |
2263 // Compare lengths. | 2218 // Compare lengths. |
2264 Label strings_not_equal, check_zero_length; | 2219 Label strings_not_equal, check_zero_length; |
2265 __ ld(length, FieldMemOperand(left, String::kLengthOffset)); | 2220 __ ld(length, FieldMemOperand(left, String::kLengthOffset)); |
2266 __ ld(scratch2, FieldMemOperand(right, String::kLengthOffset)); | 2221 __ ld(scratch2, FieldMemOperand(right, String::kLengthOffset)); |
2267 __ Branch(&check_zero_length, eq, length, Operand(scratch2)); | 2222 __ Branch(&check_zero_length, eq, length, Operand(scratch2)); |
(...skipping 2285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4553 kStackUnwindSpace, kInvalidStackOffset, | 4508 kStackUnwindSpace, kInvalidStackOffset, |
4554 return_value_operand, NULL); | 4509 return_value_operand, NULL); |
4555 } | 4510 } |
4556 | 4511 |
4557 #undef __ | 4512 #undef __ |
4558 | 4513 |
4559 } // namespace internal | 4514 } // namespace internal |
4560 } // namespace v8 | 4515 } // namespace v8 |
4561 | 4516 |
4562 #endif // V8_TARGET_ARCH_MIPS64 | 4517 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |