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

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

Issue 2617513004: Revert "Added isolate + thread high watermark tracking to Observatory" (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « 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 25 matching lines...) Expand all
36 uword address(int n) { return reinterpret_cast<uword>(this) + n; } 36 uword address(int n) { return reinterpret_cast<uword>(this) + n; }
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 Thread* current_thread = Thread::Current();
47 while (current != NULL) { 46 while (current != NULL) {
48 if (current_thread != NULL) {
49 // TODO(bkonyi) Handle special case of segment deletion within native
50 // isolate.
51 current_thread->DecrementMemoryUsage(current->size());
52 }
53 Segment* next = current->next(); 47 Segment* next = current->next();
54 #ifdef DEBUG 48 #ifdef DEBUG
55 // Zap the entire current segment (including the header). 49 // Zap the entire current segment (including the header).
56 memset(current, kZapDeletedByte, current->size()); 50 memset(current, kZapDeletedByte, current->size());
57 #endif 51 #endif
58 Segment::Delete(current); 52 Segment::Delete(current);
59 current = next; 53 current = next;
60 } 54 }
61 } 55 }
62 56
63 57
64 Zone::Segment* Zone::Segment::New(intptr_t size, Zone::Segment* next) { 58 Zone::Segment* Zone::Segment::New(intptr_t size, Zone::Segment* next) {
65 ASSERT(size >= 0); 59 ASSERT(size >= 0);
66 Segment* result = reinterpret_cast<Segment*>(malloc(size)); 60 Segment* result = reinterpret_cast<Segment*>(malloc(size));
67 if (result == NULL) { 61 if (result == NULL) {
68 OUT_OF_MEMORY(); 62 OUT_OF_MEMORY();
69 } 63 }
70 ASSERT(Utils::IsAligned(result->start(), Zone::kAlignment)); 64 ASSERT(Utils::IsAligned(result->start(), Zone::kAlignment));
71 #ifdef DEBUG 65 #ifdef DEBUG
72 // Zap the entire allocated segment (including the header). 66 // Zap the entire allocated segment (including the header).
73 memset(result, kZapUninitializedByte, size); 67 memset(result, kZapUninitializedByte, size);
74 #endif 68 #endif
75 result->next_ = next; 69 result->next_ = next;
76 result->size_ = size; 70 result->size_ = size;
77 if (Thread::Current() != NULL) {
78 // TODO(bkonyi) Handle special case of segment creation within native
79 // isolate.
80 Thread::Current()->IncrementMemoryUsage(size);
81 }
82 return result; 71 return result;
83 } 72 }
84 73
85 74
86 Zone::Zone() 75 Zone::Zone()
87 : initial_buffer_(buffer_, kInitialChunkSize), 76 : initial_buffer_(buffer_, kInitialChunkSize),
88 position_(initial_buffer_.start()), 77 position_(initial_buffer_.start()),
89 limit_(initial_buffer_.end()), 78 limit_(initial_buffer_.end()),
90 head_(NULL), 79 head_(NULL),
91 large_segments_(NULL), 80 large_segments_(NULL),
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 ASSERT(thread()->zone() == &zone_); 303 ASSERT(thread()->zone() == &zone_);
315 thread()->set_zone(zone_.previous_); 304 thread()->set_zone(zone_.previous_);
316 if (FLAG_trace_zones) { 305 if (FLAG_trace_zones) {
317 OS::PrintErr("*** Deleting Stack zone 0x%" Px "(0x%" Px ")\n", 306 OS::PrintErr("*** Deleting Stack zone 0x%" Px "(0x%" Px ")\n",
318 reinterpret_cast<intptr_t>(this), 307 reinterpret_cast<intptr_t>(this),
319 reinterpret_cast<intptr_t>(&zone_)); 308 reinterpret_cast<intptr_t>(&zone_));
320 } 309 }
321 } 310 }
322 311
323 } // namespace dart 312 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/thread_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698