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 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 | 673 |
674 | 674 |
675 template <typename StaticVisitor> | 675 template <typename StaticVisitor> |
676 bool StaticMarkingVisitor<StaticVisitor>::IsFlushable(Heap* heap, | 676 bool StaticMarkingVisitor<StaticVisitor>::IsFlushable(Heap* heap, |
677 JSFunction* function) { | 677 JSFunction* function) { |
678 SharedFunctionInfo* shared_info = function->shared(); | 678 SharedFunctionInfo* shared_info = function->shared(); |
679 | 679 |
680 // Code is either on stack, in compilation cache or referenced | 680 // Code is either on stack, in compilation cache or referenced |
681 // by optimized version of function. | 681 // by optimized version of function. |
682 MarkBit code_mark = Marking::MarkBitFrom(function->code()); | 682 MarkBit code_mark = Marking::MarkBitFrom(function->code()); |
683 if (code_mark.Get()) { | 683 if (Marking::IsBlackOrGrey(code_mark)) { |
684 return false; | 684 return false; |
685 } | 685 } |
686 | 686 |
687 // The function must have a valid context and not be a builtin. | 687 // The function must have a valid context and not be a builtin. |
688 if (!IsValidNonBuiltinContext(function->context())) { | 688 if (!IsValidNonBuiltinContext(function->context())) { |
689 return false; | 689 return false; |
690 } | 690 } |
691 | 691 |
692 // We do not (yet) flush code for optimized functions. | 692 // We do not (yet) flush code for optimized functions. |
693 if (function->code() != shared_info->code()) { | 693 if (function->code() != shared_info->code()) { |
694 return false; | 694 return false; |
695 } | 695 } |
696 | 696 |
697 // Check age of optimized code. | 697 // Check age of optimized code. |
698 if (FLAG_age_code && !function->code()->IsOld()) { | 698 if (FLAG_age_code && !function->code()->IsOld()) { |
699 return false; | 699 return false; |
700 } | 700 } |
701 | 701 |
702 return IsFlushable(heap, shared_info); | 702 return IsFlushable(heap, shared_info); |
703 } | 703 } |
704 | 704 |
705 | 705 |
706 template <typename StaticVisitor> | 706 template <typename StaticVisitor> |
707 bool StaticMarkingVisitor<StaticVisitor>::IsFlushable( | 707 bool StaticMarkingVisitor<StaticVisitor>::IsFlushable( |
708 Heap* heap, SharedFunctionInfo* shared_info) { | 708 Heap* heap, SharedFunctionInfo* shared_info) { |
709 // Code is either on stack, in compilation cache or referenced | 709 // Code is either on stack, in compilation cache or referenced |
710 // by optimized version of function. | 710 // by optimized version of function. |
711 MarkBit code_mark = Marking::MarkBitFrom(shared_info->code()); | 711 MarkBit code_mark = Marking::MarkBitFrom(shared_info->code()); |
712 if (code_mark.Get()) { | 712 if (Marking::IsBlackOrGrey(code_mark)) { |
713 return false; | 713 return false; |
714 } | 714 } |
715 | 715 |
716 // The function must be compiled and have the source code available, | 716 // The function must be compiled and have the source code available, |
717 // to be able to recompile it in case we need the function again. | 717 // to be able to recompile it in case we need the function again. |
718 if (!(shared_info->is_compiled() && HasSourceCode(heap, shared_info))) { | 718 if (!(shared_info->is_compiled() && HasSourceCode(heap, shared_info))) { |
719 return false; | 719 return false; |
720 } | 720 } |
721 | 721 |
722 // We never flush code for API functions. | 722 // We never flush code for API functions. |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
894 | 894 |
895 RelocIterator it(this, mode_mask); | 895 RelocIterator it(this, mode_mask); |
896 for (; !it.done(); it.next()) { | 896 for (; !it.done(); it.next()) { |
897 it.rinfo()->template Visit<StaticVisitor>(heap); | 897 it.rinfo()->template Visit<StaticVisitor>(heap); |
898 } | 898 } |
899 } | 899 } |
900 } | 900 } |
901 } // namespace v8::internal | 901 } // namespace v8::internal |
902 | 902 |
903 #endif // V8_OBJECTS_VISITING_INL_H_ | 903 #endif // V8_OBJECTS_VISITING_INL_H_ |
OLD | NEW |