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

Side by Side Diff: src/heap/heap.cc

Issue 2240603003: Add malloced and peak malloced to OOM handler (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix typo Created 4 years, 4 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 | « src/heap/heap.h ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/heap/heap.h" 5 #include "src/heap/heap.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api.h" 8 #include "src/api.h"
9 #include "src/ast/context-slot-cache.h" 9 #include "src/ast/context-slot-cache.h"
10 #include "src/base/bits.h" 10 #include "src/base/bits.h"
(...skipping 5037 matching lines...) Expand 10 before | Expand all | Expand 10 after
5048 } 5048 }
5049 5049
5050 5050
5051 bool Heap::ConfigureHeapDefault() { return ConfigureHeap(0, 0, 0, 0); } 5051 bool Heap::ConfigureHeapDefault() { return ConfigureHeap(0, 0, 0, 0); }
5052 5052
5053 5053
5054 void Heap::RecordStats(HeapStats* stats, bool take_snapshot) { 5054 void Heap::RecordStats(HeapStats* stats, bool take_snapshot) {
5055 *stats->start_marker = HeapStats::kStartMarker; 5055 *stats->start_marker = HeapStats::kStartMarker;
5056 *stats->end_marker = HeapStats::kEndMarker; 5056 *stats->end_marker = HeapStats::kEndMarker;
5057 *stats->new_space_size = new_space_.SizeAsInt(); 5057 *stats->new_space_size = new_space_.SizeAsInt();
5058 *stats->new_space_capacity = static_cast<int>(new_space_.Capacity()); 5058 *stats->new_space_capacity = new_space_.Capacity();
5059 *stats->old_space_size = old_space_->SizeOfObjects(); 5059 *stats->old_space_size = old_space_->SizeOfObjects();
5060 *stats->old_space_capacity = old_space_->Capacity(); 5060 *stats->old_space_capacity = old_space_->Capacity();
5061 *stats->code_space_size = code_space_->SizeOfObjects(); 5061 *stats->code_space_size = code_space_->SizeOfObjects();
5062 *stats->code_space_capacity = code_space_->Capacity(); 5062 *stats->code_space_capacity = code_space_->Capacity();
5063 *stats->map_space_size = map_space_->SizeOfObjects(); 5063 *stats->map_space_size = map_space_->SizeOfObjects();
5064 *stats->map_space_capacity = map_space_->Capacity(); 5064 *stats->map_space_capacity = map_space_->Capacity();
5065 *stats->lo_space_size = lo_space_->Size(); 5065 *stats->lo_space_size = lo_space_->Size();
5066 isolate_->global_handles()->RecordStats(stats); 5066 isolate_->global_handles()->RecordStats(stats);
5067 *stats->memory_allocator_size = memory_allocator()->Size(); 5067 *stats->memory_allocator_size = memory_allocator()->Size();
5068 *stats->memory_allocator_capacity = 5068 *stats->memory_allocator_capacity =
5069 memory_allocator()->Size() + memory_allocator()->Available(); 5069 memory_allocator()->Size() + memory_allocator()->Available();
5070 *stats->os_error = base::OS::GetLastError(); 5070 *stats->os_error = base::OS::GetLastError();
5071 memory_allocator()->Available(); 5071 *stats->malloced_memory = isolate_->allocator()->GetCurrentMemoryUsage();
5072 *stats->malloced_peak_memory = isolate_->allocator()->GetMaxMemoryUsage();
5072 if (take_snapshot) { 5073 if (take_snapshot) {
5073 HeapIterator iterator(this); 5074 HeapIterator iterator(this);
5074 for (HeapObject* obj = iterator.next(); obj != NULL; 5075 for (HeapObject* obj = iterator.next(); obj != NULL;
5075 obj = iterator.next()) { 5076 obj = iterator.next()) {
5076 InstanceType type = obj->map()->instance_type(); 5077 InstanceType type = obj->map()->instance_type();
5077 DCHECK(0 <= type && type <= LAST_TYPE); 5078 DCHECK(0 <= type && type <= LAST_TYPE);
5078 stats->objects_per_type[type]++; 5079 stats->objects_per_type[type]++;
5079 stats->size_per_type[type] += obj->Size(); 5080 stats->size_per_type[type] += obj->Size();
5080 } 5081 }
5081 } 5082 }
(...skipping 1403 matching lines...) Expand 10 before | Expand all | Expand 10 after
6485 } 6486 }
6486 6487
6487 6488
6488 // static 6489 // static
6489 int Heap::GetStaticVisitorIdForMap(Map* map) { 6490 int Heap::GetStaticVisitorIdForMap(Map* map) {
6490 return StaticVisitorBase::GetVisitorId(map); 6491 return StaticVisitorBase::GetVisitorId(map);
6491 } 6492 }
6492 6493
6493 } // namespace internal 6494 } // namespace internal
6494 } // namespace v8 6495 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/heap.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698