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_ARM | 5 #if V8_TARGET_ARCH_ARM |
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 2046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2057 call_helper.BeforeCall(masm); | 2057 call_helper.BeforeCall(masm); |
2058 __ push(code_); | 2058 __ push(code_); |
2059 __ CallRuntime(Runtime::kStringCharFromCode); | 2059 __ CallRuntime(Runtime::kStringCharFromCode); |
2060 __ Move(result_, r0); | 2060 __ Move(result_, r0); |
2061 call_helper.AfterCall(masm); | 2061 call_helper.AfterCall(masm); |
2062 __ jmp(&exit_); | 2062 __ jmp(&exit_); |
2063 | 2063 |
2064 __ Abort(kUnexpectedFallthroughFromCharFromCodeSlowCase); | 2064 __ Abort(kUnexpectedFallthroughFromCharFromCodeSlowCase); |
2065 } | 2065 } |
2066 | 2066 |
2067 | |
2068 enum CopyCharactersFlags { COPY_ONE_BYTE = 1, DEST_ALWAYS_ALIGNED = 2 }; | |
2069 | |
2070 | |
2071 void StringHelper::GenerateCopyCharacters(MacroAssembler* masm, | |
2072 Register dest, | |
2073 Register src, | |
2074 Register count, | |
2075 Register scratch, | |
2076 String::Encoding encoding) { | |
2077 if (FLAG_debug_code) { | |
2078 // Check that destination is word aligned. | |
2079 __ tst(dest, Operand(kPointerAlignmentMask)); | |
2080 __ Check(eq, kDestinationOfCopyNotAligned); | |
2081 } | |
2082 | |
2083 // Assumes word reads and writes are little endian. | |
2084 // Nothing to do for zero characters. | |
2085 Label done; | |
2086 if (encoding == String::TWO_BYTE_ENCODING) { | |
2087 __ add(count, count, Operand(count), SetCC); | |
2088 } | |
2089 | |
2090 Register limit = count; // Read until dest equals this. | |
2091 __ add(limit, dest, Operand(count)); | |
2092 | |
2093 Label loop_entry, loop; | |
2094 // Copy bytes from src to dest until dest hits limit. | |
2095 __ b(&loop_entry); | |
2096 __ bind(&loop); | |
2097 __ ldrb(scratch, MemOperand(src, 1, PostIndex), lt); | |
2098 __ strb(scratch, MemOperand(dest, 1, PostIndex)); | |
2099 __ bind(&loop_entry); | |
2100 __ cmp(dest, Operand(limit)); | |
2101 __ b(lt, &loop); | |
2102 | |
2103 __ bind(&done); | |
2104 } | |
2105 | |
2106 | |
2107 void StringHelper::GenerateFlatOneByteStringEquals( | 2067 void StringHelper::GenerateFlatOneByteStringEquals( |
2108 MacroAssembler* masm, Register left, Register right, Register scratch1, | 2068 MacroAssembler* masm, Register left, Register right, Register scratch1, |
2109 Register scratch2, Register scratch3) { | 2069 Register scratch2, Register scratch3) { |
2110 Register length = scratch1; | 2070 Register length = scratch1; |
2111 | 2071 |
2112 // Compare lengths. | 2072 // Compare lengths. |
2113 Label strings_not_equal, check_zero_length; | 2073 Label strings_not_equal, check_zero_length; |
2114 __ ldr(length, FieldMemOperand(left, String::kLengthOffset)); | 2074 __ ldr(length, FieldMemOperand(left, String::kLengthOffset)); |
2115 __ ldr(scratch2, FieldMemOperand(right, String::kLengthOffset)); | 2075 __ ldr(scratch2, FieldMemOperand(right, String::kLengthOffset)); |
2116 __ cmp(length, scratch2); | 2076 __ cmp(length, scratch2); |
(...skipping 2201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4318 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, | 4278 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, |
4319 kStackUnwindSpace, NULL, return_value_operand, NULL); | 4279 kStackUnwindSpace, NULL, return_value_operand, NULL); |
4320 } | 4280 } |
4321 | 4281 |
4322 #undef __ | 4282 #undef __ |
4323 | 4283 |
4324 } // namespace internal | 4284 } // namespace internal |
4325 } // namespace v8 | 4285 } // namespace v8 |
4326 | 4286 |
4327 #endif // V8_TARGET_ARCH_ARM | 4287 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |