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

Side by Side Diff: runtime/vm/stub_code_ia32.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
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_IA32) 6 #if defined(TARGET_ARCH_IA32)
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 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 __ j(ABOVE_EQUAL, &slow_case); 581 __ j(ABOVE_EQUAL, &slow_case);
582 582
583 // Successfully allocated the object(s), now update top to point to 583 // Successfully allocated the object(s), now update top to point to
584 // next object start and initialize the object. 584 // next object start and initialize the object.
585 // EAX: potential new object start. 585 // EAX: potential new object start.
586 // EBX: potential next object start. 586 // EBX: potential next object start.
587 // EDX: Array length as Smi. 587 // EDX: Array length as Smi.
588 // EDI: Points to new space object. 588 // EDI: Points to new space object.
589 __ movl(Address(EDI, Scavenger::top_offset()), EBX); 589 __ movl(Address(EDI, Scavenger::top_offset()), EBX);
590 __ addl(EAX, Immediate(kHeapObjectTag)); 590 __ addl(EAX, Immediate(kHeapObjectTag));
591 // EDI: Size of allocation in bytes.
Ivan Posva 2013/12/12 13:53:24 At this point EDI does not contain the size of the
592 __ movl(EDI, EBX);
593 __ subl(EDI, EAX);
594 __ BumpAllocationCount(Heap::kNew, kArrayCid, EDI, kNoRegister);
591 595
592 // EAX: new object start as a tagged pointer. 596 // EAX: new object start as a tagged pointer.
593 // EBX: new object end address. 597 // EBX: new object end address.
594 // ECX: array element type. 598 // ECX: array element type.
595 // EDX: Array length as Smi. 599 // EDX: Array length as Smi.
596 600
597 // Store the type argument field. 601 // Store the type argument field.
598 __ StoreIntoObjectNoBarrier( 602 __ StoreIntoObjectNoBarrier(
599 EAX, 603 EAX,
600 FieldAddress(EAX, Array::type_arguments_offset()), 604 FieldAddress(EAX, Array::type_arguments_offset()),
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
923 __ j(ABOVE_EQUAL, &slow_case, Assembler::kNearJump); 927 __ j(ABOVE_EQUAL, &slow_case, Assembler::kNearJump);
924 } 928 }
925 929
926 // Successfully allocated the object, now update top to point to 930 // Successfully allocated the object, now update top to point to
927 // next object start and initialize the object. 931 // next object start and initialize the object.
928 // EAX: new object. 932 // EAX: new object.
929 // EBX: next object start. 933 // EBX: next object start.
930 // EDX: number of context variables. 934 // EDX: number of context variables.
931 __ movl(Address::Absolute(heap->TopAddress()), EBX); 935 __ movl(Address::Absolute(heap->TopAddress()), EBX);
932 __ addl(EAX, Immediate(kHeapObjectTag)); 936 __ addl(EAX, Immediate(kHeapObjectTag));
937 // EBX: Size of allocation in bytes.
Ivan Posva 2013/12/12 13:53:24 ditto
938 __ subl(EBX, EAX);
939 __ BumpAllocationCount(Heap::kNew, context_class.id(), EBX, kNoRegister);
933 940
934 // Calculate the size tag. 941 // Calculate the size tag.
935 // EAX: new object. 942 // EAX: new object.
936 // EDX: number of context variables. 943 // EDX: number of context variables.
937 { 944 {
938 Label size_tag_overflow, done; 945 Label size_tag_overflow, done;
939 __ leal(EBX, Address(EDX, TIMES_4, fixed_size)); 946 __ leal(EBX, Address(EDX, TIMES_4, fixed_size));
940 __ andl(EBX, Immediate(-kObjectAlignment)); 947 __ andl(EBX, Immediate(-kObjectAlignment));
941 __ cmpl(EBX, Immediate(RawObject::SizeTag::kMaxSizeTag)); 948 __ cmpl(EBX, Immediate(RawObject::SizeTag::kMaxSizeTag));
942 __ j(ABOVE, &size_tag_overflow, Assembler::kNearJump); 949 __ j(ABOVE, &size_tag_overflow, Assembler::kNearJump);
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
1124 // ECX: potential new object end and, if ECX != EBX, potential new 1131 // ECX: potential new object end and, if ECX != EBX, potential new
1125 // InstantiatedTypeArguments object start. 1132 // InstantiatedTypeArguments object start.
1126 } 1133 }
1127 // Check if the allocation fits into the remaining space. 1134 // Check if the allocation fits into the remaining space.
1128 // EAX: potential new object start. 1135 // EAX: potential new object start.
1129 // EBX: potential next object start. 1136 // EBX: potential next object start.
1130 __ cmpl(EBX, Address::Absolute(heap->EndAddress())); 1137 __ cmpl(EBX, Address::Absolute(heap->EndAddress()));
1131 if (FLAG_use_slow_path) { 1138 if (FLAG_use_slow_path) {
1132 __ jmp(&slow_case); 1139 __ jmp(&slow_case);
1133 } else { 1140 } else {
1134 __ j(ABOVE_EQUAL, &slow_case, Assembler::kNearJump); 1141 __ j(ABOVE_EQUAL, &slow_case);
1135 } 1142 }
1136 1143
1137 // Successfully allocated the object(s), now update top to point to 1144 // Successfully allocated the object(s), now update top to point to
1138 // next object start and initialize the object. 1145 // next object start and initialize the object.
1139 __ movl(Address::Absolute(heap->TopAddress()), EBX); 1146 __ movl(Address::Absolute(heap->TopAddress()), EBX);
1147 __ BumpAllocationCount(Heap::kNew, cls.id(), EDI);
1140 1148
1141 if (is_cls_parameterized) { 1149 if (is_cls_parameterized) {
1142 // Initialize the type arguments field in the object. 1150 // Initialize the type arguments field in the object.
1143 // EAX: new object start. 1151 // EAX: new object start.
1144 // ECX: potential new object end and, if ECX != EBX, potential new 1152 // ECX: potential new object end and, if ECX != EBX, potential new
1145 // InstantiatedTypeArguments object start. 1153 // InstantiatedTypeArguments object start.
1146 // EBX: next object start. 1154 // EBX: next object start.
1147 Label type_arguments_ready; 1155 Label type_arguments_ready;
1148 __ movl(EDI, Address(ESP, kObjectTypeArgumentsOffset)); 1156 __ movl(EDI, Address(ESP, kObjectTypeArgumentsOffset));
1149 __ cmpl(ECX, EBX); 1157 __ cmpl(ECX, EBX);
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
1294 __ cmpl(EBX, Address::Absolute(heap->EndAddress())); 1302 __ cmpl(EBX, Address::Absolute(heap->EndAddress()));
1295 if (FLAG_use_slow_path) { 1303 if (FLAG_use_slow_path) {
1296 __ jmp(&slow_case); 1304 __ jmp(&slow_case);
1297 } else { 1305 } else {
1298 __ j(ABOVE_EQUAL, &slow_case, Assembler::kNearJump); 1306 __ j(ABOVE_EQUAL, &slow_case, Assembler::kNearJump);
1299 } 1307 }
1300 1308
1301 // Successfully allocated the object, now update top to point to 1309 // Successfully allocated the object, now update top to point to
1302 // next object start and initialize the object. 1310 // next object start and initialize the object.
1303 __ movl(Address::Absolute(heap->TopAddress()), EBX); 1311 __ movl(Address::Absolute(heap->TopAddress()), EBX);
1312 // EBX: Size of allocation in bytes.
1313 __ subl(EBX, EAX);
1314 // EDX: Clobbered.
Ivan Posva 2013/12/12 13:53:24 This should not be necessary if the list of live r
1315 __ BumpAllocationCount(Heap::kNew, cls.id(), EBX, EDX);
1304 1316
1305 // EAX: new closure object. 1317 // EAX: new closure object.
1306 // ECX: new context object (only if is_implicit_closure). 1318 // ECX: new context object (only if is_implicit_closure).
1307 // Set the tags. 1319 // Set the tags.
1308 uword tags = 0; 1320 uword tags = 0;
1309 tags = RawObject::SizeTag::update(closure_size, tags); 1321 tags = RawObject::SizeTag::update(closure_size, tags);
1310 tags = RawObject::ClassIdTag::update(cls.id(), tags); 1322 tags = RawObject::ClassIdTag::update(cls.id(), tags);
1311 __ movl(Address(EAX, Instance::tags_offset()), Immediate(tags)); 1323 __ movl(Address(EAX, Instance::tags_offset()), Immediate(tags));
1312 1324
1313 // Initialize the function field in the object. 1325 // Initialize the function field in the object.
1314 // EAX: new closure object. 1326 // EAX: new closure object.
1315 // ECX: new context object (only if is_implicit_closure). 1327 // ECX: new context object (only if is_implicit_closure).
1316 // EBX: next object start.
1317 __ LoadObject(EDX, func); // Load function of closure to be allocated. 1328 __ LoadObject(EDX, func); // Load function of closure to be allocated.
1318 __ movl(Address(EAX, Closure::function_offset()), EDX); 1329 __ movl(Address(EAX, Closure::function_offset()), EDX);
1319 1330
1320 // Setup the context for this closure. 1331 // Setup the context for this closure.
1321 if (is_implicit_instance_closure) { 1332 if (is_implicit_instance_closure) {
1322 // Initialize the new context capturing the receiver. 1333 // Initialize the new context capturing the receiver.
1323 const Class& context_class = Class::ZoneHandle(Object::context_class()); 1334 const Class& context_class = Class::ZoneHandle(Object::context_class());
1324 // Set the tags. 1335 // Set the tags.
1325 uword tags = 0; 1336 uword tags = 0;
1326 tags = RawObject::SizeTag::update(context_size, tags); 1337 tags = RawObject::SizeTag::update(context_size, tags);
(...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after
2200 const Register temp = ECX; 2211 const Register temp = ECX;
2201 __ movl(left, Address(ESP, 2 * kWordSize)); 2212 __ movl(left, Address(ESP, 2 * kWordSize));
2202 __ movl(right, Address(ESP, 1 * kWordSize)); 2213 __ movl(right, Address(ESP, 1 * kWordSize));
2203 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); 2214 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp);
2204 __ ret(); 2215 __ ret();
2205 } 2216 }
2206 2217
2207 } // namespace dart 2218 } // namespace dart
2208 2219
2209 #endif // defined TARGET_ARCH_IA32 2220 #endif // defined TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698