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 #include <limits.h> // For LONG_MIN, LONG_MAX. | 5 #include <limits.h> // For LONG_MIN, LONG_MAX. |
6 | 6 |
7 #if V8_TARGET_ARCH_ARM | 7 #if V8_TARGET_ARCH_ARM |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/base/division-by-constant.h" | 10 #include "src/base/division-by-constant.h" |
(...skipping 2188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2199 source = result_end; | 2199 source = result_end; |
2200 } | 2200 } |
2201 } | 2201 } |
2202 | 2202 |
2203 // The top pointer is not updated for allocation folding dominators. | 2203 // The top pointer is not updated for allocation folding dominators. |
2204 str(result_end, MemOperand(top_address)); | 2204 str(result_end, MemOperand(top_address)); |
2205 | 2205 |
2206 add(result, result, Operand(kHeapObjectTag)); | 2206 add(result, result, Operand(kHeapObjectTag)); |
2207 } | 2207 } |
2208 | 2208 |
2209 void MacroAssembler::AllocateTwoByteString(Register result, | |
2210 Register length, | |
2211 Register scratch1, | |
2212 Register scratch2, | |
2213 Register scratch3, | |
2214 Label* gc_required) { | |
2215 // Calculate the number of bytes needed for the characters in the string while | |
2216 // observing object alignment. | |
2217 DCHECK((SeqTwoByteString::kHeaderSize & kObjectAlignmentMask) == 0); | |
2218 mov(scratch1, Operand(length, LSL, 1)); // Length in bytes, not chars. | |
2219 add(scratch1, scratch1, | |
2220 Operand(kObjectAlignmentMask + SeqTwoByteString::kHeaderSize)); | |
2221 and_(scratch1, scratch1, Operand(~kObjectAlignmentMask)); | |
2222 | |
2223 // Allocate two-byte string in new space. | |
2224 Allocate(scratch1, result, scratch2, scratch3, gc_required, | |
2225 NO_ALLOCATION_FLAGS); | |
2226 | |
2227 // Set the map, length and hash field. | |
2228 InitializeNewString(result, | |
2229 length, | |
2230 Heap::kStringMapRootIndex, | |
2231 scratch1, | |
2232 scratch2); | |
2233 } | |
2234 | |
2235 | |
2236 void MacroAssembler::AllocateOneByteString(Register result, Register length, | |
2237 Register scratch1, Register scratch2, | |
2238 Register scratch3, | |
2239 Label* gc_required) { | |
2240 // Calculate the number of bytes needed for the characters in the string while | |
2241 // observing object alignment. | |
2242 DCHECK((SeqOneByteString::kHeaderSize & kObjectAlignmentMask) == 0); | |
2243 DCHECK(kCharSize == 1); | |
2244 add(scratch1, length, | |
2245 Operand(kObjectAlignmentMask + SeqOneByteString::kHeaderSize)); | |
2246 and_(scratch1, scratch1, Operand(~kObjectAlignmentMask)); | |
2247 | |
2248 // Allocate one-byte string in new space. | |
2249 Allocate(scratch1, result, scratch2, scratch3, gc_required, | |
2250 NO_ALLOCATION_FLAGS); | |
2251 | |
2252 // Set the map, length and hash field. | |
2253 InitializeNewString(result, length, Heap::kOneByteStringMapRootIndex, | |
2254 scratch1, scratch2); | |
2255 } | |
2256 | |
2257 | |
2258 void MacroAssembler::AllocateTwoByteConsString(Register result, | |
2259 Register length, | |
2260 Register scratch1, | |
2261 Register scratch2, | |
2262 Label* gc_required) { | |
2263 Allocate(ConsString::kSize, result, scratch1, scratch2, gc_required, | |
2264 NO_ALLOCATION_FLAGS); | |
2265 | |
2266 InitializeNewString(result, | |
2267 length, | |
2268 Heap::kConsStringMapRootIndex, | |
2269 scratch1, | |
2270 scratch2); | |
2271 } | |
2272 | |
2273 | |
2274 void MacroAssembler::AllocateOneByteConsString(Register result, Register length, | |
2275 Register scratch1, | |
2276 Register scratch2, | |
2277 Label* gc_required) { | |
2278 Allocate(ConsString::kSize, result, scratch1, scratch2, gc_required, | |
2279 NO_ALLOCATION_FLAGS); | |
2280 | |
2281 InitializeNewString(result, length, Heap::kConsOneByteStringMapRootIndex, | |
2282 scratch1, scratch2); | |
2283 } | |
2284 | |
2285 | |
2286 void MacroAssembler::AllocateTwoByteSlicedString(Register result, | |
2287 Register length, | |
2288 Register scratch1, | |
2289 Register scratch2, | |
2290 Label* gc_required) { | |
2291 Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required, | |
2292 NO_ALLOCATION_FLAGS); | |
2293 | |
2294 InitializeNewString(result, | |
2295 length, | |
2296 Heap::kSlicedStringMapRootIndex, | |
2297 scratch1, | |
2298 scratch2); | |
2299 } | |
2300 | |
2301 | |
2302 void MacroAssembler::AllocateOneByteSlicedString(Register result, | |
2303 Register length, | |
2304 Register scratch1, | |
2305 Register scratch2, | |
2306 Label* gc_required) { | |
2307 Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required, | |
2308 NO_ALLOCATION_FLAGS); | |
2309 | |
2310 InitializeNewString(result, length, Heap::kSlicedOneByteStringMapRootIndex, | |
2311 scratch1, scratch2); | |
2312 } | |
2313 | |
2314 | |
2315 void MacroAssembler::CompareObjectType(Register object, | 2209 void MacroAssembler::CompareObjectType(Register object, |
2316 Register map, | 2210 Register map, |
2317 Register type_reg, | 2211 Register type_reg, |
2318 InstanceType type) { | 2212 InstanceType type) { |
2319 const Register temp = type_reg.is(no_reg) ? ip : type_reg; | 2213 const Register temp = type_reg.is(no_reg) ? ip : type_reg; |
2320 | 2214 |
2321 ldr(map, FieldMemOperand(object, HeapObject::kMapOffset)); | 2215 ldr(map, FieldMemOperand(object, HeapObject::kMapOffset)); |
2322 CompareInstanceType(map, temp, type); | 2216 CompareInstanceType(map, temp, type); |
2323 } | 2217 } |
2324 | 2218 |
(...skipping 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3340 const int kFlatOneByteStringTag = | 3234 const int kFlatOneByteStringTag = |
3341 kStringTag | kOneByteStringTag | kSeqStringTag; | 3235 kStringTag | kOneByteStringTag | kSeqStringTag; |
3342 and_(scratch1, first, Operand(kFlatOneByteStringMask)); | 3236 and_(scratch1, first, Operand(kFlatOneByteStringMask)); |
3343 and_(scratch2, second, Operand(kFlatOneByteStringMask)); | 3237 and_(scratch2, second, Operand(kFlatOneByteStringMask)); |
3344 cmp(scratch1, Operand(kFlatOneByteStringTag)); | 3238 cmp(scratch1, Operand(kFlatOneByteStringTag)); |
3345 // Ignore second test if first test failed. | 3239 // Ignore second test if first test failed. |
3346 cmp(scratch2, Operand(kFlatOneByteStringTag), eq); | 3240 cmp(scratch2, Operand(kFlatOneByteStringTag), eq); |
3347 b(ne, failure); | 3241 b(ne, failure); |
3348 } | 3242 } |
3349 | 3243 |
3350 | |
3351 void MacroAssembler::JumpIfInstanceTypeIsNotSequentialOneByte(Register type, | |
3352 Register scratch, | |
3353 Label* failure) { | |
3354 const int kFlatOneByteStringMask = | |
3355 kIsNotStringMask | kStringEncodingMask | kStringRepresentationMask; | |
3356 const int kFlatOneByteStringTag = | |
3357 kStringTag | kOneByteStringTag | kSeqStringTag; | |
3358 and_(scratch, type, Operand(kFlatOneByteStringMask)); | |
3359 cmp(scratch, Operand(kFlatOneByteStringTag)); | |
3360 b(ne, failure); | |
3361 } | |
3362 | |
3363 static const int kRegisterPassedArguments = 4; | 3244 static const int kRegisterPassedArguments = 4; |
3364 | 3245 |
3365 | 3246 |
3366 int MacroAssembler::CalculateStackPassedWords(int num_reg_arguments, | 3247 int MacroAssembler::CalculateStackPassedWords(int num_reg_arguments, |
3367 int num_double_arguments) { | 3248 int num_double_arguments) { |
3368 int stack_passed_words = 0; | 3249 int stack_passed_words = 0; |
3369 if (use_eabi_hardfloat()) { | 3250 if (use_eabi_hardfloat()) { |
3370 // In the hard floating point calling convention, we can use | 3251 // In the hard floating point calling convention, we can use |
3371 // all double registers to pass doubles. | 3252 // all double registers to pass doubles. |
3372 if (num_double_arguments > DoubleRegister::NumRegisters()) { | 3253 if (num_double_arguments > DoubleRegister::NumRegisters()) { |
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3891 } | 3772 } |
3892 } | 3773 } |
3893 if (mag.shift > 0) mov(result, Operand(result, ASR, mag.shift)); | 3774 if (mag.shift > 0) mov(result, Operand(result, ASR, mag.shift)); |
3894 add(result, result, Operand(dividend, LSR, 31)); | 3775 add(result, result, Operand(dividend, LSR, 31)); |
3895 } | 3776 } |
3896 | 3777 |
3897 } // namespace internal | 3778 } // namespace internal |
3898 } // namespace v8 | 3779 } // namespace v8 |
3899 | 3780 |
3900 #endif // V8_TARGET_ARCH_ARM | 3781 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |