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 8045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8056 size_t Isolate::NumberOfTrackedHeapObjectTypes() { | 8056 size_t Isolate::NumberOfTrackedHeapObjectTypes() { |
8057 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); | 8057 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |
8058 i::Heap* heap = isolate->heap(); | 8058 i::Heap* heap = isolate->heap(); |
8059 return heap->NumberOfTrackedHeapObjectTypes(); | 8059 return heap->NumberOfTrackedHeapObjectTypes(); |
8060 } | 8060 } |
8061 | 8061 |
8062 | 8062 |
8063 bool Isolate::GetHeapObjectStatisticsAtLastGC( | 8063 bool Isolate::GetHeapObjectStatisticsAtLastGC( |
8064 HeapObjectStatistics* object_statistics, size_t type_index) { | 8064 HeapObjectStatistics* object_statistics, size_t type_index) { |
8065 if (!object_statistics) return false; | 8065 if (!object_statistics) return false; |
8066 if (!i::FLAG_track_gc_object_stats) return false; | 8066 if (V8_LIKELY(!i::FLAG_gc_stats)) return false; |
8067 | 8067 |
8068 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); | 8068 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |
8069 i::Heap* heap = isolate->heap(); | 8069 i::Heap* heap = isolate->heap(); |
8070 if (type_index >= heap->NumberOfTrackedHeapObjectTypes()) return false; | 8070 if (type_index >= heap->NumberOfTrackedHeapObjectTypes()) return false; |
8071 | 8071 |
8072 const char* object_type; | 8072 const char* object_type; |
8073 const char* object_sub_type; | 8073 const char* object_sub_type; |
8074 size_t object_count = heap->ObjectCountAtLastGC(type_index); | 8074 size_t object_count = heap->ObjectCountAtLastGC(type_index); |
8075 size_t object_size = heap->ObjectSizeAtLastGC(type_index); | 8075 size_t object_size = heap->ObjectSizeAtLastGC(type_index); |
8076 if (!heap->GetObjectTypeName(type_index, &object_type, &object_sub_type)) { | 8076 if (!heap->GetObjectTypeName(type_index, &object_type, &object_sub_type)) { |
(...skipping 1563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9640 Address callback_address = | 9640 Address callback_address = |
9641 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 9641 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
9642 VMState<EXTERNAL> state(isolate); | 9642 VMState<EXTERNAL> state(isolate); |
9643 ExternalCallbackScope call_scope(isolate, callback_address); | 9643 ExternalCallbackScope call_scope(isolate, callback_address); |
9644 callback(info); | 9644 callback(info); |
9645 } | 9645 } |
9646 | 9646 |
9647 | 9647 |
9648 } // namespace internal | 9648 } // namespace internal |
9649 } // namespace v8 | 9649 } // namespace v8 |
OLD | NEW |