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