| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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/heap/spaces.h" | 5 #include "src/heap/spaces.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
| 10 #include "src/base/platform/platform.h" | 10 #include "src/base/platform/platform.h" |
| (...skipping 1204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1215 | 1215 |
| 1216 STATIC_ASSERT(static_cast<ObjectSpace>(1 << AllocationSpace::NEW_SPACE) == | 1216 STATIC_ASSERT(static_cast<ObjectSpace>(1 << AllocationSpace::NEW_SPACE) == |
| 1217 ObjectSpace::kObjectSpaceNewSpace); | 1217 ObjectSpace::kObjectSpaceNewSpace); |
| 1218 STATIC_ASSERT(static_cast<ObjectSpace>(1 << AllocationSpace::OLD_SPACE) == | 1218 STATIC_ASSERT(static_cast<ObjectSpace>(1 << AllocationSpace::OLD_SPACE) == |
| 1219 ObjectSpace::kObjectSpaceOldSpace); | 1219 ObjectSpace::kObjectSpaceOldSpace); |
| 1220 STATIC_ASSERT(static_cast<ObjectSpace>(1 << AllocationSpace::CODE_SPACE) == | 1220 STATIC_ASSERT(static_cast<ObjectSpace>(1 << AllocationSpace::CODE_SPACE) == |
| 1221 ObjectSpace::kObjectSpaceCodeSpace); | 1221 ObjectSpace::kObjectSpaceCodeSpace); |
| 1222 STATIC_ASSERT(static_cast<ObjectSpace>(1 << AllocationSpace::MAP_SPACE) == | 1222 STATIC_ASSERT(static_cast<ObjectSpace>(1 << AllocationSpace::MAP_SPACE) == |
| 1223 ObjectSpace::kObjectSpaceMapSpace); | 1223 ObjectSpace::kObjectSpaceMapSpace); |
| 1224 | 1224 |
| 1225 void Space::AddAllocationObserver(AllocationObserver* observer) { |
| 1226 allocation_observers_->Add(observer); |
| 1227 } |
| 1228 |
| 1229 void Space::RemoveAllocationObserver(AllocationObserver* observer) { |
| 1230 bool removed = allocation_observers_->RemoveElement(observer); |
| 1231 USE(removed); |
| 1232 DCHECK(removed); |
| 1233 } |
| 1234 |
| 1235 void Space::PauseAllocationObservers() { allocation_observers_paused_ = true; } |
| 1236 |
| 1237 void Space::ResumeAllocationObservers() { |
| 1238 allocation_observers_paused_ = false; |
| 1239 } |
| 1240 |
| 1225 void Space::AllocationStep(Address soon_object, int size) { | 1241 void Space::AllocationStep(Address soon_object, int size) { |
| 1226 if (!allocation_observers_paused_) { | 1242 if (!allocation_observers_paused_) { |
| 1227 for (int i = 0; i < allocation_observers_->length(); ++i) { | 1243 for (int i = 0; i < allocation_observers_->length(); ++i) { |
| 1228 AllocationObserver* o = (*allocation_observers_)[i]; | 1244 AllocationObserver* o = (*allocation_observers_)[i]; |
| 1229 o->AllocationStep(size, soon_object, size); | 1245 o->AllocationStep(size, soon_object, size); |
| 1230 } | 1246 } |
| 1231 } | 1247 } |
| 1232 } | 1248 } |
| 1233 | 1249 |
| 1234 PagedSpace::PagedSpace(Heap* heap, AllocationSpace space, | 1250 PagedSpace::PagedSpace(Heap* heap, AllocationSpace space, |
| (...skipping 2059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3294 PrintF("\n"); | 3310 PrintF("\n"); |
| 3295 } | 3311 } |
| 3296 printf(" --------------------------------------\n"); | 3312 printf(" --------------------------------------\n"); |
| 3297 printf(" Marked: %x, LiveCount: %" V8PRIdPTR "\n", mark_size, | 3313 printf(" Marked: %x, LiveCount: %" V8PRIdPTR "\n", mark_size, |
| 3298 MarkingState::Internal(this).live_bytes()); | 3314 MarkingState::Internal(this).live_bytes()); |
| 3299 } | 3315 } |
| 3300 | 3316 |
| 3301 #endif // DEBUG | 3317 #endif // DEBUG |
| 3302 } // namespace internal | 3318 } // namespace internal |
| 3303 } // namespace v8 | 3319 } // namespace v8 |
| OLD | NEW |