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

Side by Side Diff: runtime/vm/stub_code_mips.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 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_MIPS) 6 #if defined(TARGET_ARCH_MIPS)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/code_generator.h" 9 #include "vm/code_generator.h"
10 #include "vm/compiler.h" 10 #include "vm/compiler.h"
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 __ lw(CMPRES1, Address(T0, Scavenger::end_offset())); 693 __ lw(CMPRES1, Address(T0, Scavenger::end_offset()));
694 __ BranchUnsignedGreaterEqual(T2, CMPRES1, &slow_case); 694 __ BranchUnsignedGreaterEqual(T2, CMPRES1, &slow_case);
695 695
696 // Successfully allocated the object(s), now update top to point to 696 // Successfully allocated the object(s), now update top to point to
697 // next object start and initialize the object. 697 // next object start and initialize the object.
698 // V0: potential new object start. 698 // V0: potential new object start.
699 // T2: potential next object start. 699 // T2: potential next object start.
700 // T0: Points to new space object. 700 // T0: Points to new space object.
701 __ sw(T2, Address(T0, Scavenger::top_offset())); 701 __ sw(T2, Address(T0, Scavenger::top_offset()));
702 __ addiu(V0, V0, Immediate(kHeapObjectTag)); 702 __ addiu(V0, V0, Immediate(kHeapObjectTag));
703 // T1: Size of allocation in bytes.
704 __ subu(T1, T2, V0);
705 __ UpdateAllocationStatsWithSize(kArrayCid, T1, T5);
703 706
704 // V0: new object start as a tagged pointer. 707 // V0: new object start as a tagged pointer.
705 // A0: array element type. 708 // A0: array element type.
706 // A1: Array length as Smi. 709 // A1: Array length as Smi.
707 // T2: new object end address. 710 // T2: new object end address.
708 711
709 // Store the type argument field. 712 // Store the type argument field.
710 __ StoreIntoObjectNoBarrier( 713 __ StoreIntoObjectNoBarrier(
711 V0, 714 V0,
712 FieldAddress(V0, Array::type_arguments_offset()), 715 FieldAddress(V0, Array::type_arguments_offset()),
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
1095 } 1098 }
1096 1099
1097 // Successfully allocated the object, now update top to point to 1100 // Successfully allocated the object, now update top to point to
1098 // next object start and initialize the object. 1101 // next object start and initialize the object.
1099 // V0: new object. 1102 // V0: new object.
1100 // T1: number of context variables. 1103 // T1: number of context variables.
1101 // T2: object size. 1104 // T2: object size.
1102 // T3: next object start. 1105 // T3: next object start.
1103 __ sw(T3, Address(T5, 0)); 1106 __ sw(T3, Address(T5, 0));
1104 __ addiu(V0, V0, Immediate(kHeapObjectTag)); 1107 __ addiu(V0, V0, Immediate(kHeapObjectTag));
1108 __ UpdateAllocationStatsWithSize(context_class.id(), T2, T5);
1105 1109
1106 // Calculate the size tag. 1110 // Calculate the size tag.
1107 // V0: new object. 1111 // V0: new object.
1108 // T1: number of context variables. 1112 // T1: number of context variables.
1109 // T2: object size. 1113 // T2: object size.
1110 const intptr_t shift = RawObject::kSizeTagBit - kObjectAlignmentLog2; 1114 const intptr_t shift = RawObject::kSizeTagBit - kObjectAlignmentLog2;
1111 __ LoadImmediate(TMP, RawObject::SizeTag::kMaxSizeTag); 1115 __ LoadImmediate(TMP, RawObject::SizeTag::kMaxSizeTag);
1112 __ sltu(CMPRES1, TMP, T2); // CMPRES1 = T2 > TMP ? 1 : 0. 1116 __ sltu(CMPRES1, TMP, T2); // CMPRES1 = T2 > TMP ? 1 : 0.
1113 __ movn(T2, ZR, CMPRES1); // T2 = CMPRES1 != 0 ? 0 : T2. 1117 __ movn(T2, ZR, CMPRES1); // T2 = CMPRES1 != 0 ? 0 : T2.
1114 __ sll(TMP, T2, shift); // TMP = T2 << shift. 1118 __ sll(TMP, T2, shift); // TMP = T2 << shift.
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
1377 __ addiu(T4, T4, Immediate(kWordSize)); 1381 __ addiu(T4, T4, Immediate(kWordSize));
1378 __ bne(T4, T3, &loop); 1382 __ bne(T4, T3, &loop);
1379 __ delay_slot()->sw(T7, Address(T4, -kWordSize)); 1383 __ delay_slot()->sw(T7, Address(T4, -kWordSize));
1380 __ Bind(&loop_exit); 1384 __ Bind(&loop_exit);
1381 } 1385 }
1382 if (is_cls_parameterized) { 1386 if (is_cls_parameterized) {
1383 // R1: new object type arguments. 1387 // R1: new object type arguments.
1384 // Set the type arguments in the new object. 1388 // Set the type arguments in the new object.
1385 __ sw(T1, Address(T2, cls.type_arguments_field_offset())); 1389 __ sw(T1, Address(T2, cls.type_arguments_field_offset()));
1386 } 1390 }
1391 __ UpdateAllocationStats(cls.id(), T5);
1387 // Done allocating and initializing the instance. 1392 // Done allocating and initializing the instance.
1388 // T2: new object still missing its heap tag. 1393 // T2: new object still missing its heap tag.
1389 __ Ret(); 1394 __ Ret();
1390 __ delay_slot()->addiu(V0, T2, Immediate(kHeapObjectTag)); 1395 __ delay_slot()->addiu(V0, T2, Immediate(kHeapObjectTag));
1391 1396
1392 __ Bind(&slow_case); 1397 __ Bind(&slow_case);
1393 } 1398 }
1394 if (is_cls_parameterized) { 1399 if (is_cls_parameterized) {
1395 __ lw(T1, Address(SP, 1 * kWordSize)); 1400 __ lw(T1, Address(SP, 1 * kWordSize));
1396 __ lw(T0, Address(SP, 0 * kWordSize)); 1401 __ lw(T0, Address(SP, 0 * kWordSize));
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
1466 __ lw(CMPRES1, Address(TMP)); 1471 __ lw(CMPRES1, Address(TMP));
1467 if (FLAG_use_slow_path) { 1472 if (FLAG_use_slow_path) {
1468 __ b(&slow_case); 1473 __ b(&slow_case);
1469 } else { 1474 } else {
1470 __ BranchUnsignedGreaterEqual(T3, CMPRES1, &slow_case); 1475 __ BranchUnsignedGreaterEqual(T3, CMPRES1, &slow_case);
1471 } 1476 }
1472 1477
1473 // Successfully allocated the object, now update top to point to 1478 // Successfully allocated the object, now update top to point to
1474 // next object start and initialize the object. 1479 // next object start and initialize the object.
1475 __ sw(T3, Address(T5)); 1480 __ sw(T3, Address(T5));
1481 // T3: Size of allocation in bytes.
1482 __ subu(T3, T3, T2);
1483 __ UpdateAllocationStatsWithSize(cls.id(), T3, T5);
1476 1484
1477 // T2: new closure object. 1485 // T2: new closure object.
1478 // T4: new context object (only if is_implicit_closure). 1486 // T4: new context object (only if is_implicit_closure).
1479 // Set the tags. 1487 // Set the tags.
1480 uword tags = 0; 1488 uword tags = 0;
1481 tags = RawObject::SizeTag::update(closure_size, tags); 1489 tags = RawObject::SizeTag::update(closure_size, tags);
1482 tags = RawObject::ClassIdTag::update(cls.id(), tags); 1490 tags = RawObject::ClassIdTag::update(cls.id(), tags);
1483 __ LoadImmediate(T0, tags); 1491 __ LoadImmediate(T0, tags);
1484 __ sw(T0, Address(T2, Instance::tags_offset())); 1492 __ sw(T0, Address(T2, Instance::tags_offset()));
1485 1493
(...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after
2434 const Register right = T0; 2442 const Register right = T0;
2435 __ lw(left, Address(SP, 1 * kWordSize)); 2443 __ lw(left, Address(SP, 1 * kWordSize));
2436 __ lw(right, Address(SP, 0 * kWordSize)); 2444 __ lw(right, Address(SP, 0 * kWordSize));
2437 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp1, temp2); 2445 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp1, temp2);
2438 __ Ret(); 2446 __ Ret();
2439 } 2447 }
2440 2448
2441 } // namespace dart 2449 } // namespace dart
2442 2450
2443 #endif // defined TARGET_ARCH_MIPS 2451 #endif // defined TARGET_ARCH_MIPS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698