| 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 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 void Scavenger::Initialize() { | 397 void Scavenger::Initialize() { |
| 398 ScavengingVisitor<TRANSFER_MARKS, | 398 ScavengingVisitor<TRANSFER_MARKS, |
| 399 LOGGING_AND_PROFILING_DISABLED>::Initialize(); | 399 LOGGING_AND_PROFILING_DISABLED>::Initialize(); |
| 400 ScavengingVisitor<IGNORE_MARKS, LOGGING_AND_PROFILING_DISABLED>::Initialize(); | 400 ScavengingVisitor<IGNORE_MARKS, LOGGING_AND_PROFILING_DISABLED>::Initialize(); |
| 401 ScavengingVisitor<TRANSFER_MARKS, | 401 ScavengingVisitor<TRANSFER_MARKS, |
| 402 LOGGING_AND_PROFILING_ENABLED>::Initialize(); | 402 LOGGING_AND_PROFILING_ENABLED>::Initialize(); |
| 403 ScavengingVisitor<IGNORE_MARKS, LOGGING_AND_PROFILING_ENABLED>::Initialize(); | 403 ScavengingVisitor<IGNORE_MARKS, LOGGING_AND_PROFILING_ENABLED>::Initialize(); |
| 404 } | 404 } |
| 405 | 405 |
| 406 | 406 |
| 407 // static |
| 408 void Scavenger::ScavengeObjectSlow(HeapObject** p, HeapObject* object) { |
| 409 SLOW_DCHECK(object->GetIsolate()->heap()->InFromSpace(object)); |
| 410 MapWord first_word = object->map_word(); |
| 411 SLOW_DCHECK(!first_word.IsForwardingAddress()); |
| 412 Map* map = first_word.ToMap(); |
| 413 Scavenger* scavenger = map->GetHeap()->scavenge_collector_; |
| 414 scavenger->scavenging_visitors_table_.GetVisitor(map)(map, p, object); |
| 415 } |
| 416 |
| 417 |
| 407 void Scavenger::SelectScavengingVisitorsTable() { | 418 void Scavenger::SelectScavengingVisitorsTable() { |
| 408 bool logging_and_profiling = | 419 bool logging_and_profiling = |
| 409 FLAG_verify_predictable || isolate()->logger()->is_logging() || | 420 FLAG_verify_predictable || isolate()->logger()->is_logging() || |
| 410 isolate()->is_profiling() || | 421 isolate()->is_profiling() || |
| 411 (isolate()->heap_profiler() != NULL && | 422 (isolate()->heap_profiler() != NULL && |
| 412 isolate()->heap_profiler()->is_tracking_object_moves()); | 423 isolate()->heap_profiler()->is_tracking_object_moves()); |
| 413 | 424 |
| 414 if (!heap()->incremental_marking()->IsMarking()) { | 425 if (!heap()->incremental_marking()->IsMarking()) { |
| 415 if (!logging_and_profiling) { | 426 if (!logging_and_profiling) { |
| 416 scavenging_visitors_table_.CopyFrom( | 427 scavenging_visitors_table_.CopyFrom( |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 void RootScavengeVisitor::ScavengePointer(Object** p) { | 475 void RootScavengeVisitor::ScavengePointer(Object** p) { |
| 465 Object* object = *p; | 476 Object* object = *p; |
| 466 if (!heap_->InNewSpace(object)) return; | 477 if (!heap_->InNewSpace(object)) return; |
| 467 | 478 |
| 468 Scavenger::ScavengeObject(reinterpret_cast<HeapObject**>(p), | 479 Scavenger::ScavengeObject(reinterpret_cast<HeapObject**>(p), |
| 469 reinterpret_cast<HeapObject*>(object)); | 480 reinterpret_cast<HeapObject*>(object)); |
| 470 } | 481 } |
| 471 | 482 |
| 472 } // namespace internal | 483 } // namespace internal |
| 473 } // namespace v8 | 484 } // namespace v8 |
| OLD | NEW |