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_S390 | 5 #if V8_TARGET_ARCH_S390 |
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 2137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2148 call_helper.BeforeCall(masm); | 2148 call_helper.BeforeCall(masm); |
2149 __ push(code_); | 2149 __ push(code_); |
2150 __ CallRuntime(Runtime::kStringCharFromCode); | 2150 __ CallRuntime(Runtime::kStringCharFromCode); |
2151 __ Move(result_, r2); | 2151 __ Move(result_, r2); |
2152 call_helper.AfterCall(masm); | 2152 call_helper.AfterCall(masm); |
2153 __ b(&exit_); | 2153 __ b(&exit_); |
2154 | 2154 |
2155 __ Abort(kUnexpectedFallthroughFromCharFromCodeSlowCase); | 2155 __ Abort(kUnexpectedFallthroughFromCharFromCodeSlowCase); |
2156 } | 2156 } |
2157 | 2157 |
2158 enum CopyCharactersFlags { COPY_ASCII = 1, DEST_ALWAYS_ALIGNED = 2 }; | |
2159 | |
2160 void StringHelper::GenerateCopyCharacters(MacroAssembler* masm, Register dest, | |
2161 Register src, Register count, | |
2162 Register scratch, | |
2163 String::Encoding encoding) { | |
2164 if (FLAG_debug_code) { | |
2165 // Check that destination is word aligned. | |
2166 __ mov(r0, Operand(kPointerAlignmentMask)); | |
2167 __ AndP(r0, dest); | |
2168 __ Check(eq, kDestinationOfCopyNotAligned, cr0); | |
2169 } | |
2170 | |
2171 // Nothing to do for zero characters. | |
2172 Label done; | |
2173 if (encoding == String::TWO_BYTE_ENCODING) { | |
2174 // double the length | |
2175 __ AddP(count, count, count); | |
2176 __ beq(&done, Label::kNear); | |
2177 } else { | |
2178 __ CmpP(count, Operand::Zero()); | |
2179 __ beq(&done, Label::kNear); | |
2180 } | |
2181 | |
2182 // Copy count bytes from src to dst. | |
2183 Label byte_loop; | |
2184 // TODO(joransiu): Convert into MVC loop | |
2185 __ bind(&byte_loop); | |
2186 __ LoadlB(scratch, MemOperand(src)); | |
2187 __ la(src, MemOperand(src, 1)); | |
2188 __ stc(scratch, MemOperand(dest)); | |
2189 __ la(dest, MemOperand(dest, 1)); | |
2190 __ BranchOnCount(count, &byte_loop); | |
2191 | |
2192 __ bind(&done); | |
2193 } | |
2194 | |
2195 | |
2196 void StringHelper::GenerateFlatOneByteStringEquals(MacroAssembler* masm, | 2158 void StringHelper::GenerateFlatOneByteStringEquals(MacroAssembler* masm, |
2197 Register left, | 2159 Register left, |
2198 Register right, | 2160 Register right, |
2199 Register scratch1, | 2161 Register scratch1, |
2200 Register scratch2) { | 2162 Register scratch2) { |
2201 Register length = scratch1; | 2163 Register length = scratch1; |
2202 | 2164 |
2203 // Compare lengths. | 2165 // Compare lengths. |
2204 Label strings_not_equal, check_zero_length; | 2166 Label strings_not_equal, check_zero_length; |
2205 __ LoadP(length, FieldMemOperand(left, String::kLengthOffset)); | 2167 __ LoadP(length, FieldMemOperand(left, String::kLengthOffset)); |
(...skipping 2298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4504 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, | 4466 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, |
4505 kStackUnwindSpace, NULL, return_value_operand, NULL); | 4467 kStackUnwindSpace, NULL, return_value_operand, NULL); |
4506 } | 4468 } |
4507 | 4469 |
4508 #undef __ | 4470 #undef __ |
4509 | 4471 |
4510 } // namespace internal | 4472 } // namespace internal |
4511 } // namespace v8 | 4473 } // namespace v8 |
4512 | 4474 |
4513 #endif // V8_TARGET_ARCH_S390 | 4475 #endif // V8_TARGET_ARCH_S390 |
OLD | NEW |