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 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 SLOW_DCHECK(!first_word.IsForwardingAddress()); | 383 SLOW_DCHECK(!first_word.IsForwardingAddress()); |
385 Map* map = first_word.ToMap(); | 384 Map* map = first_word.ToMap(); |
386 Scavenger* scavenger = map->GetHeap()->scavenge_collector_; | 385 Scavenger* scavenger = map->GetHeap()->scavenge_collector_; |
387 scavenger->scavenging_visitors_table_.GetVisitor(map)(map, p, object); | 386 scavenger->scavenging_visitors_table_.GetVisitor(map)(map, p, object); |
388 } | 387 } |
389 | 388 |
390 | 389 |
391 void Scavenger::SelectScavengingVisitorsTable() { | 390 void Scavenger::SelectScavengingVisitorsTable() { |
392 bool logging_and_profiling = | 391 bool logging_and_profiling = |
393 FLAG_verify_predictable || isolate()->logger()->is_logging() || | 392 FLAG_verify_predictable || isolate()->logger()->is_logging() || |
394 isolate()->cpu_profiler()->is_profiling() || | 393 isolate()->is_profiling() || |
395 (isolate()->heap_profiler() != NULL && | 394 (isolate()->heap_profiler() != NULL && |
396 isolate()->heap_profiler()->is_tracking_object_moves()); | 395 isolate()->heap_profiler()->is_tracking_object_moves()); |
397 | 396 |
398 if (!heap()->incremental_marking()->IsMarking()) { | 397 if (!heap()->incremental_marking()->IsMarking()) { |
399 if (!logging_and_profiling) { | 398 if (!logging_and_profiling) { |
400 scavenging_visitors_table_.CopyFrom( | 399 scavenging_visitors_table_.CopyFrom( |
401 ScavengingVisitor<IGNORE_MARKS, DEFAULT_PROMOTION, | 400 ScavengingVisitor<IGNORE_MARKS, DEFAULT_PROMOTION, |
402 LOGGING_AND_PROFILING_DISABLED>::GetTable()); | 401 LOGGING_AND_PROFILING_DISABLED>::GetTable()); |
403 } else { | 402 } else { |
404 scavenging_visitors_table_.CopyFrom( | 403 scavenging_visitors_table_.CopyFrom( |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 | 443 |
445 void ScavengeVisitor::ScavengePointer(Object** p) { | 444 void ScavengeVisitor::ScavengePointer(Object** p) { |
446 Object* object = *p; | 445 Object* object = *p; |
447 if (!heap_->InNewSpace(object)) return; | 446 if (!heap_->InNewSpace(object)) return; |
448 Scavenger::ScavengeObject(reinterpret_cast<HeapObject**>(p), | 447 Scavenger::ScavengeObject(reinterpret_cast<HeapObject**>(p), |
449 reinterpret_cast<HeapObject*>(object)); | 448 reinterpret_cast<HeapObject*>(object)); |
450 } | 449 } |
451 | 450 |
452 } // namespace internal | 451 } // namespace internal |
453 } // namespace v8 | 452 } // namespace v8 |
OLD | NEW |