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

Side by Side Diff: runtime/vm/zone.h

Issue 2554983002: Created methods to surface zone memory information for each isolate and thread in JSON. (Closed)
Patch Set: Created methods to surface zone memory information for each isolate and thread in JSON. Created 4 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
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 #ifndef RUNTIME_VM_ZONE_H_ 5 #ifndef RUNTIME_VM_ZONE_H_
6 #define RUNTIME_VM_ZONE_H_ 6 #define RUNTIME_VM_ZONE_H_
7 7
8 #include "platform/utils.h" 8 #include "platform/utils.h"
9 #include "vm/allocation.h" 9 #include "vm/allocation.h"
10 #include "vm/handles.h" 10 #include "vm/handles.h"
11 #include "vm/json_stream.h"
11 #include "vm/thread.h" 12 #include "vm/thread.h"
12 #include "vm/memory_region.h" 13 #include "vm/memory_region.h"
13 14
14 namespace dart { 15 namespace dart {
15 16
16 // Zones support very fast allocation of small chunks of memory. The 17 // Zones support very fast allocation of small chunks of memory. The
17 // chunks cannot be deallocated individually, but instead zones 18 // chunks cannot be deallocated individually, but instead zones
18 // support deallocating all chunks in one fast operation. 19 // support deallocating all chunks in one fast operation.
19 20
20 class Zone { 21 class Zone {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 // due to internal fragmentation in the segments. 66 // due to internal fragmentation in the segments.
66 intptr_t SizeInBytes() const; 67 intptr_t SizeInBytes() const;
67 68
68 // Structure for managing handles allocation. 69 // Structure for managing handles allocation.
69 VMHandles* handles() { return &handles_; } 70 VMHandles* handles() { return &handles_; }
70 71
71 void VisitObjectPointers(ObjectPointerVisitor* visitor); 72 void VisitObjectPointers(ObjectPointerVisitor* visitor);
72 73
73 Zone* previous() const { return previous_; } 74 Zone* previous() const { return previous_; }
74 75
76 #ifndef RELEASE
77 void PrintToJSONObject(JSONObject* obj) const;
78 #endif
79
75 private: 80 private:
76 Zone(); 81 Zone();
77 ~Zone(); // Delete all memory associated with the zone. 82 ~Zone(); // Delete all memory associated with the zone.
78 83
79 // All pointers returned from AllocateUnsafe() and New() have this alignment. 84 // All pointers returned from AllocateUnsafe() and New() have this alignment.
80 static const intptr_t kAlignment = kDoubleSize; 85 static const intptr_t kAlignment = kDoubleSize;
81 86
82 // Default initial chunk size. 87 // Default initial chunk size.
83 static const intptr_t kInitialChunkSize = 1 * KB; 88 static const intptr_t kInitialChunkSize = 1 * KB;
84 89
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 if (old_data != 0) { 257 if (old_data != 0) {
253 memmove(reinterpret_cast<void*>(new_data), 258 memmove(reinterpret_cast<void*>(new_data),
254 reinterpret_cast<void*>(old_data), old_len * kElementSize); 259 reinterpret_cast<void*>(old_data), old_len * kElementSize);
255 } 260 }
256 return new_data; 261 return new_data;
257 } 262 }
258 263
259 } // namespace dart 264 } // namespace dart
260 265
261 #endif // RUNTIME_VM_ZONE_H_ 266 #endif // RUNTIME_VM_ZONE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698