OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 #ifndef V8_OBJECTS_VISITING_INL_H_ | 5 #ifndef V8_OBJECTS_VISITING_INL_H_ |
6 #define V8_OBJECTS_VISITING_INL_H_ | 6 #define V8_OBJECTS_VISITING_INL_H_ |
7 | 7 |
8 #include "src/heap/array-buffer-tracker.h" | 8 #include "src/heap/array-buffer-tracker.h" |
9 #include "src/heap/objects-visiting.h" | 9 #include "src/heap/objects-visiting.h" |
10 #include "src/ic/ic-state.h" | 10 #include "src/ic/ic-state.h" |
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 MarkBit code_mark = Marking::MarkBitFrom(function->code()); | 620 MarkBit code_mark = Marking::MarkBitFrom(function->code()); |
621 if (Marking::IsBlackOrGrey(code_mark)) { | 621 if (Marking::IsBlackOrGrey(code_mark)) { |
622 return false; | 622 return false; |
623 } | 623 } |
624 | 624 |
625 // We do not (yet) flush code for optimized functions. | 625 // We do not (yet) flush code for optimized functions. |
626 if (function->code() != shared_info->code()) { | 626 if (function->code() != shared_info->code()) { |
627 return false; | 627 return false; |
628 } | 628 } |
629 | 629 |
630 // Check age of optimized code. | |
631 if (FLAG_age_code && !function->code()->IsOld()) { | |
632 return false; | |
633 } | |
634 | |
635 return IsFlushable(heap, shared_info); | 630 return IsFlushable(heap, shared_info); |
636 } | 631 } |
637 | 632 |
638 | 633 |
639 template <typename StaticVisitor> | 634 template <typename StaticVisitor> |
640 bool StaticMarkingVisitor<StaticVisitor>::IsFlushable( | 635 bool StaticMarkingVisitor<StaticVisitor>::IsFlushable( |
641 Heap* heap, SharedFunctionInfo* shared_info) { | 636 Heap* heap, SharedFunctionInfo* shared_info) { |
642 // Code is either on stack, in compilation cache or referenced | 637 // Code is either on stack, in compilation cache or referenced |
643 // by optimized version of function. | 638 // by optimized version of function. |
644 MarkBit code_mark = Marking::MarkBitFrom(shared_info->code()); | 639 MarkBit code_mark = Marking::MarkBitFrom(shared_info->code()); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 if (shared_info->IsBuiltin()) { | 678 if (shared_info->IsBuiltin()) { |
684 return false; | 679 return false; |
685 } | 680 } |
686 | 681 |
687 // If this is a function initialized with %SetCode then the one-to-one | 682 // If this is a function initialized with %SetCode then the one-to-one |
688 // relation between SharedFunctionInfo and Code is broken. | 683 // relation between SharedFunctionInfo and Code is broken. |
689 if (shared_info->dont_flush()) { | 684 if (shared_info->dont_flush()) { |
690 return false; | 685 return false; |
691 } | 686 } |
692 | 687 |
| 688 // ---------------------------------------------------------------- |
| 689 // The above predicates up to this line are hard invariants, below |
| 690 // this line are heuristics that should not affect correctness. |
| 691 // ---------------------------------------------------------------- |
| 692 |
| 693 // In stress mode we are aggressive. |
| 694 if (FLAG_stress_compaction) { |
| 695 return true; |
| 696 } |
| 697 |
693 // Check age of code. If code aging is disabled we never flush. | 698 // Check age of code. If code aging is disabled we never flush. |
694 if (!FLAG_age_code || !shared_info->code()->IsOld()) { | 699 if (!FLAG_age_code || !shared_info->code()->IsOld()) { |
695 return false; | 700 return false; |
696 } | 701 } |
697 | 702 |
698 return true; | 703 return true; |
699 } | 704 } |
700 | 705 |
701 | 706 |
702 template <typename StaticVisitor> | 707 template <typename StaticVisitor> |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
747 typedef FlexibleBodyVisitor<StaticVisitor, JSFunction::BodyDescriptorWeakCode, | 752 typedef FlexibleBodyVisitor<StaticVisitor, JSFunction::BodyDescriptorWeakCode, |
748 void> JSFunctionWeakCodeBodyVisitor; | 753 void> JSFunctionWeakCodeBodyVisitor; |
749 JSFunctionWeakCodeBodyVisitor::Visit(map, object); | 754 JSFunctionWeakCodeBodyVisitor::Visit(map, object); |
750 } | 755 } |
751 | 756 |
752 | 757 |
753 } // namespace internal | 758 } // namespace internal |
754 } // namespace v8 | 759 } // namespace v8 |
755 | 760 |
756 #endif // V8_OBJECTS_VISITING_INL_H_ | 761 #endif // V8_OBJECTS_VISITING_INL_H_ |
OLD | NEW |