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 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 } | 527 } |
528 | 528 |
529 | 529 |
530 template <typename StaticVisitor> | 530 template <typename StaticVisitor> |
531 bool StaticMarkingVisitor<StaticVisitor>::IsFlushable(Heap* heap, | 531 bool StaticMarkingVisitor<StaticVisitor>::IsFlushable(Heap* heap, |
532 JSFunction* function) { | 532 JSFunction* function) { |
533 SharedFunctionInfo* shared_info = function->shared(); | 533 SharedFunctionInfo* shared_info = function->shared(); |
534 | 534 |
535 // Code is either on stack, in compilation cache or referenced | 535 // Code is either on stack, in compilation cache or referenced |
536 // by optimized version of function. | 536 // by optimized version of function. |
537 MarkBit code_mark = ObjectMarking::MarkBitFrom(function->code()); | 537 if (ObjectMarking::IsBlackOrGrey(function->code())) { |
538 if (Marking::IsBlackOrGrey(code_mark)) { | |
539 return false; | 538 return false; |
540 } | 539 } |
541 | 540 |
542 // We do not (yet) flush code for optimized functions. | 541 // We do not (yet) flush code for optimized functions. |
543 if (function->code() != shared_info->code()) { | 542 if (function->code() != shared_info->code()) { |
544 return false; | 543 return false; |
545 } | 544 } |
546 | 545 |
547 // Check age of optimized code. | 546 // Check age of optimized code. |
548 if (FLAG_age_code && !function->code()->IsOld()) { | 547 if (FLAG_age_code && !function->code()->IsOld()) { |
549 return false; | 548 return false; |
550 } | 549 } |
551 | 550 |
552 return IsFlushable(heap, shared_info); | 551 return IsFlushable(heap, shared_info); |
553 } | 552 } |
554 | 553 |
555 | 554 |
556 template <typename StaticVisitor> | 555 template <typename StaticVisitor> |
557 bool StaticMarkingVisitor<StaticVisitor>::IsFlushable( | 556 bool StaticMarkingVisitor<StaticVisitor>::IsFlushable( |
558 Heap* heap, SharedFunctionInfo* shared_info) { | 557 Heap* heap, SharedFunctionInfo* shared_info) { |
559 // Code is either on stack, in compilation cache or referenced | 558 // Code is either on stack, in compilation cache or referenced |
560 // by optimized version of function. | 559 // by optimized version of function. |
561 MarkBit code_mark = ObjectMarking::MarkBitFrom(shared_info->code()); | 560 if (ObjectMarking::IsBlackOrGrey(shared_info->code())) { |
562 if (Marking::IsBlackOrGrey(code_mark)) { | |
563 return false; | 561 return false; |
564 } | 562 } |
565 | 563 |
566 // The function must be compiled and have the source code available, | 564 // The function must be compiled and have the source code available, |
567 // to be able to recompile it in case we need the function again. | 565 // to be able to recompile it in case we need the function again. |
568 if (!(shared_info->is_compiled() && HasSourceCode(heap, shared_info))) { | 566 if (!(shared_info->is_compiled() && HasSourceCode(heap, shared_info))) { |
569 return false; | 567 return false; |
570 } | 568 } |
571 | 569 |
572 // We never flush code for API functions. | 570 // We never flush code for API functions. |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
653 typedef FlexibleBodyVisitor<StaticVisitor, JSFunction::BodyDescriptorWeakCode, | 651 typedef FlexibleBodyVisitor<StaticVisitor, JSFunction::BodyDescriptorWeakCode, |
654 void> JSFunctionWeakCodeBodyVisitor; | 652 void> JSFunctionWeakCodeBodyVisitor; |
655 JSFunctionWeakCodeBodyVisitor::Visit(map, object); | 653 JSFunctionWeakCodeBodyVisitor::Visit(map, object); |
656 } | 654 } |
657 | 655 |
658 | 656 |
659 } // namespace internal | 657 } // namespace internal |
660 } // namespace v8 | 658 } // namespace v8 |
661 | 659 |
662 #endif // V8_OBJECTS_VISITING_INL_H_ | 660 #endif // V8_OBJECTS_VISITING_INL_H_ |
OLD | NEW |