| 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 | |
| 418 void Scavenger::SelectScavengingVisitorsTable() { | 407 void Scavenger::SelectScavengingVisitorsTable() { |
| 419 bool logging_and_profiling = | 408 bool logging_and_profiling = |
| 420 FLAG_verify_predictable || isolate()->logger()->is_logging() || | 409 FLAG_verify_predictable || isolate()->logger()->is_logging() || |
| 421 isolate()->is_profiling() || | 410 isolate()->is_profiling() || |
| 422 (isolate()->heap_profiler() != NULL && | 411 (isolate()->heap_profiler() != NULL && |
| 423 isolate()->heap_profiler()->is_tracking_object_moves()); | 412 isolate()->heap_profiler()->is_tracking_object_moves()); |
| 424 | 413 |
| 425 if (!heap()->incremental_marking()->IsMarking()) { | 414 if (!heap()->incremental_marking()->IsMarking()) { |
| 426 if (!logging_and_profiling) { | 415 if (!logging_and_profiling) { |
| 427 scavenging_visitors_table_.CopyFrom( | 416 scavenging_visitors_table_.CopyFrom( |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 void RootScavengeVisitor::ScavengePointer(Object** p) { | 464 void RootScavengeVisitor::ScavengePointer(Object** p) { |
| 476 Object* object = *p; | 465 Object* object = *p; |
| 477 if (!heap_->InNewSpace(object)) return; | 466 if (!heap_->InNewSpace(object)) return; |
| 478 | 467 |
| 479 Scavenger::ScavengeObject(reinterpret_cast<HeapObject**>(p), | 468 Scavenger::ScavengeObject(reinterpret_cast<HeapObject**>(p), |
| 480 reinterpret_cast<HeapObject*>(object)); | 469 reinterpret_cast<HeapObject*>(object)); |
| 481 } | 470 } |
| 482 | 471 |
| 483 } // namespace internal | 472 } // namespace internal |
| 484 } // namespace v8 | 473 } // namespace v8 |
| OLD | NEW |