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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_ARM64 | 7 #if V8_TARGET_ARCH_ARM64 |
8 | 8 |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 3542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3553 } | 3553 } |
3554 | 3554 |
3555 | 3555 |
3556 // Allocates a heap number or jumps to the need_gc label if the young space | 3556 // Allocates a heap number or jumps to the need_gc label if the young space |
3557 // is full and a scavenge is needed. | 3557 // is full and a scavenge is needed. |
3558 void MacroAssembler::AllocateHeapNumber(Register result, | 3558 void MacroAssembler::AllocateHeapNumber(Register result, |
3559 Label* gc_required, | 3559 Label* gc_required, |
3560 Register scratch1, | 3560 Register scratch1, |
3561 Register scratch2, | 3561 Register scratch2, |
3562 CPURegister value, | 3562 CPURegister value, |
3563 CPURegister heap_number_map, | 3563 CPURegister heap_number_map) { |
3564 MutableMode mode) { | |
3565 ASSERT(!value.IsValid() || value.Is64Bits()); | 3564 ASSERT(!value.IsValid() || value.Is64Bits()); |
3566 UseScratchRegisterScope temps(this); | 3565 UseScratchRegisterScope temps(this); |
3567 | 3566 |
3568 // Allocate an object in the heap for the heap number and tag it as a heap | 3567 // Allocate an object in the heap for the heap number and tag it as a heap |
3569 // object. | 3568 // object. |
3570 Allocate(HeapNumber::kSize, result, scratch1, scratch2, gc_required, | 3569 Allocate(HeapNumber::kSize, result, scratch1, scratch2, gc_required, |
3571 NO_ALLOCATION_FLAGS); | 3570 NO_ALLOCATION_FLAGS); |
3572 | 3571 |
3573 Heap::RootListIndex map_index = mode == MUTABLE | |
3574 ? Heap::kMutableHeapNumberMapRootIndex | |
3575 : Heap::kHeapNumberMapRootIndex; | |
3576 | |
3577 // Prepare the heap number map. | 3572 // Prepare the heap number map. |
3578 if (!heap_number_map.IsValid()) { | 3573 if (!heap_number_map.IsValid()) { |
3579 // If we have a valid value register, use the same type of register to store | 3574 // If we have a valid value register, use the same type of register to store |
3580 // the map so we can use STP to store both in one instruction. | 3575 // the map so we can use STP to store both in one instruction. |
3581 if (value.IsValid() && value.IsFPRegister()) { | 3576 if (value.IsValid() && value.IsFPRegister()) { |
3582 heap_number_map = temps.AcquireD(); | 3577 heap_number_map = temps.AcquireD(); |
3583 } else { | 3578 } else { |
3584 heap_number_map = scratch1; | 3579 heap_number_map = scratch1; |
3585 } | 3580 } |
3586 LoadRoot(heap_number_map, map_index); | 3581 LoadRoot(heap_number_map, Heap::kHeapNumberMapRootIndex); |
3587 } | 3582 } |
3588 if (emit_debug_code()) { | 3583 if (emit_debug_code()) { |
3589 Register map; | 3584 Register map; |
3590 if (heap_number_map.IsFPRegister()) { | 3585 if (heap_number_map.IsFPRegister()) { |
3591 map = scratch1; | 3586 map = scratch1; |
3592 Fmov(map, DoubleRegister(heap_number_map)); | 3587 Fmov(map, DoubleRegister(heap_number_map)); |
3593 } else { | 3588 } else { |
3594 map = Register(heap_number_map); | 3589 map = Register(heap_number_map); |
3595 } | 3590 } |
3596 AssertRegisterIsRoot(map, map_index); | 3591 AssertRegisterIsRoot(map, Heap::kHeapNumberMapRootIndex); |
3597 } | 3592 } |
3598 | 3593 |
3599 // Store the heap number map and the value in the allocated object. | 3594 // Store the heap number map and the value in the allocated object. |
3600 if (value.IsSameSizeAndType(heap_number_map)) { | 3595 if (value.IsSameSizeAndType(heap_number_map)) { |
3601 STATIC_ASSERT(HeapObject::kMapOffset + kPointerSize == | 3596 STATIC_ASSERT(HeapObject::kMapOffset + kPointerSize == |
3602 HeapNumber::kValueOffset); | 3597 HeapNumber::kValueOffset); |
3603 Stp(heap_number_map, value, MemOperand(result, HeapObject::kMapOffset)); | 3598 Stp(heap_number_map, value, MemOperand(result, HeapObject::kMapOffset)); |
3604 } else { | 3599 } else { |
3605 Str(heap_number_map, MemOperand(result, HeapObject::kMapOffset)); | 3600 Str(heap_number_map, MemOperand(result, HeapObject::kMapOffset)); |
3606 if (value.IsValid()) { | 3601 if (value.IsValid()) { |
(...skipping 1692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5299 } | 5294 } |
5300 } | 5295 } |
5301 | 5296 |
5302 | 5297 |
5303 #undef __ | 5298 #undef __ |
5304 | 5299 |
5305 | 5300 |
5306 } } // namespace v8::internal | 5301 } } // namespace v8::internal |
5307 | 5302 |
5308 #endif // V8_TARGET_ARCH_ARM64 | 5303 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |