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 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
660 DeoptimizationInputData::cast(code->deoptimization_data()); | 660 DeoptimizationInputData::cast(code->deoptimization_data()); |
661 FixedArray* const literals = data->LiteralArray(); | 661 FixedArray* const literals = data->LiteralArray(); |
662 int const inlined_count = data->InlinedFunctionCount()->value(); | 662 int const inlined_count = data->InlinedFunctionCount()->value(); |
663 for (int i = 0; i < inlined_count; ++i) { | 663 for (int i = 0; i < inlined_count; ++i) { |
664 StaticVisitor::MarkObject( | 664 StaticVisitor::MarkObject( |
665 heap, SharedFunctionInfo::cast(literals->get(i))->code()); | 665 heap, SharedFunctionInfo::cast(literals->get(i))->code()); |
666 } | 666 } |
667 } | 667 } |
668 | 668 |
669 | 669 |
670 inline static bool IsValidNonBuiltinContext(Object* context) { | 670 inline static bool HasValidNonBuiltinContext(JSFunction* function) { |
671 return context->IsContext() && | 671 return function->context()->IsContext() && !function->IsBuiltin(); |
672 !Context::cast(context)->global_object()->IsJSBuiltinsObject(); | |
673 } | 672 } |
674 | 673 |
675 | 674 |
676 inline static bool HasSourceCode(Heap* heap, SharedFunctionInfo* info) { | 675 inline static bool HasSourceCode(Heap* heap, SharedFunctionInfo* info) { |
677 Object* undefined = heap->undefined_value(); | 676 Object* undefined = heap->undefined_value(); |
678 return (info->script() != undefined) && | 677 return (info->script() != undefined) && |
679 (reinterpret_cast<Script*>(info->script())->source() != undefined); | 678 (reinterpret_cast<Script*>(info->script())->source() != undefined); |
680 } | 679 } |
681 | 680 |
682 | 681 |
683 template <typename StaticVisitor> | 682 template <typename StaticVisitor> |
684 bool StaticMarkingVisitor<StaticVisitor>::IsFlushable(Heap* heap, | 683 bool StaticMarkingVisitor<StaticVisitor>::IsFlushable(Heap* heap, |
685 JSFunction* function) { | 684 JSFunction* function) { |
686 SharedFunctionInfo* shared_info = function->shared(); | 685 SharedFunctionInfo* shared_info = function->shared(); |
687 | 686 |
688 // Code is either on stack, in compilation cache or referenced | 687 // Code is either on stack, in compilation cache or referenced |
689 // by optimized version of function. | 688 // by optimized version of function. |
690 MarkBit code_mark = Marking::MarkBitFrom(function->code()); | 689 MarkBit code_mark = Marking::MarkBitFrom(function->code()); |
691 if (Marking::IsBlackOrGrey(code_mark)) { | 690 if (Marking::IsBlackOrGrey(code_mark)) { |
692 return false; | 691 return false; |
693 } | 692 } |
694 | 693 |
695 // The function must have a valid context and not be a builtin. | 694 // The function must have a valid context and not be a builtin. |
696 if (!IsValidNonBuiltinContext(function->context())) { | 695 if (!HasValidNonBuiltinContext(function)) { |
697 return false; | 696 return false; |
698 } | 697 } |
699 | 698 |
700 // We do not (yet) flush code for optimized functions. | 699 // We do not (yet) flush code for optimized functions. |
701 if (function->code() != shared_info->code()) { | 700 if (function->code() != shared_info->code()) { |
702 return false; | 701 return false; |
703 } | 702 } |
704 | 703 |
705 // Check age of optimized code. | 704 // Check age of optimized code. |
706 if (FLAG_age_code && !function->code()->IsOld()) { | 705 if (FLAG_age_code && !function->code()->IsOld()) { |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
899 | 898 |
900 RelocIterator it(this, mode_mask); | 899 RelocIterator it(this, mode_mask); |
901 for (; !it.done(); it.next()) { | 900 for (; !it.done(); it.next()) { |
902 it.rinfo()->template Visit<StaticVisitor>(heap); | 901 it.rinfo()->template Visit<StaticVisitor>(heap); |
903 } | 902 } |
904 } | 903 } |
905 } // namespace internal | 904 } // namespace internal |
906 } // namespace v8 | 905 } // namespace v8 |
907 | 906 |
908 #endif // V8_OBJECTS_VISITING_INL_H_ | 907 #endif // V8_OBJECTS_VISITING_INL_H_ |
OLD | NEW |