Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Side by Side Diff: runtime/vm/stub_code_x64.cc

Issue 1263513002: VM: Load allocation-top and -end via Thread. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: arm, arm64 and mips Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 598 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 /* near_jump = */ false, 609 /* near_jump = */ false,
610 /* inline_isolate = */ false); 610 /* inline_isolate = */ false);
611 611
612 const intptr_t fixed_size = sizeof(RawArray) + kObjectAlignment - 1; 612 const intptr_t fixed_size = sizeof(RawArray) + kObjectAlignment - 1;
613 __ leaq(RDI, Address(RDI, TIMES_4, fixed_size)); // RDI is a Smi. 613 __ leaq(RDI, Address(RDI, TIMES_4, fixed_size)); // RDI is a Smi.
614 ASSERT(kSmiTagShift == 1); 614 ASSERT(kSmiTagShift == 1);
615 __ andq(RDI, Immediate(-kObjectAlignment)); 615 __ andq(RDI, Immediate(-kObjectAlignment));
616 616
617 const intptr_t cid = kArrayCid; 617 const intptr_t cid = kArrayCid;
618 Heap::Space space = Heap::SpaceForAllocation(cid); 618 Heap::Space space = Heap::SpaceForAllocation(cid);
619 __ LoadIsolate(R13); 619 __ movq(R13, Address(THR, Thread::heap_offset()));
620 __ movq(R13, Address(R13, Isolate::heap_offset()));
621 __ movq(RAX, Address(R13, Heap::TopOffset(space))); 620 __ movq(RAX, Address(R13, Heap::TopOffset(space)));
622 621
623 // RDI: allocation size. 622 // RDI: allocation size.
624 __ movq(RCX, RAX); 623 __ movq(RCX, RAX);
625 __ addq(RCX, RDI); 624 __ addq(RCX, RDI);
626 __ j(CARRY, &slow_case); 625 __ j(CARRY, &slow_case);
627 626
628 // Check if the allocation fits into the remaining space. 627 // Check if the allocation fits into the remaining space.
629 // RAX: potential new object start. 628 // RAX: potential new object start.
630 // RCX: potential next object start. 629 // RCX: potential next object start.
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 // First compute the rounded instance size. 857 // First compute the rounded instance size.
859 // R10: number of context variables. 858 // R10: number of context variables.
860 intptr_t fixed_size = (sizeof(RawContext) + kObjectAlignment - 1); 859 intptr_t fixed_size = (sizeof(RawContext) + kObjectAlignment - 1);
861 __ leaq(R13, Address(R10, TIMES_8, fixed_size)); 860 __ leaq(R13, Address(R10, TIMES_8, fixed_size));
862 __ andq(R13, Immediate(-kObjectAlignment)); 861 __ andq(R13, Immediate(-kObjectAlignment));
863 862
864 // Now allocate the object. 863 // Now allocate the object.
865 // R10: number of context variables. 864 // R10: number of context variables.
866 const intptr_t cid = kContextCid; 865 const intptr_t cid = kContextCid;
867 Heap::Space space = Heap::SpaceForAllocation(cid); 866 Heap::Space space = Heap::SpaceForAllocation(cid);
868 __ LoadIsolate(RCX); 867 __ movq(RCX, Address(THR, Thread::heap_offset()));
869 __ movq(RCX, Address(RCX, Isolate::heap_offset()));
870 __ movq(RAX, Address(RCX, Heap::TopOffset(space))); 868 __ movq(RAX, Address(RCX, Heap::TopOffset(space)));
871 __ addq(R13, RAX); 869 __ addq(R13, RAX);
872 // Check if the allocation fits into the remaining space. 870 // Check if the allocation fits into the remaining space.
873 // RAX: potential new object. 871 // RAX: potential new object.
874 // R13: potential next object start. 872 // R13: potential next object start.
875 // R10: number of context variables. 873 // R10: number of context variables.
876 // RCX: heap. 874 // RCX: heap.
877 __ cmpq(R13, Address(RCX, Heap::EndOffset(space))); 875 __ cmpq(R13, Address(RCX, Heap::EndOffset(space)));
878 if (FLAG_use_slow_path) { 876 if (FLAG_use_slow_path) {
879 __ jmp(&slow_case); 877 __ jmp(&slow_case);
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
1069 if (is_cls_parameterized) { 1067 if (is_cls_parameterized) {
1070 __ movq(RDX, Address(RSP, kObjectTypeArgumentsOffset)); 1068 __ movq(RDX, Address(RSP, kObjectTypeArgumentsOffset));
1071 // RDX: instantiated type arguments. 1069 // RDX: instantiated type arguments.
1072 } 1070 }
1073 if (FLAG_inline_alloc && Heap::IsAllocatableInNewSpace(instance_size) && 1071 if (FLAG_inline_alloc && Heap::IsAllocatableInNewSpace(instance_size) &&
1074 !cls.trace_allocation()) { 1072 !cls.trace_allocation()) {
1075 Label slow_case; 1073 Label slow_case;
1076 // Allocate the object and update top to point to 1074 // Allocate the object and update top to point to
1077 // next object start and initialize the allocated object. 1075 // next object start and initialize the allocated object.
1078 // RDX: instantiated type arguments (if is_cls_parameterized). 1076 // RDX: instantiated type arguments (if is_cls_parameterized).
1079 Heap* heap = Isolate::Current()->heap();
1080 Heap::Space space = Heap::SpaceForAllocation(cls.id()); 1077 Heap::Space space = Heap::SpaceForAllocation(cls.id());
1081 __ movq(RCX, Immediate(heap->TopAddress(space))); 1078 __ movq(RCX, Address(THR, Thread::heap_offset()));
1082 __ movq(RAX, Address(RCX, 0)); 1079 __ movq(RAX, Address(RCX, Heap::TopOffset(space)));
1083 __ leaq(RBX, Address(RAX, instance_size)); 1080 __ leaq(RBX, Address(RAX, instance_size));
1084 // Check if the allocation fits into the remaining space. 1081 // Check if the allocation fits into the remaining space.
1085 // RAX: potential new object start. 1082 // RAX: potential new object start.
1086 // RBX: potential next object start. 1083 // RBX: potential next object start.
1087 // RCX: heap top address. 1084 // RCX: heap.
1088 __ movq(R13, Immediate(heap->EndAddress(space))); 1085 __ cmpq(RBX, Address(RCX, Heap::EndOffset(space)));
1089 __ cmpq(RBX, Address(R13, 0));
1090 if (FLAG_use_slow_path) { 1086 if (FLAG_use_slow_path) {
1091 __ jmp(&slow_case); 1087 __ jmp(&slow_case);
1092 } else { 1088 } else {
1093 __ j(ABOVE_EQUAL, &slow_case); 1089 __ j(ABOVE_EQUAL, &slow_case);
1094 } 1090 }
1095 __ movq(Address(RCX, 0), RBX); 1091 __ movq(Address(RCX, Heap::TopOffset(space)), RBX);
1096 __ UpdateAllocationStats(cls.id(), space); 1092 __ UpdateAllocationStats(cls.id(), space, /* inline_isolate = */ false);
1097 1093
1098 // RAX: new object start (untagged). 1094 // RAX: new object start (untagged).
1099 // RBX: next object start. 1095 // RBX: next object start.
1100 // RDX: new object type arguments (if is_cls_parameterized). 1096 // RDX: new object type arguments (if is_cls_parameterized).
1101 // Set the tags. 1097 // Set the tags.
1102 uword tags = 0; 1098 uword tags = 0;
1103 tags = RawObject::SizeTag::update(instance_size, tags); 1099 tags = RawObject::SizeTag::update(instance_size, tags);
1104 ASSERT(cls.id() != kIllegalCid); 1100 ASSERT(cls.id() != kIllegalCid);
1105 tags = RawObject::ClassIdTag::update(cls.id(), tags); 1101 tags = RawObject::ClassIdTag::update(cls.id(), tags);
1106 __ movq(Address(RAX, Instance::tags_offset()), Immediate(tags)); 1102 __ movq(Address(RAX, Instance::tags_offset()), Immediate(tags));
(...skipping 1048 matching lines...) Expand 10 before | Expand all | Expand 10 after
2155 // Result: 2151 // Result:
2156 // RCX: entry point. 2152 // RCX: entry point.
2157 void StubCode::GenerateMegamorphicLookupStub(Assembler* assembler) { 2153 void StubCode::GenerateMegamorphicLookupStub(Assembler* assembler) {
2158 EmitMegamorphicLookup(assembler, RDI, RBX, RCX); 2154 EmitMegamorphicLookup(assembler, RDI, RBX, RCX);
2159 __ ret(); 2155 __ ret();
2160 } 2156 }
2161 2157
2162 } // namespace dart 2158 } // namespace dart
2163 2159
2164 #endif // defined TARGET_ARCH_X64 2160 #endif // defined TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698