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

Side by Side Diff: runtime/vm/object.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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/object.h" 5 #include "vm/object.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/cpu.h" 10 #include "vm/cpu.h"
(...skipping 1441 matching lines...) Expand 10 before | Expand all | Expand 10 after
1452 1452
1453 uword address = heap->Allocate(size, space); 1453 uword address = heap->Allocate(size, space);
1454 if (address == 0) { 1454 if (address == 0) {
1455 // Use the preallocated out of memory exception to avoid calling 1455 // Use the preallocated out of memory exception to avoid calling
1456 // into dart code or allocating any code. 1456 // into dart code or allocating any code.
1457 const Instance& exception = 1457 const Instance& exception =
1458 Instance::Handle(isolate->object_store()->out_of_memory()); 1458 Instance::Handle(isolate->object_store()->out_of_memory());
1459 Exceptions::Throw(exception); 1459 Exceptions::Throw(exception);
1460 UNREACHABLE(); 1460 UNREACHABLE();
1461 } 1461 }
1462 if (space == Heap::kNew) {
1463 isolate->class_table()->ReportAllocationNew(cls_id, size);
1464 } else {
1465 isolate->class_table()->ReportAllocationOld(cls_id, size);
1466 }
1462 NoGCScope no_gc; 1467 NoGCScope no_gc;
1463 InitializeObject(address, cls_id, size); 1468 InitializeObject(address, cls_id, size);
1464 RawObject* raw_obj = reinterpret_cast<RawObject*>(address + kHeapObjectTag); 1469 RawObject* raw_obj = reinterpret_cast<RawObject*>(address + kHeapObjectTag);
1465 ASSERT(cls_id == RawObject::ClassIdTag::decode(raw_obj->ptr()->tags_)); 1470 ASSERT(cls_id == RawObject::ClassIdTag::decode(raw_obj->ptr()->tags_));
1466 return raw_obj; 1471 return raw_obj;
1467 } 1472 }
1468 1473
1469 1474
1470 class StoreBufferUpdateVisitor : public ObjectPointerVisitor { 1475 class StoreBufferUpdateVisitor : public ObjectPointerVisitor {
1471 public: 1476 public:
(...skipping 14884 matching lines...) Expand 10 before | Expand all | Expand 10 after
16356 return "_MirrorReference"; 16361 return "_MirrorReference";
16357 } 16362 }
16358 16363
16359 16364
16360 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { 16365 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const {
16361 Instance::PrintToJSONStream(stream, ref); 16366 Instance::PrintToJSONStream(stream, ref);
16362 } 16367 }
16363 16368
16364 16369
16365 } // namespace dart 16370 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698