Index: src/api.cc |
diff --git a/src/api.cc b/src/api.cc |
index 7c29a344f1faa45140d865afe047c905fb742590..90592f63f5ed639f41d0c86d1980ec417ccb620f 100644 |
--- a/src/api.cc |
+++ b/src/api.cc |
@@ -7251,9 +7251,8 @@ size_t Isolate::NumberOfHeapSpaces() { |
bool Isolate::GetHeapSpaceStatistics(HeapSpaceStatistics* space_statistics, |
size_t index) { |
- if (!space_statistics) |
- return false; |
- if (index > i::LAST_SPACE || index < i::FIRST_SPACE) |
+ if (!space_statistics) return false; |
+ if (!i::Heap::IsValidAllocationSpace(static_cast<i::AllocationSpace>(index))) |
return false; |
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |