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