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

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

Issue 10869063: Add attributions so printf like functions can have their arguments checked. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebased Created 8 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/freelist.cc ('k') | runtime/vm/heap_profiler.cc » ('j') | 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/heap.h" 5 #include "vm/heap.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/compiler_stats.h" 9 #include "vm/compiler_stats.h"
10 #include "vm/flags.h" 10 #include "vm/flags.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 } 67 }
68 68
69 69
70 uword Heap::AllocateOld(intptr_t size) { 70 uword Heap::AllocateOld(intptr_t size) {
71 ASSERT(Isolate::Current()->no_gc_scope_depth() == 0); 71 ASSERT(Isolate::Current()->no_gc_scope_depth() == 0);
72 uword addr = old_space_->TryAllocate(size); 72 uword addr = old_space_->TryAllocate(size);
73 if (addr == 0) { 73 if (addr == 0) {
74 CollectAllGarbage(); 74 CollectAllGarbage();
75 addr = old_space_->TryAllocate(size, PageSpace::kForceGrowth); 75 addr = old_space_->TryAllocate(size, PageSpace::kForceGrowth);
76 if (addr == 0) { 76 if (addr == 0) {
77 OS::PrintErr("Exhausted heap space, trying to allocate %d bytes.\n", 77 OS::PrintErr("Exhausted heap space, trying to allocate %"Pd" bytes.\n",
78 size); 78 size);
79 } 79 }
80 } 80 }
81 return addr; 81 return addr;
82 } 82 }
83 83
84 84
85 uword Heap::AllocateCode(PageSpace* space, intptr_t size) { 85 uword Heap::AllocateCode(PageSpace* space, intptr_t size) {
86 ASSERT(Isolate::Current()->no_gc_scope_depth() == 0); 86 ASSERT(Isolate::Current()->no_gc_scope_depth() == 0);
87 ASSERT(Utils::IsAligned(size, OS::PreferredCodeAlignment())); 87 ASSERT(Utils::IsAligned(size, OS::PreferredCodeAlignment()));
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 ObjectSet* allocated_set = isolate->heap()->CreateAllocatedObjectSet(); 304 ObjectSet* allocated_set = isolate->heap()->CreateAllocatedObjectSet();
305 VerifyPointersVisitor visitor(isolate, allocated_set); 305 VerifyPointersVisitor visitor(isolate, allocated_set);
306 isolate->heap()->IteratePointers(&visitor); 306 isolate->heap()->IteratePointers(&visitor);
307 delete allocated_set; 307 delete allocated_set;
308 // Only returning a value so that Heap::Validate can be called from an ASSERT. 308 // Only returning a value so that Heap::Validate can be called from an ASSERT.
309 return true; 309 return true;
310 } 310 }
311 311
312 312
313 void Heap::PrintSizes() const { 313 void Heap::PrintSizes() const {
314 OS::PrintErr("New space (%dk of %dk) " 314 OS::PrintErr("New space (%"Pd"k of %"Pd"k) "
315 "Old space (%dk of %dk) " 315 "Old space (%"Pd"k of %"Pd"k) "
316 "Code space (%dk of %dk)\n", 316 "Code space (%"Pd"k of %"Pd"k)\n",
317 (new_space_->in_use() / KB), (new_space_->capacity() / KB), 317 (new_space_->in_use() / KB), (new_space_->capacity() / KB),
318 (old_space_->in_use() / KB), (old_space_->capacity() / KB), 318 (old_space_->in_use() / KB), (old_space_->capacity() / KB),
319 (code_space_->in_use() / KB), (code_space_->capacity() / KB)); 319 (code_space_->in_use() / KB), (code_space_->capacity() / KB));
320 } 320 }
321 321
322 322
323 void Heap::Profile(Dart_HeapProfileWriteCallback callback, void* stream) const { 323 void Heap::Profile(Dart_HeapProfileWriteCallback callback, void* stream) const {
324 HeapProfiler profiler(callback, stream); 324 HeapProfiler profiler(callback, stream);
325 325
326 // Dump the root set. 326 // Dump the root set.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 isolate()->IncrementNoGCScopeDepth(); 367 isolate()->IncrementNoGCScopeDepth();
368 } 368 }
369 369
370 370
371 NoGCScope::~NoGCScope() { 371 NoGCScope::~NoGCScope() {
372 isolate()->DecrementNoGCScopeDepth(); 372 isolate()->DecrementNoGCScopeDepth();
373 } 373 }
374 #endif // defined(DEBUG) 374 #endif // defined(DEBUG)
375 375
376 } // namespace dart 376 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/freelist.cc ('k') | runtime/vm/heap_profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698