Chromium Code Reviews| 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 5445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5456 } | 5456 } |
| 5457 | 5457 |
| 5458 | 5458 |
| 5459 HeapStatistics::HeapStatistics(): total_heap_size_(0), | 5459 HeapStatistics::HeapStatistics(): total_heap_size_(0), |
| 5460 total_heap_size_executable_(0), | 5460 total_heap_size_executable_(0), |
| 5461 total_physical_size_(0), | 5461 total_physical_size_(0), |
| 5462 used_heap_size_(0), | 5462 used_heap_size_(0), |
| 5463 heap_size_limit_(0) { } | 5463 heap_size_limit_(0) { } |
| 5464 | 5464 |
| 5465 | 5465 |
| 5466 HeapSpaceStatistics::HeapSpaceStatistics(): space_name_(0), | |
| 5467 space_size_(0), | |
| 5468 space_used_size_(0), | |
| 5469 space_avalable_size_(0), | |
| 5470 physical_space_size_(0) { } | |
| 5471 | |
| 5472 | |
| 5466 bool v8::V8::InitializeICU(const char* icu_data_file) { | 5473 bool v8::V8::InitializeICU(const char* icu_data_file) { |
| 5467 return i::InitializeICU(icu_data_file); | 5474 return i::InitializeICU(icu_data_file); |
| 5468 } | 5475 } |
| 5469 | 5476 |
| 5470 | 5477 |
| 5471 const char* v8::V8::GetVersion() { | 5478 const char* v8::V8::GetVersion() { |
| 5472 return i::Version::GetVersion(); | 5479 return i::Version::GetVersion(); |
| 5473 } | 5480 } |
| 5474 | 5481 |
| 5475 | 5482 |
| (...skipping 1517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6993 i::Heap* heap = isolate->heap(); | 7000 i::Heap* heap = isolate->heap(); |
| 6994 heap_statistics->total_heap_size_ = heap->CommittedMemory(); | 7001 heap_statistics->total_heap_size_ = heap->CommittedMemory(); |
| 6995 heap_statistics->total_heap_size_executable_ = | 7002 heap_statistics->total_heap_size_executable_ = |
| 6996 heap->CommittedMemoryExecutable(); | 7003 heap->CommittedMemoryExecutable(); |
| 6997 heap_statistics->total_physical_size_ = heap->CommittedPhysicalMemory(); | 7004 heap_statistics->total_physical_size_ = heap->CommittedPhysicalMemory(); |
| 6998 heap_statistics->used_heap_size_ = heap->SizeOfObjects(); | 7005 heap_statistics->used_heap_size_ = heap->SizeOfObjects(); |
| 6999 heap_statistics->heap_size_limit_ = heap->MaxReserved(); | 7006 heap_statistics->heap_size_limit_ = heap->MaxReserved(); |
| 7000 } | 7007 } |
| 7001 | 7008 |
| 7002 | 7009 |
| 7010 int Isolate::NumberOfHeapSpaces() { | |
| 7011 return i::LAST_SPACE - i::FIRST_SPACE + 1; | |
| 7012 } | |
| 7013 | |
| 7014 | |
| 7015 bool Isolate::GetHeapSpaceStatistics(HeapSpaceStatistics* space_statistics, | |
| 7016 int index) { | |
| 7017 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); | |
| 7018 i::Heap* heap = isolate->heap(); | |
| 7019 if (index > i::LAST_SPACE || index < i::FIRST_SPACE || !space_statistics) | |
|
rmcilroy
2015/04/16 13:49:05
nit - move the '!space_statistics' check out to a
ssid
2015/04/16 16:40:29
Done.
| |
| 7020 return false; | |
| 7021 | |
| 7022 space_statistics->space_name_ = heap->GetSpaceName(index); | |
| 7023 space_statistics->space_size_ = heap->space(index)->CommittedMemory(); | |
|
rmcilroy
2015/04/16 13:49:05
nit - factor out:
Space space = heap->space(index
ssid
2015/04/16 16:40:29
Done.
| |
| 7024 space_statistics->space_used_size_ = heap->space(index)->Size(); | |
| 7025 space_statistics->space_avalable_size_ = heap->space(index)->Available(); | |
| 7026 space_statistics->physical_space_size_ = | |
| 7027 heap->space(index)->CommittedPhysicalMemory(); | |
| 7028 return true; | |
| 7029 } | |
| 7030 | |
| 7031 | |
| 7003 void Isolate::GetStackSample(const RegisterState& state, void** frames, | 7032 void Isolate::GetStackSample(const RegisterState& state, void** frames, |
| 7004 size_t frames_limit, SampleInfo* sample_info) { | 7033 size_t frames_limit, SampleInfo* sample_info) { |
| 7005 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); | 7034 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |
| 7006 i::TickSample::GetStackSample(isolate, state, i::TickSample::kSkipCEntryFrame, | 7035 i::TickSample::GetStackSample(isolate, state, i::TickSample::kSkipCEntryFrame, |
| 7007 frames, frames_limit, sample_info); | 7036 frames, frames_limit, sample_info); |
| 7008 } | 7037 } |
| 7009 | 7038 |
| 7010 | 7039 |
| 7011 void Isolate::SetEventLogger(LogEventCallback that) { | 7040 void Isolate::SetEventLogger(LogEventCallback that) { |
| 7012 // Do not overwrite the event logger if we want to log explicitly. | 7041 // 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... | |
| 8110 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 8139 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
| 8111 Address callback_address = | 8140 Address callback_address = |
| 8112 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8141 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 8113 VMState<EXTERNAL> state(isolate); | 8142 VMState<EXTERNAL> state(isolate); |
| 8114 ExternalCallbackScope call_scope(isolate, callback_address); | 8143 ExternalCallbackScope call_scope(isolate, callback_address); |
| 8115 callback(info); | 8144 callback(info); |
| 8116 } | 8145 } |
| 8117 | 8146 |
| 8118 | 8147 |
| 8119 } } // namespace v8::internal | 8148 } } // namespace v8::internal |
| OLD | NEW |