| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/scavenger.h" | 5 #include "src/heap/scavenger.h" |
| 6 | 6 |
| 7 #include "src/contexts.h" | 7 #include "src/contexts.h" |
| 8 #include "src/heap/heap-inl.h" | 8 #include "src/heap/heap-inl.h" |
| 9 #include "src/heap/incremental-marking.h" | 9 #include "src/heap/incremental-marking.h" |
| 10 #include "src/heap/objects-visiting-inl.h" | 10 #include "src/heap/objects-visiting-inl.h" |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 StaticVisitorBase::kVisitThinString, | 453 StaticVisitorBase::kVisitThinString, |
| 454 &ScavengingVisitor<TRANSFER_MARKS, LOGGING_AND_PROFILING_DISABLED>:: | 454 &ScavengingVisitor<TRANSFER_MARKS, LOGGING_AND_PROFILING_DISABLED>:: |
| 455 EvacuateThinStringNoShortcut); | 455 EvacuateThinStringNoShortcut); |
| 456 } | 456 } |
| 457 } | 457 } |
| 458 } | 458 } |
| 459 | 459 |
| 460 | 460 |
| 461 Isolate* Scavenger::isolate() { return heap()->isolate(); } | 461 Isolate* Scavenger::isolate() { return heap()->isolate(); } |
| 462 | 462 |
| 463 void RootScavengeVisitor::VisitPointer(Object** p) { ScavengePointer(p); } | |
| 464 | |
| 465 void RootScavengeVisitor::VisitPointers(Object** start, Object** end) { | |
| 466 // Copy all HeapObject pointers in [start, end) | |
| 467 for (Object** p = start; p < end; p++) ScavengePointer(p); | |
| 468 } | |
| 469 | |
| 470 void RootScavengeVisitor::VisitRootPointer(Root root, Object** p) { | 463 void RootScavengeVisitor::VisitRootPointer(Root root, Object** p) { |
| 471 ScavengePointer(p); | 464 ScavengePointer(p); |
| 472 } | 465 } |
| 473 | 466 |
| 474 void RootScavengeVisitor::VisitRootPointers(Root root, Object** start, | 467 void RootScavengeVisitor::VisitRootPointers(Root root, Object** start, |
| 475 Object** end) { | 468 Object** end) { |
| 476 // Copy all HeapObject pointers in [start, end) | 469 // Copy all HeapObject pointers in [start, end) |
| 477 for (Object** p = start; p < end; p++) ScavengePointer(p); | 470 for (Object** p = start; p < end; p++) ScavengePointer(p); |
| 478 } | 471 } |
| 479 | 472 |
| 480 void RootScavengeVisitor::ScavengePointer(Object** p) { | 473 void RootScavengeVisitor::ScavengePointer(Object** p) { |
| 481 Object* object = *p; | 474 Object* object = *p; |
| 482 if (!heap_->InNewSpace(object)) return; | 475 if (!heap_->InNewSpace(object)) return; |
| 483 | 476 |
| 484 Scavenger::ScavengeObject(reinterpret_cast<HeapObject**>(p), | 477 Scavenger::ScavengeObject(reinterpret_cast<HeapObject**>(p), |
| 485 reinterpret_cast<HeapObject*>(object)); | 478 reinterpret_cast<HeapObject*>(object)); |
| 486 } | 479 } |
| 487 | 480 |
| 488 } // namespace internal | 481 } // namespace internal |
| 489 } // namespace v8 | 482 } // namespace v8 |
| OLD | NEW |