| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/globals.h" | 5 #include "vm/globals.h" |
| 6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
| 7 | 7 |
| 8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
| 9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
| 10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
| (...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 591 __ MaybeTraceAllocation(kArrayCid, | 591 __ MaybeTraceAllocation(kArrayCid, |
| 592 &slow_case, | 592 &slow_case, |
| 593 Assembler::kFarJump); | 593 Assembler::kFarJump); |
| 594 | 594 |
| 595 const intptr_t fixed_size = sizeof(RawArray) + kObjectAlignment - 1; | 595 const intptr_t fixed_size = sizeof(RawArray) + kObjectAlignment - 1; |
| 596 __ leaq(RDI, Address(RDI, TIMES_4, fixed_size)); // RDI is a Smi. | 596 __ leaq(RDI, Address(RDI, TIMES_4, fixed_size)); // RDI is a Smi. |
| 597 ASSERT(kSmiTagShift == 1); | 597 ASSERT(kSmiTagShift == 1); |
| 598 __ andq(RDI, Immediate(-kObjectAlignment)); | 598 __ andq(RDI, Immediate(-kObjectAlignment)); |
| 599 | 599 |
| 600 const intptr_t cid = kArrayCid; | 600 const intptr_t cid = kArrayCid; |
| 601 Heap::Space space = Heap::SpaceForAllocation(cid); | 601 Heap::Space space = Heap::kNew; |
| 602 __ movq(R13, Address(THR, Thread::heap_offset())); | 602 __ movq(R13, Address(THR, Thread::heap_offset())); |
| 603 __ movq(RAX, Address(R13, Heap::TopOffset(space))); | 603 __ movq(RAX, Address(R13, Heap::TopOffset(space))); |
| 604 | 604 |
| 605 // RDI: allocation size. | 605 // RDI: allocation size. |
| 606 __ movq(RCX, RAX); | 606 __ movq(RCX, RAX); |
| 607 __ addq(RCX, RDI); | 607 __ addq(RCX, RDI); |
| 608 __ j(CARRY, &slow_case); | 608 __ j(CARRY, &slow_case); |
| 609 | 609 |
| 610 // Check if the allocation fits into the remaining space. | 610 // Check if the allocation fits into the remaining space. |
| 611 // RAX: potential new object start. | 611 // RAX: potential new object start. |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 843 __ andq(R13, Immediate(-kObjectAlignment)); | 843 __ andq(R13, Immediate(-kObjectAlignment)); |
| 844 | 844 |
| 845 // Check for allocation tracing. | 845 // Check for allocation tracing. |
| 846 __ MaybeTraceAllocation(kContextCid, | 846 __ MaybeTraceAllocation(kContextCid, |
| 847 &slow_case, | 847 &slow_case, |
| 848 Assembler::kFarJump); | 848 Assembler::kFarJump); |
| 849 | 849 |
| 850 // Now allocate the object. | 850 // Now allocate the object. |
| 851 // R10: number of context variables. | 851 // R10: number of context variables. |
| 852 const intptr_t cid = kContextCid; | 852 const intptr_t cid = kContextCid; |
| 853 Heap::Space space = Heap::SpaceForAllocation(cid); | 853 Heap::Space space = Heap::kNew; |
| 854 __ movq(RCX, Address(THR, Thread::heap_offset())); | 854 __ movq(RCX, Address(THR, Thread::heap_offset())); |
| 855 __ movq(RAX, Address(RCX, Heap::TopOffset(space))); | 855 __ movq(RAX, Address(RCX, Heap::TopOffset(space))); |
| 856 __ addq(R13, RAX); | 856 __ addq(R13, RAX); |
| 857 // Check if the allocation fits into the remaining space. | 857 // Check if the allocation fits into the remaining space. |
| 858 // RAX: potential new object. | 858 // RAX: potential new object. |
| 859 // R13: potential next object start. | 859 // R13: potential next object start. |
| 860 // R10: number of context variables. | 860 // R10: number of context variables. |
| 861 // RCX: heap. | 861 // RCX: heap. |
| 862 __ cmpq(R13, Address(RCX, Heap::EndOffset(space))); | 862 __ cmpq(R13, Address(RCX, Heap::EndOffset(space))); |
| 863 if (FLAG_use_slow_path) { | 863 if (FLAG_use_slow_path) { |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1046 __ movq(RDX, Address(RSP, kObjectTypeArgumentsOffset)); | 1046 __ movq(RDX, Address(RSP, kObjectTypeArgumentsOffset)); |
| 1047 // RDX: instantiated type arguments. | 1047 // RDX: instantiated type arguments. |
| 1048 } | 1048 } |
| 1049 Isolate* isolate = Isolate::Current(); | 1049 Isolate* isolate = Isolate::Current(); |
| 1050 if (FLAG_inline_alloc && Heap::IsAllocatableInNewSpace(instance_size) && | 1050 if (FLAG_inline_alloc && Heap::IsAllocatableInNewSpace(instance_size) && |
| 1051 !cls.TraceAllocation(isolate)) { | 1051 !cls.TraceAllocation(isolate)) { |
| 1052 Label slow_case; | 1052 Label slow_case; |
| 1053 // Allocate the object and update top to point to | 1053 // Allocate the object and update top to point to |
| 1054 // next object start and initialize the allocated object. | 1054 // next object start and initialize the allocated object. |
| 1055 // RDX: instantiated type arguments (if is_cls_parameterized). | 1055 // RDX: instantiated type arguments (if is_cls_parameterized). |
| 1056 Heap::Space space = Heap::SpaceForAllocation(cls.id()); | 1056 Heap::Space space = Heap::kNew; |
| 1057 __ movq(RCX, Address(THR, Thread::heap_offset())); | 1057 __ movq(RCX, Address(THR, Thread::heap_offset())); |
| 1058 __ movq(RAX, Address(RCX, Heap::TopOffset(space))); | 1058 __ movq(RAX, Address(RCX, Heap::TopOffset(space))); |
| 1059 __ leaq(RBX, Address(RAX, instance_size)); | 1059 __ leaq(RBX, Address(RAX, instance_size)); |
| 1060 // Check if the allocation fits into the remaining space. | 1060 // Check if the allocation fits into the remaining space. |
| 1061 // RAX: potential new object start. | 1061 // RAX: potential new object start. |
| 1062 // RBX: potential next object start. | 1062 // RBX: potential next object start. |
| 1063 // RCX: heap. | 1063 // RCX: heap. |
| 1064 __ cmpq(RBX, Address(RCX, Heap::EndOffset(space))); | 1064 __ cmpq(RBX, Address(RCX, Heap::EndOffset(space))); |
| 1065 if (FLAG_use_slow_path) { | 1065 if (FLAG_use_slow_path) { |
| 1066 __ jmp(&slow_case); | 1066 __ jmp(&slow_case); |
| (...skipping 1151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2218 } | 2218 } |
| 2219 | 2219 |
| 2220 | 2220 |
| 2221 void StubCode::GenerateFrameAwaitingMaterializationStub(Assembler* assembler) { | 2221 void StubCode::GenerateFrameAwaitingMaterializationStub(Assembler* assembler) { |
| 2222 __ int3(); | 2222 __ int3(); |
| 2223 } | 2223 } |
| 2224 | 2224 |
| 2225 } // namespace dart | 2225 } // namespace dart |
| 2226 | 2226 |
| 2227 #endif // defined TARGET_ARCH_X64 | 2227 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |