| 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.h" | 8 #include "src/heap/heap.h" |
| 9 #include "src/heap/objects-visiting-inl.h" | 9 #include "src/heap/objects-visiting-inl.h" |
| 10 #include "src/heap/scavenger-inl.h" | 10 #include "src/heap/scavenger-inl.h" |
| 11 #include "src/isolate.h" | 11 #include "src/isolate.h" |
| 12 #include "src/log.h" | 12 #include "src/log.h" |
| 13 #include "src/profiler/cpu-profiler.h" | |
| 14 | 13 |
| 15 namespace v8 { | 14 namespace v8 { |
| 16 namespace internal { | 15 namespace internal { |
| 17 | 16 |
| 18 enum LoggingAndProfiling { | 17 enum LoggingAndProfiling { |
| 19 LOGGING_AND_PROFILING_ENABLED, | 18 LOGGING_AND_PROFILING_ENABLED, |
| 20 LOGGING_AND_PROFILING_DISABLED | 19 LOGGING_AND_PROFILING_DISABLED |
| 21 }; | 20 }; |
| 22 | 21 |
| 23 | 22 |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 SLOW_DCHECK(!first_word.IsForwardingAddress()); | 395 SLOW_DCHECK(!first_word.IsForwardingAddress()); |
| 397 Map* map = first_word.ToMap(); | 396 Map* map = first_word.ToMap(); |
| 398 Scavenger* scavenger = map->GetHeap()->scavenge_collector_; | 397 Scavenger* scavenger = map->GetHeap()->scavenge_collector_; |
| 399 scavenger->scavenging_visitors_table_.GetVisitor(map)(map, p, object); | 398 scavenger->scavenging_visitors_table_.GetVisitor(map)(map, p, object); |
| 400 } | 399 } |
| 401 | 400 |
| 402 | 401 |
| 403 void Scavenger::SelectScavengingVisitorsTable() { | 402 void Scavenger::SelectScavengingVisitorsTable() { |
| 404 bool logging_and_profiling = | 403 bool logging_and_profiling = |
| 405 FLAG_verify_predictable || isolate()->logger()->is_logging() || | 404 FLAG_verify_predictable || isolate()->logger()->is_logging() || |
| 406 isolate()->cpu_profiler()->is_profiling() || | 405 isolate()->is_profiling() || |
| 407 (isolate()->heap_profiler() != NULL && | 406 (isolate()->heap_profiler() != NULL && |
| 408 isolate()->heap_profiler()->is_tracking_object_moves()); | 407 isolate()->heap_profiler()->is_tracking_object_moves()); |
| 409 | 408 |
| 410 if (!heap()->incremental_marking()->IsMarking()) { | 409 if (!heap()->incremental_marking()->IsMarking()) { |
| 411 if (!logging_and_profiling) { | 410 if (!logging_and_profiling) { |
| 412 scavenging_visitors_table_.CopyFrom( | 411 scavenging_visitors_table_.CopyFrom( |
| 413 ScavengingVisitor<IGNORE_MARKS, DEFAULT_PROMOTION, | 412 ScavengingVisitor<IGNORE_MARKS, DEFAULT_PROMOTION, |
| 414 LOGGING_AND_PROFILING_DISABLED>::GetTable()); | 413 LOGGING_AND_PROFILING_DISABLED>::GetTable()); |
| 415 } else { | 414 } else { |
| 416 scavenging_visitors_table_.CopyFrom( | 415 scavenging_visitors_table_.CopyFrom( |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 | 455 |
| 457 void ScavengeVisitor::ScavengePointer(Object** p) { | 456 void ScavengeVisitor::ScavengePointer(Object** p) { |
| 458 Object* object = *p; | 457 Object* object = *p; |
| 459 if (!heap_->InNewSpace(object)) return; | 458 if (!heap_->InNewSpace(object)) return; |
| 460 Scavenger::ScavengeObject(reinterpret_cast<HeapObject**>(p), | 459 Scavenger::ScavengeObject(reinterpret_cast<HeapObject**>(p), |
| 461 reinterpret_cast<HeapObject*>(object)); | 460 reinterpret_cast<HeapObject*>(object)); |
| 462 } | 461 } |
| 463 | 462 |
| 464 } // namespace internal | 463 } // namespace internal |
| 465 } // namespace v8 | 464 } // namespace v8 |
| OLD | NEW |