| 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_MIPS | 5 #if V8_TARGET_ARCH_MIPS |
| 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/base/bits.h" | 9 #include "src/base/bits.h" |
| 10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
| (...skipping 2189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2200 __ push(code_); | 2200 __ push(code_); |
| 2201 __ CallRuntime(Runtime::kStringCharFromCode); | 2201 __ CallRuntime(Runtime::kStringCharFromCode); |
| 2202 __ Move(result_, v0); | 2202 __ Move(result_, v0); |
| 2203 | 2203 |
| 2204 call_helper.AfterCall(masm); | 2204 call_helper.AfterCall(masm); |
| 2205 __ Branch(&exit_); | 2205 __ Branch(&exit_); |
| 2206 | 2206 |
| 2207 __ Abort(kUnexpectedFallthroughFromCharFromCodeSlowCase); | 2207 __ Abort(kUnexpectedFallthroughFromCharFromCodeSlowCase); |
| 2208 } | 2208 } |
| 2209 | 2209 |
| 2210 | |
| 2211 enum CopyCharactersFlags { COPY_ONE_BYTE = 1, DEST_ALWAYS_ALIGNED = 2 }; | |
| 2212 | |
| 2213 | |
| 2214 void StringHelper::GenerateCopyCharacters(MacroAssembler* masm, | |
| 2215 Register dest, | |
| 2216 Register src, | |
| 2217 Register count, | |
| 2218 Register scratch, | |
| 2219 String::Encoding encoding) { | |
| 2220 if (FLAG_debug_code) { | |
| 2221 // Check that destination is word aligned. | |
| 2222 __ And(scratch, dest, Operand(kPointerAlignmentMask)); | |
| 2223 __ Check(eq, | |
| 2224 kDestinationOfCopyNotAligned, | |
| 2225 scratch, | |
| 2226 Operand(zero_reg)); | |
| 2227 } | |
| 2228 | |
| 2229 // Assumes word reads and writes are little endian. | |
| 2230 // Nothing to do for zero characters. | |
| 2231 Label done; | |
| 2232 | |
| 2233 if (encoding == String::TWO_BYTE_ENCODING) { | |
| 2234 __ Addu(count, count, count); | |
| 2235 } | |
| 2236 | |
| 2237 Register limit = count; // Read until dest equals this. | |
| 2238 __ Addu(limit, dest, Operand(count)); | |
| 2239 | |
| 2240 Label loop_entry, loop; | |
| 2241 // Copy bytes from src to dest until dest hits limit. | |
| 2242 __ Branch(&loop_entry); | |
| 2243 __ bind(&loop); | |
| 2244 __ lbu(scratch, MemOperand(src)); | |
| 2245 __ Addu(src, src, Operand(1)); | |
| 2246 __ sb(scratch, MemOperand(dest)); | |
| 2247 __ Addu(dest, dest, Operand(1)); | |
| 2248 __ bind(&loop_entry); | |
| 2249 __ Branch(&loop, lt, dest, Operand(limit)); | |
| 2250 | |
| 2251 __ bind(&done); | |
| 2252 } | |
| 2253 | |
| 2254 | |
| 2255 void StringHelper::GenerateFlatOneByteStringEquals( | 2210 void StringHelper::GenerateFlatOneByteStringEquals( |
| 2256 MacroAssembler* masm, Register left, Register right, Register scratch1, | 2211 MacroAssembler* masm, Register left, Register right, Register scratch1, |
| 2257 Register scratch2, Register scratch3) { | 2212 Register scratch2, Register scratch3) { |
| 2258 Register length = scratch1; | 2213 Register length = scratch1; |
| 2259 | 2214 |
| 2260 // Compare lengths. | 2215 // Compare lengths. |
| 2261 Label strings_not_equal, check_zero_length; | 2216 Label strings_not_equal, check_zero_length; |
| 2262 __ lw(length, FieldMemOperand(left, String::kLengthOffset)); | 2217 __ lw(length, FieldMemOperand(left, String::kLengthOffset)); |
| 2263 __ lw(scratch2, FieldMemOperand(right, String::kLengthOffset)); | 2218 __ lw(scratch2, FieldMemOperand(right, String::kLengthOffset)); |
| 2264 __ Branch(&check_zero_length, eq, length, Operand(scratch2)); | 2219 __ Branch(&check_zero_length, eq, length, Operand(scratch2)); |
| (...skipping 2263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4528 kStackUnwindSpace, kInvalidStackOffset, | 4483 kStackUnwindSpace, kInvalidStackOffset, |
| 4529 return_value_operand, NULL); | 4484 return_value_operand, NULL); |
| 4530 } | 4485 } |
| 4531 | 4486 |
| 4532 #undef __ | 4487 #undef __ |
| 4533 | 4488 |
| 4534 } // namespace internal | 4489 } // namespace internal |
| 4535 } // namespace v8 | 4490 } // namespace v8 |
| 4536 | 4491 |
| 4537 #endif // V8_TARGET_ARCH_MIPS | 4492 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |