| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_ARM64 | 5 #if V8_TARGET_ARCH_ARM64 |
| 6 | 6 |
| 7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
| 8 #include "src/base/division-by-constant.h" | 8 #include "src/base/division-by-constant.h" |
| 9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
| 10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
| (...skipping 2151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2162 // Squash +infinity before the conversion, since Fcvtnu will normally | 2162 // Squash +infinity before the conversion, since Fcvtnu will normally |
| 2163 // convert it to 0. | 2163 // convert it to 0. |
| 2164 Fmov(dbl_scratch, 255); | 2164 Fmov(dbl_scratch, 255); |
| 2165 Fmin(dbl_scratch, dbl_scratch, input); | 2165 Fmin(dbl_scratch, dbl_scratch, input); |
| 2166 | 2166 |
| 2167 // Convert double to unsigned integer. Values less than zero become zero. | 2167 // Convert double to unsigned integer. Values less than zero become zero. |
| 2168 // Values greater than 255 have already been clamped to 255. | 2168 // Values greater than 255 have already been clamped to 255. |
| 2169 Fcvtnu(output, dbl_scratch); | 2169 Fcvtnu(output, dbl_scratch); |
| 2170 } | 2170 } |
| 2171 | 2171 |
| 2172 | |
| 2173 void MacroAssembler::CopyBytes(Register dst, | |
| 2174 Register src, | |
| 2175 Register length, | |
| 2176 Register scratch, | |
| 2177 CopyHint hint) { | |
| 2178 UseScratchRegisterScope temps(this); | |
| 2179 Register tmp1 = temps.AcquireX(); | |
| 2180 Register tmp2 = temps.AcquireX(); | |
| 2181 DCHECK(!AreAliased(src, dst, length, scratch, tmp1, tmp2)); | |
| 2182 DCHECK(!AreAliased(src, dst, csp)); | |
| 2183 | |
| 2184 if (emit_debug_code()) { | |
| 2185 // Check copy length. | |
| 2186 Cmp(length, 0); | |
| 2187 Assert(ge, kUnexpectedNegativeValue); | |
| 2188 | |
| 2189 // Check src and dst buffers don't overlap. | |
| 2190 Add(scratch, src, length); // Calculate end of src buffer. | |
| 2191 Cmp(scratch, dst); | |
| 2192 Add(scratch, dst, length); // Calculate end of dst buffer. | |
| 2193 Ccmp(scratch, src, ZFlag, gt); | |
| 2194 Assert(le, kCopyBuffersOverlap); | |
| 2195 } | |
| 2196 | |
| 2197 Label short_copy, short_loop, bulk_loop, done; | |
| 2198 | |
| 2199 if ((hint == kCopyLong || hint == kCopyUnknown) && !FLAG_optimize_for_size) { | |
| 2200 Register bulk_length = scratch; | |
| 2201 int pair_size = 2 * kXRegSize; | |
| 2202 int pair_mask = pair_size - 1; | |
| 2203 | |
| 2204 Bic(bulk_length, length, pair_mask); | |
| 2205 Cbz(bulk_length, &short_copy); | |
| 2206 Bind(&bulk_loop); | |
| 2207 Sub(bulk_length, bulk_length, pair_size); | |
| 2208 Ldp(tmp1, tmp2, MemOperand(src, pair_size, PostIndex)); | |
| 2209 Stp(tmp1, tmp2, MemOperand(dst, pair_size, PostIndex)); | |
| 2210 Cbnz(bulk_length, &bulk_loop); | |
| 2211 | |
| 2212 And(length, length, pair_mask); | |
| 2213 } | |
| 2214 | |
| 2215 Bind(&short_copy); | |
| 2216 Cbz(length, &done); | |
| 2217 Bind(&short_loop); | |
| 2218 Sub(length, length, 1); | |
| 2219 Ldrb(tmp1, MemOperand(src, 1, PostIndex)); | |
| 2220 Strb(tmp1, MemOperand(dst, 1, PostIndex)); | |
| 2221 Cbnz(length, &short_loop); | |
| 2222 | |
| 2223 | |
| 2224 Bind(&done); | |
| 2225 } | |
| 2226 | |
| 2227 | |
| 2228 void MacroAssembler::InitializeFieldsWithFiller(Register current_address, | 2172 void MacroAssembler::InitializeFieldsWithFiller(Register current_address, |
| 2229 Register end_address, | 2173 Register end_address, |
| 2230 Register filler) { | 2174 Register filler) { |
| 2231 DCHECK(!current_address.Is(csp)); | 2175 DCHECK(!current_address.Is(csp)); |
| 2232 UseScratchRegisterScope temps(this); | 2176 UseScratchRegisterScope temps(this); |
| 2233 Register distance_in_words = temps.AcquireX(); | 2177 Register distance_in_words = temps.AcquireX(); |
| 2234 Label done; | 2178 Label done; |
| 2235 | 2179 |
| 2236 // Calculate the distance. If it's <= zero then there's nothing to do. | 2180 // Calculate the distance. If it's <= zero then there's nothing to do. |
| 2237 Subs(distance_in_words, end_address, current_address); | 2181 Subs(distance_in_words, end_address, current_address); |
| (...skipping 2824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5062 } | 5006 } |
| 5063 | 5007 |
| 5064 | 5008 |
| 5065 #undef __ | 5009 #undef __ |
| 5066 | 5010 |
| 5067 | 5011 |
| 5068 } // namespace internal | 5012 } // namespace internal |
| 5069 } // namespace v8 | 5013 } // namespace v8 |
| 5070 | 5014 |
| 5071 #endif // V8_TARGET_ARCH_ARM64 | 5015 #endif // V8_TARGET_ARCH_ARM64 |
| OLD | NEW |