OLD | NEW |
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 5331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5342 heap_size_limit_(0) { } | 5342 heap_size_limit_(0) { } |
5343 | 5343 |
5344 | 5344 |
5345 HeapSpaceStatistics::HeapSpaceStatistics(): space_name_(0), | 5345 HeapSpaceStatistics::HeapSpaceStatistics(): space_name_(0), |
5346 space_size_(0), | 5346 space_size_(0), |
5347 space_used_size_(0), | 5347 space_used_size_(0), |
5348 space_available_size_(0), | 5348 space_available_size_(0), |
5349 physical_space_size_(0) { } | 5349 physical_space_size_(0) { } |
5350 | 5350 |
5351 | 5351 |
| 5352 HeapObjectStatistics::HeapObjectStatistics() |
| 5353 : object_type_(nullptr), |
| 5354 object_sub_type_(nullptr), |
| 5355 object_count_(0), |
| 5356 object_size_(0) {} |
| 5357 |
5352 bool v8::V8::InitializeICU(const char* icu_data_file) { | 5358 bool v8::V8::InitializeICU(const char* icu_data_file) { |
5353 return i::InitializeICU(icu_data_file); | 5359 return i::InitializeICU(icu_data_file); |
5354 } | 5360 } |
5355 | 5361 |
5356 | 5362 |
5357 const char* v8::V8::GetVersion() { | 5363 const char* v8::V8::GetVersion() { |
5358 return i::Version::GetVersion(); | 5364 return i::Version::GetVersion(); |
5359 } | 5365 } |
5360 | 5366 |
5361 | 5367 |
(...skipping 1553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6915 | 6921 |
6916 space_statistics->space_name_ = heap->GetSpaceName(static_cast<int>(index)); | 6922 space_statistics->space_name_ = heap->GetSpaceName(static_cast<int>(index)); |
6917 space_statistics->space_size_ = space->CommittedMemory(); | 6923 space_statistics->space_size_ = space->CommittedMemory(); |
6918 space_statistics->space_used_size_ = space->SizeOfObjects(); | 6924 space_statistics->space_used_size_ = space->SizeOfObjects(); |
6919 space_statistics->space_available_size_ = space->Available(); | 6925 space_statistics->space_available_size_ = space->Available(); |
6920 space_statistics->physical_space_size_ = space->CommittedPhysicalMemory(); | 6926 space_statistics->physical_space_size_ = space->CommittedPhysicalMemory(); |
6921 return true; | 6927 return true; |
6922 } | 6928 } |
6923 | 6929 |
6924 | 6930 |
| 6931 size_t Isolate::NumberOfTrackedHeapObjectTypes() { |
| 6932 return i::Heap::OBJECT_STATS_COUNT; |
| 6933 } |
| 6934 |
| 6935 |
| 6936 bool Isolate::GetHeapObjectStatisticsAtLastGC( |
| 6937 HeapObjectStatistics* object_statistics, size_t type_index) { |
| 6938 if (!object_statistics) return false; |
| 6939 if (type_index >= i::Heap::OBJECT_STATS_COUNT) return false; |
| 6940 if (!i::FLAG_track_gc_object_stats) return false; |
| 6941 |
| 6942 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |
| 6943 i::Heap* heap = isolate->heap(); |
| 6944 const char* object_type; |
| 6945 const char* object_sub_type; |
| 6946 size_t object_count = heap->object_count_last_gc(type_index); |
| 6947 size_t object_size = heap->object_size_last_gc(type_index); |
| 6948 if (!heap->GetObjectTypeName(type_index, &object_type, &object_sub_type)) { |
| 6949 // There should be no objects counted when the type is unknown. |
| 6950 DCHECK_EQ(object_count, 0); |
| 6951 DCHECK_EQ(object_size, 0); |
| 6952 return false; |
| 6953 } |
| 6954 |
| 6955 object_statistics->object_type_ = object_type; |
| 6956 object_statistics->object_sub_type_ = object_sub_type; |
| 6957 object_statistics->object_count_ = object_count; |
| 6958 object_statistics->object_size_ = object_size; |
| 6959 return true; |
| 6960 } |
| 6961 |
| 6962 |
6925 void Isolate::GetStackSample(const RegisterState& state, void** frames, | 6963 void Isolate::GetStackSample(const RegisterState& state, void** frames, |
6926 size_t frames_limit, SampleInfo* sample_info) { | 6964 size_t frames_limit, SampleInfo* sample_info) { |
6927 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); | 6965 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |
6928 i::TickSample::GetStackSample(isolate, state, i::TickSample::kSkipCEntryFrame, | 6966 i::TickSample::GetStackSample(isolate, state, i::TickSample::kSkipCEntryFrame, |
6929 frames, frames_limit, sample_info); | 6967 frames, frames_limit, sample_info); |
6930 } | 6968 } |
6931 | 6969 |
6932 | 6970 |
6933 void Isolate::SetEventLogger(LogEventCallback that) { | 6971 void Isolate::SetEventLogger(LogEventCallback that) { |
6934 // Do not overwrite the event logger if we want to log explicitly. | 6972 // Do not overwrite the event logger if we want to log explicitly. |
(...skipping 1097 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8032 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 8070 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
8033 Address callback_address = | 8071 Address callback_address = |
8034 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8072 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
8035 VMState<EXTERNAL> state(isolate); | 8073 VMState<EXTERNAL> state(isolate); |
8036 ExternalCallbackScope call_scope(isolate, callback_address); | 8074 ExternalCallbackScope call_scope(isolate, callback_address); |
8037 callback(info); | 8075 callback(info); |
8038 } | 8076 } |
8039 | 8077 |
8040 | 8078 |
8041 } } // namespace v8::internal | 8079 } } // namespace v8::internal |
OLD | NEW |