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