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 7193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7204 | 7204 |
7205 size_t Isolate::NumberOfHeapSpaces() { | 7205 size_t Isolate::NumberOfHeapSpaces() { |
7206 return i::LAST_SPACE - i::FIRST_SPACE + 1; | 7206 return i::LAST_SPACE - i::FIRST_SPACE + 1; |
7207 } | 7207 } |
7208 | 7208 |
7209 | 7209 |
7210 bool Isolate::GetHeapSpaceStatistics(HeapSpaceStatistics* space_statistics, | 7210 bool Isolate::GetHeapSpaceStatistics(HeapSpaceStatistics* space_statistics, |
7211 size_t index) { | 7211 size_t index) { |
7212 if (!space_statistics) | 7212 if (!space_statistics) |
7213 return false; | 7213 return false; |
7214 if (index > i::LAST_SPACE || index < i::FIRST_SPACE) | 7214 if (index > i::LAST_SPACE || (i::FIRST_SPACE > 0 && index < i::FIRST_SPACE)) |
vogelheim
2015/06/05 08:30:43
The way I read globals.h, i::FIRST_SPACE would usu
| |
7215 return false; | 7215 return false; |
7216 | 7216 |
7217 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); | 7217 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |
7218 i::Heap* heap = isolate->heap(); | 7218 i::Heap* heap = isolate->heap(); |
7219 i::Space* space = heap->space(static_cast<int>(index)); | 7219 i::Space* space = heap->space(static_cast<int>(index)); |
7220 | 7220 |
7221 space_statistics->space_name_ = heap->GetSpaceName(static_cast<int>(index)); | 7221 space_statistics->space_name_ = heap->GetSpaceName(static_cast<int>(index)); |
7222 space_statistics->space_size_ = space->CommittedMemory(); | 7222 space_statistics->space_size_ = space->CommittedMemory(); |
7223 space_statistics->space_used_size_ = space->SizeOfObjects(); | 7223 space_statistics->space_used_size_ = space->SizeOfObjects(); |
7224 space_statistics->space_available_size_ = space->Available(); | 7224 space_statistics->space_available_size_ = space->Available(); |
(...skipping 1161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8386 Address callback_address = | 8386 Address callback_address = |
8387 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8387 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
8388 VMState<EXTERNAL> state(isolate); | 8388 VMState<EXTERNAL> state(isolate); |
8389 ExternalCallbackScope call_scope(isolate, callback_address); | 8389 ExternalCallbackScope call_scope(isolate, callback_address); |
8390 callback(info); | 8390 callback(info); |
8391 } | 8391 } |
8392 | 8392 |
8393 | 8393 |
8394 } // namespace internal | 8394 } // namespace internal |
8395 } // namespace v8 | 8395 } // namespace v8 |
OLD | NEW |