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

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

Issue 2608463002: Added isolate + thread high watermark tracking to Observatory (Closed)
Patch Set: Created 3 years, 12 months 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
« runtime/vm/isolate.cc ('K') | « runtime/vm/thread_test.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) 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/zone.h" 5 #include "vm/zone.h"
6 6
7 #include "platform/assert.h" 7 #include "platform/assert.h"
8 #include "platform/utils.h" 8 #include "platform/utils.h"
9 #include "vm/flags.h" 9 #include "vm/flags.h"
10 #include "vm/handles_impl.h" 10 #include "vm/handles_impl.h"
(...skipping 26 matching lines...) Expand all
37 37
38 static void Delete(Segment* segment) { free(segment); } 38 static void Delete(Segment* segment) { free(segment); }
39 39
40 DISALLOW_IMPLICIT_CONSTRUCTORS(Segment); 40 DISALLOW_IMPLICIT_CONSTRUCTORS(Segment);
41 }; 41 };
42 42
43 43
44 void Zone::Segment::DeleteSegmentList(Segment* head) { 44 void Zone::Segment::DeleteSegmentList(Segment* head) {
45 Segment* current = head; 45 Segment* current = head;
46 while (current != NULL) { 46 while (current != NULL) {
47 if (Thread::Current() != NULL) {
48 Thread::Current()->DecrementThreadMemoryUsage(current->size());
49 }
siva 2016/12/27 22:09:26 Please hoist Thread:Current() outside the loop int
bkonyi 2016/12/28 00:09:58 Done. There's a case when running the unit tests
siva 2016/12/28 17:52:35 It can be Null when the native IO isolate is alloc
bkonyi 2016/12/28 19:00:49 I've added a TODO to handle the special case when
47 Segment* next = current->next(); 50 Segment* next = current->next();
48 #ifdef DEBUG 51 #ifdef DEBUG
49 // Zap the entire current segment (including the header). 52 // Zap the entire current segment (including the header).
50 memset(current, kZapDeletedByte, current->size()); 53 memset(current, kZapDeletedByte, current->size());
51 #endif 54 #endif
52 Segment::Delete(current); 55 Segment::Delete(current);
53 current = next; 56 current = next;
54 } 57 }
55 } 58 }
56 59
57 60
58 Zone::Segment* Zone::Segment::New(intptr_t size, Zone::Segment* next) { 61 Zone::Segment* Zone::Segment::New(intptr_t size, Zone::Segment* next) {
59 ASSERT(size >= 0); 62 ASSERT(size >= 0);
60 Segment* result = reinterpret_cast<Segment*>(malloc(size)); 63 Segment* result = reinterpret_cast<Segment*>(malloc(size));
61 if (result == NULL) { 64 if (result == NULL) {
62 OUT_OF_MEMORY(); 65 OUT_OF_MEMORY();
63 } 66 }
64 ASSERT(Utils::IsAligned(result->start(), Zone::kAlignment)); 67 ASSERT(Utils::IsAligned(result->start(), Zone::kAlignment));
65 #ifdef DEBUG 68 #ifdef DEBUG
66 // Zap the entire allocated segment (including the header). 69 // Zap the entire allocated segment (including the header).
67 memset(result, kZapUninitializedByte, size); 70 memset(result, kZapUninitializedByte, size);
68 #endif 71 #endif
69 result->next_ = next; 72 result->next_ = next;
70 result->size_ = size; 73 result->size_ = size;
74 if (Thread::Current() != NULL) {
75 Thread::Current()->IncrementThreadMemoryUsage(size);
76 }
71 return result; 77 return result;
72 } 78 }
73 79
74 80
75 Zone::Zone() 81 Zone::Zone()
76 : initial_buffer_(buffer_, kInitialChunkSize), 82 : initial_buffer_(buffer_, kInitialChunkSize),
77 position_(initial_buffer_.start()), 83 position_(initial_buffer_.start()),
78 limit_(initial_buffer_.end()), 84 limit_(initial_buffer_.end()),
79 head_(NULL), 85 head_(NULL),
80 large_segments_(NULL), 86 large_segments_(NULL),
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 ASSERT(thread()->zone() == &zone_); 309 ASSERT(thread()->zone() == &zone_);
304 thread()->set_zone(zone_.previous_); 310 thread()->set_zone(zone_.previous_);
305 if (FLAG_trace_zones) { 311 if (FLAG_trace_zones) {
306 OS::PrintErr("*** Deleting Stack zone 0x%" Px "(0x%" Px ")\n", 312 OS::PrintErr("*** Deleting Stack zone 0x%" Px "(0x%" Px ")\n",
307 reinterpret_cast<intptr_t>(this), 313 reinterpret_cast<intptr_t>(this),
308 reinterpret_cast<intptr_t>(&zone_)); 314 reinterpret_cast<intptr_t>(&zone_));
309 } 315 }
310 } 316 }
311 317
312 } // namespace dart 318 } // namespace dart
OLDNEW
« runtime/vm/isolate.cc ('K') | « runtime/vm/thread_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698