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