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

Side by Side Diff: src/api.cc

Issue 1113233002: Adding api to get last gc object statistics for chrome://tracing. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Adding type name. Created 5 years, 7 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
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/api.h" 5 #include "src/api.h"
6 6
7 #include <string.h> // For memcpy, strlen. 7 #include <string.h> // For memcpy, strlen.
8 #ifdef V8_USE_ADDRESS_SANITIZER 8 #ifdef V8_USE_ADDRESS_SANITIZER
9 #include <sanitizer/asan_interface.h> 9 #include <sanitizer/asan_interface.h>
10 #endif // V8_USE_ADDRESS_SANITIZER 10 #endif // V8_USE_ADDRESS_SANITIZER
(...skipping 5330 matching lines...) Expand 10 before | Expand all | Expand 10 after
5341 heap_size_limit_(0) { } 5341 heap_size_limit_(0) { }
5342 5342
5343 5343
5344 HeapSpaceStatistics::HeapSpaceStatistics(): space_name_(0), 5344 HeapSpaceStatistics::HeapSpaceStatistics(): space_name_(0),
5345 space_size_(0), 5345 space_size_(0),
5346 space_used_size_(0), 5346 space_used_size_(0),
5347 space_available_size_(0), 5347 space_available_size_(0),
5348 physical_space_size_(0) { } 5348 physical_space_size_(0) { }
5349 5349
5350 5350
5351 HeapObjectStatistics::HeapObjectStatistics(): object_type_(nullptr),
5352 object_count_(0),
5353 object_size_(0) { }
5354
5351 bool v8::V8::InitializeICU(const char* icu_data_file) { 5355 bool v8::V8::InitializeICU(const char* icu_data_file) {
5352 return i::InitializeICU(icu_data_file); 5356 return i::InitializeICU(icu_data_file);
5353 } 5357 }
5354 5358
5355 5359
5356 const char* v8::V8::GetVersion() { 5360 const char* v8::V8::GetVersion() {
5357 return i::Version::GetVersion(); 5361 return i::Version::GetVersion();
5358 } 5362 }
5359 5363
5360 5364
(...skipping 1553 matching lines...) Expand 10 before | Expand all | Expand 10 after
6914 6918
6915 space_statistics->space_name_ = heap->GetSpaceName(static_cast<int>(index)); 6919 space_statistics->space_name_ = heap->GetSpaceName(static_cast<int>(index));
6916 space_statistics->space_size_ = space->CommittedMemory(); 6920 space_statistics->space_size_ = space->CommittedMemory();
6917 space_statistics->space_used_size_ = space->SizeOfObjects(); 6921 space_statistics->space_used_size_ = space->SizeOfObjects();
6918 space_statistics->space_available_size_ = space->Available(); 6922 space_statistics->space_available_size_ = space->Available();
6919 space_statistics->physical_space_size_ = space->CommittedPhysicalMemory(); 6923 space_statistics->physical_space_size_ = space->CommittedPhysicalMemory();
6920 return true; 6924 return true;
6921 } 6925 }
6922 6926
6923 6927
6928 size_t Isolate::NumberOfHeapObjectsTypes() {
ssid 2015/05/05 14:26:16 primiano@ here is the definition.
6929 return i::Heap::OBJECT_STATS_COUNT;
6930 }
6931
6932 bool Isolate::GetLastGcObjectStatistics(HeapObjectStatistics* object_statistics,
6933 size_t type_index) {
6934 if (!object_statistics)
6935 return false;
6936 if (type_index >= i::Heap::OBJECT_STATS_COUNT)
6937 return false;
6938 if (!i::FLAG_track_gc_object_stats)
6939 return false;
6940
6941 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
6942 i::Heap* heap = isolate->heap();
6943 const char* object_type = heap->GetObjectTypeName(type_index);
6944 size_t object_count = heap->object_count_last_gc(type_index);
6945 size_t object_size = heap->object_size_last_gc(type_index);
6946 if (object_type == nullptr) {
Primiano Tucci (use gerrit) 2015/05/05 14:17:53 Is object type ever expected to be null? If so why
ssid 2015/05/05 14:26:16 The object type can be null in some cases, there a
6947 DCHECK_EQ(object_count, 0);
6948 DCHECK_EQ(object_size, 0);
6949 return false;
6950 }
6951
6952 object_statistics->object_type_ = object_type;
6953 object_statistics->object_count_ = object_count;
6954 object_statistics->object_size_ = object_size;
6955 return true;
6956 }
6957
6958
6924 void Isolate::GetStackSample(const RegisterState& state, void** frames, 6959 void Isolate::GetStackSample(const RegisterState& state, void** frames,
6925 size_t frames_limit, SampleInfo* sample_info) { 6960 size_t frames_limit, SampleInfo* sample_info) {
6926 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); 6961 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
6927 i::TickSample::GetStackSample(isolate, state, i::TickSample::kSkipCEntryFrame, 6962 i::TickSample::GetStackSample(isolate, state, i::TickSample::kSkipCEntryFrame,
6928 frames, frames_limit, sample_info); 6963 frames, frames_limit, sample_info);
6929 } 6964 }
6930 6965
6931 6966
6932 void Isolate::SetEventLogger(LogEventCallback that) { 6967 void Isolate::SetEventLogger(LogEventCallback that) {
6933 // Do not overwrite the event logger if we want to log explicitly. 6968 // Do not overwrite the event logger if we want to log explicitly.
(...skipping 1097 matching lines...) Expand 10 before | Expand all | Expand 10 after
8031 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 8066 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
8032 Address callback_address = 8067 Address callback_address =
8033 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 8068 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
8034 VMState<EXTERNAL> state(isolate); 8069 VMState<EXTERNAL> state(isolate);
8035 ExternalCallbackScope call_scope(isolate, callback_address); 8070 ExternalCallbackScope call_scope(isolate, callback_address);
8036 callback(info); 8071 callback(info);
8037 } 8072 }
8038 8073
8039 8074
8040 } } // namespace v8::internal 8075 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698