| 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 7233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7244 } | 7244 } |
| 7245 | 7245 |
| 7246 | 7246 |
| 7247 size_t Isolate::NumberOfHeapSpaces() { | 7247 size_t Isolate::NumberOfHeapSpaces() { |
| 7248 return i::LAST_SPACE - i::FIRST_SPACE + 1; | 7248 return i::LAST_SPACE - i::FIRST_SPACE + 1; |
| 7249 } | 7249 } |
| 7250 | 7250 |
| 7251 | 7251 |
| 7252 bool Isolate::GetHeapSpaceStatistics(HeapSpaceStatistics* space_statistics, | 7252 bool Isolate::GetHeapSpaceStatistics(HeapSpaceStatistics* space_statistics, |
| 7253 size_t index) { | 7253 size_t index) { |
| 7254 if (!space_statistics) | 7254 if (!space_statistics) return false; |
| 7255 return false; | 7255 if (!i::Heap::IsValidAllocationSpace(static_cast<i::AllocationSpace>(index))) |
| 7256 if (index > i::LAST_SPACE || index < i::FIRST_SPACE) | |
| 7257 return false; | 7256 return false; |
| 7258 | 7257 |
| 7259 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); | 7258 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |
| 7260 i::Heap* heap = isolate->heap(); | 7259 i::Heap* heap = isolate->heap(); |
| 7261 i::Space* space = heap->space(static_cast<int>(index)); | 7260 i::Space* space = heap->space(static_cast<int>(index)); |
| 7262 | 7261 |
| 7263 space_statistics->space_name_ = heap->GetSpaceName(static_cast<int>(index)); | 7262 space_statistics->space_name_ = heap->GetSpaceName(static_cast<int>(index)); |
| 7264 space_statistics->space_size_ = space->CommittedMemory(); | 7263 space_statistics->space_size_ = space->CommittedMemory(); |
| 7265 space_statistics->space_used_size_ = space->SizeOfObjects(); | 7264 space_statistics->space_used_size_ = space->SizeOfObjects(); |
| 7266 space_statistics->space_available_size_ = space->Available(); | 7265 space_statistics->space_available_size_ = space->Available(); |
| (...skipping 1161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8428 Address callback_address = | 8427 Address callback_address = |
| 8429 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8428 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 8430 VMState<EXTERNAL> state(isolate); | 8429 VMState<EXTERNAL> state(isolate); |
| 8431 ExternalCallbackScope call_scope(isolate, callback_address); | 8430 ExternalCallbackScope call_scope(isolate, callback_address); |
| 8432 callback(info); | 8431 callback(info); |
| 8433 } | 8432 } |
| 8434 | 8433 |
| 8435 | 8434 |
| 8436 } // namespace internal | 8435 } // namespace internal |
| 8437 } // namespace v8 | 8436 } // namespace v8 |
| OLD | NEW |