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 5330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 Loading... | |
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() { | |
6929 return i::Heap::OBJECT_STATS_COUNT; | |
6930 } | |
ulan
2015/05/06 12:46:02
Two new-lines between functions. Please run "git c
ssid
2015/05/07 13:53:03
Done.
| |
6931 | |
6932 bool Isolate::GetLastGcObjectStatistics(HeapObjectStatistics* object_statistics, | |
6933 size_t type_index) { | |
6934 if (!object_statistics) | |
6935 return false; | |
ulan
2015/05/06 12:46:02
Either use {} or put return statements in the prev
ssid
2015/05/07 13:53:03
Done.
| |
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) { | |
ulan
2015/05/06 12:46:02
This case shouldn't be happening. Could you please
ssid
2015/05/07 13:53:03
As discussed offline, there are string categories
| |
6947 // There should be no objects counted when the type is unknown. | |
6948 DCHECK_EQ(object_count, 0); | |
6949 DCHECK_EQ(object_size, 0); | |
6950 return false; | |
6951 } | |
6952 | |
6953 object_statistics->object_type_ = object_type; | |
6954 object_statistics->object_count_ = object_count; | |
6955 object_statistics->object_size_ = object_size; | |
6956 return true; | |
6957 } | |
6958 | |
6959 | |
6924 void Isolate::GetStackSample(const RegisterState& state, void** frames, | 6960 void Isolate::GetStackSample(const RegisterState& state, void** frames, |
6925 size_t frames_limit, SampleInfo* sample_info) { | 6961 size_t frames_limit, SampleInfo* sample_info) { |
6926 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); | 6962 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |
6927 i::TickSample::GetStackSample(isolate, state, i::TickSample::kSkipCEntryFrame, | 6963 i::TickSample::GetStackSample(isolate, state, i::TickSample::kSkipCEntryFrame, |
6928 frames, frames_limit, sample_info); | 6964 frames, frames_limit, sample_info); |
6929 } | 6965 } |
6930 | 6966 |
6931 | 6967 |
6932 void Isolate::SetEventLogger(LogEventCallback that) { | 6968 void Isolate::SetEventLogger(LogEventCallback that) { |
6933 // Do not overwrite the event logger if we want to log explicitly. | 6969 // 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... | |
8031 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 8067 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
8032 Address callback_address = | 8068 Address callback_address = |
8033 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8069 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
8034 VMState<EXTERNAL> state(isolate); | 8070 VMState<EXTERNAL> state(isolate); |
8035 ExternalCallbackScope call_scope(isolate, callback_address); | 8071 ExternalCallbackScope call_scope(isolate, callback_address); |
8036 callback(info); | 8072 callback(info); |
8037 } | 8073 } |
8038 | 8074 |
8039 | 8075 |
8040 } } // namespace v8::internal | 8076 } } // namespace v8::internal |
OLD | NEW |