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 5472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5483 | 5483 |
5484 | 5484 |
5485 bool v8::V8::Dispose() { | 5485 bool v8::V8::Dispose() { |
5486 i::V8::TearDown(); | 5486 i::V8::TearDown(); |
5487 #ifdef V8_USE_EXTERNAL_STARTUP_DATA | 5487 #ifdef V8_USE_EXTERNAL_STARTUP_DATA |
5488 i::DisposeNatives(); | 5488 i::DisposeNatives(); |
5489 #endif | 5489 #endif |
5490 return true; | 5490 return true; |
5491 } | 5491 } |
5492 | 5492 |
5493 | 5493 HeapStatistics::HeapStatistics() |
5494 HeapStatistics::HeapStatistics(): total_heap_size_(0), | 5494 : total_heap_size_(0), |
5495 total_heap_size_executable_(0), | 5495 total_heap_size_executable_(0), |
5496 total_physical_size_(0), | 5496 total_physical_size_(0), |
5497 used_heap_size_(0), | 5497 total_available_size_(0), |
5498 heap_size_limit_(0) { } | 5498 used_heap_size_(0), |
5499 | 5499 heap_size_limit_(0), |
| 5500 malloced_memory_(0), |
| 5501 does_zap_garbage_(0) {} |
5500 | 5502 |
5501 HeapSpaceStatistics::HeapSpaceStatistics(): space_name_(0), | 5503 HeapSpaceStatistics::HeapSpaceStatistics(): space_name_(0), |
5502 space_size_(0), | 5504 space_size_(0), |
5503 space_used_size_(0), | 5505 space_used_size_(0), |
5504 space_available_size_(0), | 5506 space_available_size_(0), |
5505 physical_space_size_(0) { } | 5507 physical_space_size_(0) { } |
5506 | 5508 |
5507 | 5509 |
5508 HeapObjectStatistics::HeapObjectStatistics() | 5510 HeapObjectStatistics::HeapObjectStatistics() |
5509 : object_type_(nullptr), | 5511 : object_type_(nullptr), |
(...skipping 1876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7386 void Isolate::GetHeapStatistics(HeapStatistics* heap_statistics) { | 7388 void Isolate::GetHeapStatistics(HeapStatistics* heap_statistics) { |
7387 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); | 7389 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |
7388 i::Heap* heap = isolate->heap(); | 7390 i::Heap* heap = isolate->heap(); |
7389 heap_statistics->total_heap_size_ = heap->CommittedMemory(); | 7391 heap_statistics->total_heap_size_ = heap->CommittedMemory(); |
7390 heap_statistics->total_heap_size_executable_ = | 7392 heap_statistics->total_heap_size_executable_ = |
7391 heap->CommittedMemoryExecutable(); | 7393 heap->CommittedMemoryExecutable(); |
7392 heap_statistics->total_physical_size_ = heap->CommittedPhysicalMemory(); | 7394 heap_statistics->total_physical_size_ = heap->CommittedPhysicalMemory(); |
7393 heap_statistics->total_available_size_ = heap->Available(); | 7395 heap_statistics->total_available_size_ = heap->Available(); |
7394 heap_statistics->used_heap_size_ = heap->SizeOfObjects(); | 7396 heap_statistics->used_heap_size_ = heap->SizeOfObjects(); |
7395 heap_statistics->heap_size_limit_ = heap->MaxReserved(); | 7397 heap_statistics->heap_size_limit_ = heap->MaxReserved(); |
| 7398 heap_statistics->malloced_memory_ = |
| 7399 isolate->allocator()->GetCurrentMemoryUsage(); |
7396 heap_statistics->does_zap_garbage_ = heap->ShouldZapGarbage(); | 7400 heap_statistics->does_zap_garbage_ = heap->ShouldZapGarbage(); |
7397 } | 7401 } |
7398 | 7402 |
7399 | 7403 |
7400 size_t Isolate::NumberOfHeapSpaces() { | 7404 size_t Isolate::NumberOfHeapSpaces() { |
7401 return i::LAST_SPACE - i::FIRST_SPACE + 1; | 7405 return i::LAST_SPACE - i::FIRST_SPACE + 1; |
7402 } | 7406 } |
7403 | 7407 |
7404 | 7408 |
7405 bool Isolate::GetHeapSpaceStatistics(HeapSpaceStatistics* space_statistics, | 7409 bool Isolate::GetHeapSpaceStatistics(HeapSpaceStatistics* space_statistics, |
(...skipping 1364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8770 Address callback_address = | 8774 Address callback_address = |
8771 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8775 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
8772 VMState<EXTERNAL> state(isolate); | 8776 VMState<EXTERNAL> state(isolate); |
8773 ExternalCallbackScope call_scope(isolate, callback_address); | 8777 ExternalCallbackScope call_scope(isolate, callback_address); |
8774 callback(info); | 8778 callback(info); |
8775 } | 8779 } |
8776 | 8780 |
8777 | 8781 |
8778 } // namespace internal | 8782 } // namespace internal |
8779 } // namespace v8 | 8783 } // namespace v8 |
OLD | NEW |