OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_PPC | 5 #if V8_TARGET_ARCH_PPC |
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 2141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2152 call_helper.BeforeCall(masm); | 2152 call_helper.BeforeCall(masm); |
2153 __ push(code_); | 2153 __ push(code_); |
2154 __ CallRuntime(Runtime::kStringCharFromCode); | 2154 __ CallRuntime(Runtime::kStringCharFromCode); |
2155 __ Move(result_, r3); | 2155 __ Move(result_, r3); |
2156 call_helper.AfterCall(masm); | 2156 call_helper.AfterCall(masm); |
2157 __ b(&exit_); | 2157 __ b(&exit_); |
2158 | 2158 |
2159 __ Abort(kUnexpectedFallthroughFromCharFromCodeSlowCase); | 2159 __ Abort(kUnexpectedFallthroughFromCharFromCodeSlowCase); |
2160 } | 2160 } |
2161 | 2161 |
2162 | |
2163 enum CopyCharactersFlags { COPY_ONE_BYTE = 1, DEST_ALWAYS_ALIGNED = 2 }; | |
2164 | |
2165 | |
2166 void StringHelper::GenerateCopyCharacters(MacroAssembler* masm, Register dest, | |
2167 Register src, Register count, | |
2168 Register scratch, | |
2169 String::Encoding encoding) { | |
2170 if (FLAG_debug_code) { | |
2171 // Check that destination is word aligned. | |
2172 __ andi(r0, dest, Operand(kPointerAlignmentMask)); | |
2173 __ Check(eq, kDestinationOfCopyNotAligned, cr0); | |
2174 } | |
2175 | |
2176 // Nothing to do for zero characters. | |
2177 Label done; | |
2178 if (encoding == String::TWO_BYTE_ENCODING) { | |
2179 // double the length | |
2180 __ add(count, count, count, LeaveOE, SetRC); | |
2181 __ beq(&done, cr0); | |
2182 } else { | |
2183 __ cmpi(count, Operand::Zero()); | |
2184 __ beq(&done); | |
2185 } | |
2186 | |
2187 // Copy count bytes from src to dst. | |
2188 Label byte_loop; | |
2189 __ mtctr(count); | |
2190 __ bind(&byte_loop); | |
2191 __ lbz(scratch, MemOperand(src)); | |
2192 __ addi(src, src, Operand(1)); | |
2193 __ stb(scratch, MemOperand(dest)); | |
2194 __ addi(dest, dest, Operand(1)); | |
2195 __ bdnz(&byte_loop); | |
2196 | |
2197 __ bind(&done); | |
2198 } | |
2199 | |
2200 | |
2201 void StringHelper::GenerateFlatOneByteStringEquals(MacroAssembler* masm, | 2162 void StringHelper::GenerateFlatOneByteStringEquals(MacroAssembler* masm, |
2202 Register left, | 2163 Register left, |
2203 Register right, | 2164 Register right, |
2204 Register scratch1, | 2165 Register scratch1, |
2205 Register scratch2) { | 2166 Register scratch2) { |
2206 Register length = scratch1; | 2167 Register length = scratch1; |
2207 | 2168 |
2208 // Compare lengths. | 2169 // Compare lengths. |
2209 Label strings_not_equal, check_zero_length; | 2170 Label strings_not_equal, check_zero_length; |
2210 __ LoadP(length, FieldMemOperand(left, String::kLengthOffset)); | 2171 __ LoadP(length, FieldMemOperand(left, String::kLengthOffset)); |
(...skipping 2363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4574 fp, (PropertyCallbackArguments::kReturnValueOffset + 3) * kPointerSize); | 4535 fp, (PropertyCallbackArguments::kReturnValueOffset + 3) * kPointerSize); |
4575 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, | 4536 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, |
4576 kStackUnwindSpace, NULL, return_value_operand, NULL); | 4537 kStackUnwindSpace, NULL, return_value_operand, NULL); |
4577 } | 4538 } |
4578 | 4539 |
4579 #undef __ | 4540 #undef __ |
4580 } // namespace internal | 4541 } // namespace internal |
4581 } // namespace v8 | 4542 } // namespace v8 |
4582 | 4543 |
4583 #endif // V8_TARGET_ARCH_PPC | 4544 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |