Chromium Code Reviews| 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 830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 841 void StubCode::GenerateAllocateContextStub(Assembler* assembler) { | 841 void StubCode::GenerateAllocateContextStub(Assembler* assembler) { |
| 842 __ LoadObject(R12, Object::null_object()); | 842 __ LoadObject(R12, Object::null_object()); |
| 843 if (FLAG_inline_alloc) { | 843 if (FLAG_inline_alloc) { |
| 844 Label slow_case; | 844 Label slow_case; |
| 845 // First compute the rounded instance size. | 845 // First compute the rounded instance size. |
| 846 // R10: number of context variables. | 846 // R10: number of context variables. |
| 847 intptr_t fixed_size = (sizeof(RawContext) + kObjectAlignment - 1); | 847 intptr_t fixed_size = (sizeof(RawContext) + kObjectAlignment - 1); |
| 848 __ leaq(R13, Address(R10, TIMES_8, fixed_size)); | 848 __ leaq(R13, Address(R10, TIMES_8, fixed_size)); |
| 849 __ andq(R13, Immediate(-kObjectAlignment)); | 849 __ andq(R13, Immediate(-kObjectAlignment)); |
| 850 | 850 |
| 851 // Check for allocation tracing. | |
| 852 __ MaybeTraceAllocation(kContextCid, | |
| 853 &slow_case, | |
| 854 /* near_jump = */ false, | |
|
Florian Schneider
2015/08/14 11:35:09
Use Assembler::kFarJump instead.
Cutch
2015/08/14 13:54:36
Done here and elsewhere.
| |
| 855 /* inline_isolate = */ false); | |
| 851 // Now allocate the object. | 856 // Now allocate the object. |
| 852 // R10: number of context variables. | 857 // R10: number of context variables. |
| 853 const intptr_t cid = kContextCid; | 858 const intptr_t cid = kContextCid; |
| 854 Heap::Space space = Heap::SpaceForAllocation(cid); | 859 Heap::Space space = Heap::SpaceForAllocation(cid); |
| 855 __ movq(RCX, Address(THR, Thread::heap_offset())); | 860 __ movq(RCX, Address(THR, Thread::heap_offset())); |
| 856 __ movq(RAX, Address(RCX, Heap::TopOffset(space))); | 861 __ movq(RAX, Address(RCX, Heap::TopOffset(space))); |
| 857 __ addq(R13, RAX); | 862 __ addq(R13, RAX); |
| 858 // Check if the allocation fits into the remaining space. | 863 // Check if the allocation fits into the remaining space. |
| 859 // RAX: potential new object. | 864 // RAX: potential new object. |
| 860 // R13: potential next object start. | 865 // R13: potential next object start. |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1048 // straight line code. | 1053 // straight line code. |
| 1049 const int kInlineInstanceSize = 12; // In words. | 1054 const int kInlineInstanceSize = 12; // In words. |
| 1050 const intptr_t instance_size = cls.instance_size(); | 1055 const intptr_t instance_size = cls.instance_size(); |
| 1051 ASSERT(instance_size > 0); | 1056 ASSERT(instance_size > 0); |
| 1052 __ LoadObject(R12, Object::null_object()); | 1057 __ LoadObject(R12, Object::null_object()); |
| 1053 if (is_cls_parameterized) { | 1058 if (is_cls_parameterized) { |
| 1054 __ movq(RDX, Address(RSP, kObjectTypeArgumentsOffset)); | 1059 __ movq(RDX, Address(RSP, kObjectTypeArgumentsOffset)); |
| 1055 // RDX: instantiated type arguments. | 1060 // RDX: instantiated type arguments. |
| 1056 } | 1061 } |
| 1057 if (FLAG_inline_alloc && Heap::IsAllocatableInNewSpace(instance_size) && | 1062 if (FLAG_inline_alloc && Heap::IsAllocatableInNewSpace(instance_size) && |
| 1058 !cls.trace_allocation()) { | 1063 !cls.TraceAllocation()) { |
| 1059 Label slow_case; | 1064 Label slow_case; |
| 1060 // Allocate the object and update top to point to | 1065 // Allocate the object and update top to point to |
| 1061 // next object start and initialize the allocated object. | 1066 // next object start and initialize the allocated object. |
| 1062 // RDX: instantiated type arguments (if is_cls_parameterized). | 1067 // RDX: instantiated type arguments (if is_cls_parameterized). |
| 1063 Heap::Space space = Heap::SpaceForAllocation(cls.id()); | 1068 Heap::Space space = Heap::SpaceForAllocation(cls.id()); |
| 1064 __ movq(RCX, Address(THR, Thread::heap_offset())); | 1069 __ movq(RCX, Address(THR, Thread::heap_offset())); |
| 1065 __ movq(RAX, Address(RCX, Heap::TopOffset(space))); | 1070 __ movq(RAX, Address(RCX, Heap::TopOffset(space))); |
| 1066 __ leaq(RBX, Address(RAX, instance_size)); | 1071 __ leaq(RBX, Address(RAX, instance_size)); |
| 1067 // Check if the allocation fits into the remaining space. | 1072 // Check if the allocation fits into the remaining space. |
| 1068 // RAX: potential new object start. | 1073 // RAX: potential new object start. |
| (...skipping 1062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2131 // Result: | 2136 // Result: |
| 2132 // RCX: entry point. | 2137 // RCX: entry point. |
| 2133 void StubCode::GenerateMegamorphicLookupStub(Assembler* assembler) { | 2138 void StubCode::GenerateMegamorphicLookupStub(Assembler* assembler) { |
| 2134 EmitMegamorphicLookup(assembler, RDI, RBX, RCX); | 2139 EmitMegamorphicLookup(assembler, RDI, RBX, RCX); |
| 2135 __ ret(); | 2140 __ ret(); |
| 2136 } | 2141 } |
| 2137 | 2142 |
| 2138 } // namespace dart | 2143 } // namespace dart |
| 2139 | 2144 |
| 2140 #endif // defined TARGET_ARCH_X64 | 2145 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |