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