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/heap/incremental-marking.h" | 5 #include "src/heap/incremental-marking.h" |
6 | 6 |
7 #include "src/code-stubs.h" | 7 #include "src/code-stubs.h" |
8 #include "src/compilation-cache.h" | 8 #include "src/compilation-cache.h" |
9 #include "src/conversions.h" | 9 #include "src/conversions.h" |
10 #include "src/heap/gc-idle-time-handler.h" | 10 #include "src/heap/gc-idle-time-handler.h" |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 if (is_marking) { | 338 if (is_marking) { |
339 chunk->SetFlag(MemoryChunk::POINTERS_FROM_HERE_ARE_INTERESTING); | 339 chunk->SetFlag(MemoryChunk::POINTERS_FROM_HERE_ARE_INTERESTING); |
340 } else { | 340 } else { |
341 chunk->ClearFlag(MemoryChunk::POINTERS_FROM_HERE_ARE_INTERESTING); | 341 chunk->ClearFlag(MemoryChunk::POINTERS_FROM_HERE_ARE_INTERESTING); |
342 } | 342 } |
343 } | 343 } |
344 | 344 |
345 | 345 |
346 void IncrementalMarking::DeactivateIncrementalWriteBarrierForSpace( | 346 void IncrementalMarking::DeactivateIncrementalWriteBarrierForSpace( |
347 PagedSpace* space) { | 347 PagedSpace* space) { |
348 PageIterator it(space); | 348 for (Page* p : *space) { |
349 while (it.has_next()) { | |
350 Page* p = it.next(); | |
351 SetOldSpacePageFlags(p, false, false); | 349 SetOldSpacePageFlags(p, false, false); |
352 } | 350 } |
353 } | 351 } |
354 | 352 |
355 | 353 |
356 void IncrementalMarking::DeactivateIncrementalWriteBarrierForSpace( | 354 void IncrementalMarking::DeactivateIncrementalWriteBarrierForSpace( |
357 NewSpace* space) { | 355 NewSpace* space) { |
358 NewSpacePageIterator it(space); | 356 for (Page* p : *space) { |
359 while (it.has_next()) { | |
360 Page* p = it.next(); | |
361 SetNewSpacePageFlags(p, false); | 357 SetNewSpacePageFlags(p, false); |
362 } | 358 } |
363 } | 359 } |
364 | 360 |
365 | 361 |
366 void IncrementalMarking::DeactivateIncrementalWriteBarrier() { | 362 void IncrementalMarking::DeactivateIncrementalWriteBarrier() { |
367 DeactivateIncrementalWriteBarrierForSpace(heap_->old_space()); | 363 DeactivateIncrementalWriteBarrierForSpace(heap_->old_space()); |
368 DeactivateIncrementalWriteBarrierForSpace(heap_->map_space()); | 364 DeactivateIncrementalWriteBarrierForSpace(heap_->map_space()); |
369 DeactivateIncrementalWriteBarrierForSpace(heap_->code_space()); | 365 DeactivateIncrementalWriteBarrierForSpace(heap_->code_space()); |
370 DeactivateIncrementalWriteBarrierForSpace(heap_->new_space()); | 366 DeactivateIncrementalWriteBarrierForSpace(heap_->new_space()); |
371 | 367 |
372 LargePage* lop = heap_->lo_space()->first_page(); | 368 for (LargePage* lop : *heap_->lo_space()) { |
373 while (LargePage::IsValid(lop)) { | |
374 SetOldSpacePageFlags(lop, false, false); | 369 SetOldSpacePageFlags(lop, false, false); |
375 lop = lop->next_page(); | |
376 } | 370 } |
377 } | 371 } |
378 | 372 |
379 | 373 |
380 void IncrementalMarking::ActivateIncrementalWriteBarrier(PagedSpace* space) { | 374 void IncrementalMarking::ActivateIncrementalWriteBarrier(PagedSpace* space) { |
381 PageIterator it(space); | 375 for (Page* p : *space) { |
382 while (it.has_next()) { | |
383 Page* p = it.next(); | |
384 SetOldSpacePageFlags(p, true, is_compacting_); | 376 SetOldSpacePageFlags(p, true, is_compacting_); |
385 } | 377 } |
386 } | 378 } |
387 | 379 |
388 | 380 |
389 void IncrementalMarking::ActivateIncrementalWriteBarrier(NewSpace* space) { | 381 void IncrementalMarking::ActivateIncrementalWriteBarrier(NewSpace* space) { |
390 NewSpacePageIterator it(space->ToSpaceStart(), space->ToSpaceEnd()); | 382 for (Page* p : *space) { |
391 while (it.has_next()) { | |
392 Page* p = it.next(); | |
393 SetNewSpacePageFlags(p, true); | 383 SetNewSpacePageFlags(p, true); |
394 } | 384 } |
395 } | 385 } |
396 | 386 |
397 | 387 |
398 void IncrementalMarking::ActivateIncrementalWriteBarrier() { | 388 void IncrementalMarking::ActivateIncrementalWriteBarrier() { |
399 ActivateIncrementalWriteBarrier(heap_->old_space()); | 389 ActivateIncrementalWriteBarrier(heap_->old_space()); |
400 ActivateIncrementalWriteBarrier(heap_->map_space()); | 390 ActivateIncrementalWriteBarrier(heap_->map_space()); |
401 ActivateIncrementalWriteBarrier(heap_->code_space()); | 391 ActivateIncrementalWriteBarrier(heap_->code_space()); |
402 ActivateIncrementalWriteBarrier(heap_->new_space()); | 392 ActivateIncrementalWriteBarrier(heap_->new_space()); |
403 | 393 |
404 LargePage* lop = heap_->lo_space()->first_page(); | 394 for (LargePage* lop : *heap_->lo_space()) { |
405 while (LargePage::IsValid(lop)) { | |
406 SetOldSpacePageFlags(lop, true, is_compacting_); | 395 SetOldSpacePageFlags(lop, true, is_compacting_); |
407 lop = lop->next_page(); | |
408 } | 396 } |
409 } | 397 } |
410 | 398 |
411 | 399 |
412 bool IncrementalMarking::ShouldActivateEvenWithoutIdleNotification() { | 400 bool IncrementalMarking::ShouldActivateEvenWithoutIdleNotification() { |
413 #ifndef DEBUG | 401 #ifndef DEBUG |
414 static const intptr_t kActivationThreshold = 8 * MB; | 402 static const intptr_t kActivationThreshold = 8 * MB; |
415 #else | 403 #else |
416 // TODO(gc) consider setting this to some low level so that some | 404 // TODO(gc) consider setting this to some low level so that some |
417 // debug tests run with incremental marking and some without. | 405 // debug tests run with incremental marking and some without. |
(...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1254 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { | 1242 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { |
1255 idle_marking_delay_counter_++; | 1243 idle_marking_delay_counter_++; |
1256 } | 1244 } |
1257 | 1245 |
1258 | 1246 |
1259 void IncrementalMarking::ClearIdleMarkingDelayCounter() { | 1247 void IncrementalMarking::ClearIdleMarkingDelayCounter() { |
1260 idle_marking_delay_counter_ = 0; | 1248 idle_marking_delay_counter_ = 0; |
1261 } | 1249 } |
1262 } // namespace internal | 1250 } // namespace internal |
1263 } // namespace v8 | 1251 } // namespace v8 |
OLD | NEW |