| 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 3084 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3095 | 3095 |
| 3096 // Calculate new top and bail out if new space is exhausted. | 3096 // Calculate new top and bail out if new space is exhausted. |
| 3097 Adds(result_end, result, object_size); | 3097 Adds(result_end, result, object_size); |
| 3098 Ccmp(result_end, alloc_limit, NoFlag, cc); | 3098 Ccmp(result_end, alloc_limit, NoFlag, cc); |
| 3099 B(hi, gc_required); | 3099 B(hi, gc_required); |
| 3100 | 3100 |
| 3101 if ((flags & ALLOCATION_FOLDING_DOMINATOR) == 0) { | 3101 if ((flags & ALLOCATION_FOLDING_DOMINATOR) == 0) { |
| 3102 // The top pointer is not updated for allocation folding dominators. | 3102 // The top pointer is not updated for allocation folding dominators. |
| 3103 Str(result_end, MemOperand(top_address)); | 3103 Str(result_end, MemOperand(top_address)); |
| 3104 } | 3104 } |
| 3105 | |
| 3106 // Tag the object. | |
| 3107 ObjectTag(result, result); | |
| 3108 } | 3105 } |
| 3109 | 3106 |
| 3110 | 3107 |
| 3111 void MacroAssembler::Allocate(Register object_size, Register result, | 3108 void MacroAssembler::Allocate(Register object_size, Register result, |
| 3112 Register result_end, Register scratch, | 3109 Register result_end, Register scratch, |
| 3113 Label* gc_required, AllocationFlags flags) { | 3110 Label* gc_required, AllocationFlags flags) { |
| 3114 if (!FLAG_inline_new) { | 3111 if (!FLAG_inline_new) { |
| 3115 if (emit_debug_code()) { | 3112 if (emit_debug_code()) { |
| 3116 // Trash the registers to simulate an allocation failure. | 3113 // Trash the registers to simulate an allocation failure. |
| 3117 // We apply salt to the original zap value to easily spot the values. | 3114 // We apply salt to the original zap value to easily spot the values. |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3167 | 3164 |
| 3168 // Calculate new top and bail out if new space is exhausted | 3165 // Calculate new top and bail out if new space is exhausted |
| 3169 if ((flags & SIZE_IN_WORDS) != 0) { | 3166 if ((flags & SIZE_IN_WORDS) != 0) { |
| 3170 Adds(result_end, result, Operand(object_size, LSL, kPointerSizeLog2)); | 3167 Adds(result_end, result, Operand(object_size, LSL, kPointerSizeLog2)); |
| 3171 } else { | 3168 } else { |
| 3172 Adds(result_end, result, object_size); | 3169 Adds(result_end, result, object_size); |
| 3173 } | 3170 } |
| 3174 | 3171 |
| 3175 if (emit_debug_code()) { | 3172 if (emit_debug_code()) { |
| 3176 Tst(result_end, kObjectAlignmentMask); | 3173 Tst(result_end, kObjectAlignmentMask); |
| 3177 Check(eq, kUnalignedAllocationInNewSpace); | 3174 Check(ne, kUnalignedAllocationInNewSpace); |
| 3178 } | 3175 } |
| 3179 | 3176 |
| 3180 Ccmp(result_end, alloc_limit, NoFlag, cc); | 3177 Ccmp(result_end, alloc_limit, NoFlag, cc); |
| 3181 B(hi, gc_required); | 3178 B(hi, gc_required); |
| 3182 | 3179 |
| 3183 if ((flags & ALLOCATION_FOLDING_DOMINATOR) == 0) { | 3180 if ((flags & ALLOCATION_FOLDING_DOMINATOR) == 0) { |
| 3184 // The top pointer is not updated for allocation folding dominators. | 3181 // The top pointer is not updated for allocation folding dominators. |
| 3185 Str(result_end, MemOperand(top_address)); | 3182 Str(result_end, MemOperand(top_address)); |
| 3186 } | 3183 } |
| 3187 | |
| 3188 // Tag the object. | |
| 3189 ObjectTag(result, result); | |
| 3190 } | 3184 } |
| 3191 | 3185 |
| 3192 void MacroAssembler::FastAllocate(int object_size, Register result, | 3186 void MacroAssembler::FastAllocate(int object_size, Register result, |
| 3193 Register scratch1, Register scratch2, | 3187 Register scratch1, Register scratch2, |
| 3194 AllocationFlags flags) { | 3188 AllocationFlags flags) { |
| 3195 DCHECK(object_size <= Page::kMaxRegularHeapObjectSize); | 3189 DCHECK(object_size <= Page::kMaxRegularHeapObjectSize); |
| 3196 | 3190 |
| 3197 DCHECK(!AreAliased(result, scratch1, scratch2)); | 3191 DCHECK(!AreAliased(result, scratch1, scratch2)); |
| 3198 DCHECK(result.Is64Bits() && scratch1.Is64Bits() && scratch2.Is64Bits()); | 3192 DCHECK(result.Is64Bits() && scratch1.Is64Bits() && scratch2.Is64Bits()); |
| 3199 | 3193 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 3212 Mov(top_address, Operand(heap_allocation_top)); | 3206 Mov(top_address, Operand(heap_allocation_top)); |
| 3213 Ldr(result, MemOperand(top_address)); | 3207 Ldr(result, MemOperand(top_address)); |
| 3214 | 3208 |
| 3215 // We can ignore DOUBLE_ALIGNMENT flags here because doubles and pointers have | 3209 // We can ignore DOUBLE_ALIGNMENT flags here because doubles and pointers have |
| 3216 // the same alignment on ARM64. | 3210 // the same alignment on ARM64. |
| 3217 STATIC_ASSERT(kPointerAlignment == kDoubleAlignment); | 3211 STATIC_ASSERT(kPointerAlignment == kDoubleAlignment); |
| 3218 | 3212 |
| 3219 // Calculate new top and write it back. | 3213 // Calculate new top and write it back. |
| 3220 Adds(result_end, result, object_size); | 3214 Adds(result_end, result, object_size); |
| 3221 Str(result_end, MemOperand(top_address)); | 3215 Str(result_end, MemOperand(top_address)); |
| 3222 | |
| 3223 ObjectTag(result, result); | |
| 3224 } | 3216 } |
| 3225 | 3217 |
| 3226 void MacroAssembler::FastAllocate(Register object_size, Register result, | 3218 void MacroAssembler::FastAllocate(Register object_size, Register result, |
| 3227 Register result_end, Register scratch, | 3219 Register result_end, Register scratch, |
| 3228 AllocationFlags flags) { | 3220 AllocationFlags flags) { |
| 3229 // |object_size| and |result_end| may overlap, other registers must not. | 3221 // |object_size| and |result_end| may overlap, other registers must not. |
| 3230 DCHECK(!AreAliased(object_size, result, scratch)); | 3222 DCHECK(!AreAliased(object_size, result, scratch)); |
| 3231 DCHECK(!AreAliased(result_end, result, scratch)); | 3223 DCHECK(!AreAliased(result_end, result, scratch)); |
| 3232 DCHECK(object_size.Is64Bits() && result.Is64Bits() && scratch.Is64Bits() && | 3224 DCHECK(object_size.Is64Bits() && result.Is64Bits() && scratch.Is64Bits() && |
| 3233 result_end.Is64Bits()); | 3225 result_end.Is64Bits()); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 3247 // Calculate new top and write it back. | 3239 // Calculate new top and write it back. |
| 3248 if ((flags & SIZE_IN_WORDS) != 0) { | 3240 if ((flags & SIZE_IN_WORDS) != 0) { |
| 3249 Adds(result_end, result, Operand(object_size, LSL, kPointerSizeLog2)); | 3241 Adds(result_end, result, Operand(object_size, LSL, kPointerSizeLog2)); |
| 3250 } else { | 3242 } else { |
| 3251 Adds(result_end, result, object_size); | 3243 Adds(result_end, result, object_size); |
| 3252 } | 3244 } |
| 3253 Str(result_end, MemOperand(top_address)); | 3245 Str(result_end, MemOperand(top_address)); |
| 3254 | 3246 |
| 3255 if (emit_debug_code()) { | 3247 if (emit_debug_code()) { |
| 3256 Tst(result_end, kObjectAlignmentMask); | 3248 Tst(result_end, kObjectAlignmentMask); |
| 3257 Check(eq, kUnalignedAllocationInNewSpace); | 3249 Check(ne, kUnalignedAllocationInNewSpace); |
| 3258 } | 3250 } |
| 3259 | |
| 3260 ObjectTag(result, result); | |
| 3261 } | 3251 } |
| 3262 | 3252 |
| 3263 void MacroAssembler::AllocateTwoByteString(Register result, | 3253 void MacroAssembler::AllocateTwoByteString(Register result, |
| 3264 Register length, | 3254 Register length, |
| 3265 Register scratch1, | 3255 Register scratch1, |
| 3266 Register scratch2, | 3256 Register scratch2, |
| 3267 Register scratch3, | 3257 Register scratch3, |
| 3268 Label* gc_required) { | 3258 Label* gc_required) { |
| 3269 DCHECK(!AreAliased(result, length, scratch1, scratch2, scratch3)); | 3259 DCHECK(!AreAliased(result, length, scratch1, scratch2, scratch3)); |
| 3270 // Calculate the number of bytes needed for the characters in the string while | 3260 // Calculate the number of bytes needed for the characters in the string while |
| (...skipping 1878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5149 } | 5139 } |
| 5150 | 5140 |
| 5151 | 5141 |
| 5152 #undef __ | 5142 #undef __ |
| 5153 | 5143 |
| 5154 | 5144 |
| 5155 } // namespace internal | 5145 } // namespace internal |
| 5156 } // namespace v8 | 5146 } // namespace v8 |
| 5157 | 5147 |
| 5158 #endif // V8_TARGET_ARCH_ARM64 | 5148 #endif // V8_TARGET_ARCH_ARM64 |
| OLD | NEW |