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

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

Issue 51653006: Track live instance and allocation counts for classes (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
« runtime/vm/stub_code_ia32.cc ('K') | « runtime/vm/stub_code_mips.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 __ cmpq(R12, Address(R13, Scavenger::end_offset())); 574 __ cmpq(R12, Address(R13, Scavenger::end_offset()));
575 __ j(ABOVE_EQUAL, &slow_case); 575 __ j(ABOVE_EQUAL, &slow_case);
576 576
577 // Successfully allocated the object(s), now update top to point to 577 // Successfully allocated the object(s), now update top to point to
578 // next object start and initialize the object. 578 // next object start and initialize the object.
579 // RAX: potential new object start. 579 // RAX: potential new object start.
580 // R12: potential next object start. 580 // R12: potential next object start.
581 // R13: Points to new space object. 581 // R13: Points to new space object.
582 __ movq(Address(R13, Scavenger::top_offset()), R12); 582 __ movq(Address(R13, Scavenger::top_offset()), R12);
583 __ addq(RAX, Immediate(kHeapObjectTag)); 583 __ addq(RAX, Immediate(kHeapObjectTag));
584 // R13: Size of allocation in bytes.
585 __ movq(R13, R12);
586 __ subq(R13, RAX);
587 __ BumpAllocationCount(Heap::kNew, kArrayCid, R13);
584 588
585 // RAX: new object start as a tagged pointer. 589 // RAX: new object start as a tagged pointer.
586 // R12: new object end address. 590 // R12: new object end address.
587 // RBX: array element type. 591 // RBX: array element type.
588 // R10: Array length as Smi. 592 // R10: Array length as Smi.
589 593
590 // Store the type argument field. 594 // Store the type argument field.
591 __ StoreIntoObjectNoBarrier( 595 __ StoreIntoObjectNoBarrier(
592 RAX, FieldAddress(RAX, Array::type_arguments_offset()), RBX); 596 RAX, FieldAddress(RAX, Array::type_arguments_offset()), RBX);
593 597
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
928 } 932 }
929 933
930 // Successfully allocated the object, now update top to point to 934 // Successfully allocated the object, now update top to point to
931 // next object start and initialize the object. 935 // next object start and initialize the object.
932 // RAX: new object. 936 // RAX: new object.
933 // R13: next object start. 937 // R13: next object start.
934 // R10: number of context variables. 938 // R10: number of context variables.
935 __ movq(RDI, Immediate(heap->TopAddress())); 939 __ movq(RDI, Immediate(heap->TopAddress()));
936 __ movq(Address(RDI, 0), R13); 940 __ movq(Address(RDI, 0), R13);
937 __ addq(RAX, Immediate(kHeapObjectTag)); 941 __ addq(RAX, Immediate(kHeapObjectTag));
942 // R13: Size of allocation in bytes.
943 __ subq(R13, RAX);
944 __ BumpAllocationCount(Heap::kNew, context_class.id(), R13);
938 945
939 // Calculate the size tag. 946 // Calculate the size tag.
940 // RAX: new object. 947 // RAX: new object.
941 // R10: number of context variables. 948 // R10: number of context variables.
942 { 949 {
943 Label size_tag_overflow, done; 950 Label size_tag_overflow, done;
944 __ leaq(R13, Address(R10, TIMES_8, fixed_size)); 951 __ leaq(R13, Address(R10, TIMES_8, fixed_size));
945 __ andq(R13, Immediate(-kObjectAlignment)); 952 __ andq(R13, Immediate(-kObjectAlignment));
946 __ cmpq(R13, Immediate(RawObject::SizeTag::kMaxSizeTag)); 953 __ cmpq(R13, Immediate(RawObject::SizeTag::kMaxSizeTag));
947 __ j(ABOVE, &size_tag_overflow, Assembler::kNearJump); 954 __ j(ABOVE, &size_tag_overflow, Assembler::kNearJump);
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
1127 if (FLAG_use_slow_path) { 1134 if (FLAG_use_slow_path) {
1128 __ jmp(&slow_case); 1135 __ jmp(&slow_case);
1129 } else { 1136 } else {
1130 __ j(ABOVE_EQUAL, &slow_case); 1137 __ j(ABOVE_EQUAL, &slow_case);
1131 } 1138 }
1132 1139
1133 // Successfully allocated the object(s), now update top to point to 1140 // Successfully allocated the object(s), now update top to point to
1134 // next object start and initialize the object. 1141 // next object start and initialize the object.
1135 __ movq(RDI, Immediate(heap->TopAddress())); 1142 __ movq(RDI, Immediate(heap->TopAddress()));
1136 __ movq(Address(RDI, 0), RBX); 1143 __ movq(Address(RDI, 0), RBX);
1144 __ BumpAllocationCount(Heap::kNew, cls.id());
1137 1145
1138 if (is_cls_parameterized) { 1146 if (is_cls_parameterized) {
1139 // Initialize the type arguments field in the object. 1147 // Initialize the type arguments field in the object.
1140 // RAX: new object start. 1148 // RAX: new object start.
1141 // RCX: potential new object end and, if RCX != RBX, potential new 1149 // RCX: potential new object end and, if RCX != RBX, potential new
1142 // InstantiatedTypeArguments object start. 1150 // InstantiatedTypeArguments object start.
1143 // RBX: next object start. 1151 // RBX: next object start.
1144 Label type_arguments_ready; 1152 Label type_arguments_ready;
1145 __ movq(RDI, Address(RSP, kObjectTypeArgumentsOffset)); 1153 __ movq(RDI, Address(RSP, kObjectTypeArgumentsOffset));
1146 __ cmpq(RCX, RBX); 1154 __ cmpq(RCX, RBX);
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
1290 if (FLAG_use_slow_path) { 1298 if (FLAG_use_slow_path) {
1291 __ jmp(&slow_case); 1299 __ jmp(&slow_case);
1292 } else { 1300 } else {
1293 __ j(ABOVE_EQUAL, &slow_case); 1301 __ j(ABOVE_EQUAL, &slow_case);
1294 } 1302 }
1295 1303
1296 // Successfully allocated the object, now update top to point to 1304 // Successfully allocated the object, now update top to point to
1297 // next object start and initialize the object. 1305 // next object start and initialize the object.
1298 __ movq(RDI, Immediate(heap->TopAddress())); 1306 __ movq(RDI, Immediate(heap->TopAddress()));
1299 __ movq(Address(RDI, 0), R13); 1307 __ movq(Address(RDI, 0), R13);
1308 __ subq(RDI, RAX);
1309 __ BumpAllocationCount(Heap::kNew, cls.id(), RDI);
1300 1310
1301 // RAX: new closure object. 1311 // RAX: new closure object.
1302 // RBX: new context object (only if is_implicit_closure). 1312 // RBX: new context object (only if is_implicit_closure).
1303 // Set the tags. 1313 // Set the tags.
1304 uword tags = 0; 1314 uword tags = 0;
1305 tags = RawObject::SizeTag::update(closure_size, tags); 1315 tags = RawObject::SizeTag::update(closure_size, tags);
1306 tags = RawObject::ClassIdTag::update(cls.id(), tags); 1316 tags = RawObject::ClassIdTag::update(cls.id(), tags);
1307 __ movq(Address(RAX, Instance::tags_offset()), Immediate(tags)); 1317 __ movq(Address(RAX, Instance::tags_offset()), Immediate(tags));
1308 1318
1309 // Initialize the function field in the object. 1319 // Initialize the function field in the object.
(...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after
2165 2175
2166 __ movq(left, Address(RSP, 2 * kWordSize)); 2176 __ movq(left, Address(RSP, 2 * kWordSize));
2167 __ movq(right, Address(RSP, 1 * kWordSize)); 2177 __ movq(right, Address(RSP, 1 * kWordSize));
2168 GenerateIdenticalWithNumberCheckStub(assembler, left, right); 2178 GenerateIdenticalWithNumberCheckStub(assembler, left, right);
2169 __ ret(); 2179 __ ret();
2170 } 2180 }
2171 2181
2172 } // namespace dart 2182 } // namespace dart
2173 2183
2174 #endif // defined TARGET_ARCH_X64 2184 #endif // defined TARGET_ARCH_X64
OLDNEW
« runtime/vm/stub_code_ia32.cc ('K') | « runtime/vm/stub_code_mips.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698