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