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 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 MarkCompactCollector* collector = heap->mark_compact_collector(); | 487 MarkCompactCollector* collector = heap->mark_compact_collector(); |
488 if (collector->is_code_flushing_enabled()) { | 488 if (collector->is_code_flushing_enabled()) { |
489 if (IsFlushable(heap, function)) { | 489 if (IsFlushable(heap, function)) { |
490 // This function's code looks flushable. But we have to postpone | 490 // This function's code looks flushable. But we have to postpone |
491 // the decision until we see all functions that point to the same | 491 // the decision until we see all functions that point to the same |
492 // SharedFunctionInfo because some of them might be optimized. | 492 // SharedFunctionInfo because some of them might be optimized. |
493 // That would also make the non-optimized version of the code | 493 // That would also make the non-optimized version of the code |
494 // non-flushable, because it is required for bailing out from | 494 // non-flushable, because it is required for bailing out from |
495 // optimized code. | 495 // optimized code. |
496 collector->code_flusher()->AddCandidate(function); | 496 collector->code_flusher()->AddCandidate(function); |
497 // Visit shared function info immediately to avoid double checking | |
498 // of its flushability later. This is just an optimization because | |
499 // the shared function info would eventually be visited. | |
500 SharedFunctionInfo* shared = function->shared(); | |
501 if (StaticVisitor::MarkObjectWithoutPush(heap, shared)) { | |
502 StaticVisitor::MarkObject(heap, shared->map()); | |
503 VisitSharedFunctionInfoWeakCode(heap, shared); | |
504 } | |
505 // Treat the reference to the code object weakly. | 497 // Treat the reference to the code object weakly. |
506 VisitJSFunctionWeakCode(map, object); | 498 VisitJSFunctionWeakCode(map, object); |
507 return; | 499 return; |
508 } else { | 500 } else { |
509 // Visit all unoptimized code objects to prevent flushing them. | 501 // Visit all unoptimized code objects to prevent flushing them. |
510 StaticVisitor::MarkObject(heap, function->shared()->code()); | 502 StaticVisitor::MarkObject(heap, function->shared()->code()); |
511 } | 503 } |
512 } | 504 } |
513 VisitJSFunctionStrongCode(map, object); | 505 VisitJSFunctionStrongCode(map, object); |
514 } | 506 } |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
808 typedef FlexibleBodyVisitor<StaticVisitor, JSFunction::BodyDescriptorWeakCode, | 800 typedef FlexibleBodyVisitor<StaticVisitor, JSFunction::BodyDescriptorWeakCode, |
809 void> JSFunctionWeakCodeBodyVisitor; | 801 void> JSFunctionWeakCodeBodyVisitor; |
810 JSFunctionWeakCodeBodyVisitor::Visit(map, object); | 802 JSFunctionWeakCodeBodyVisitor::Visit(map, object); |
811 } | 803 } |
812 | 804 |
813 | 805 |
814 } // namespace internal | 806 } // namespace internal |
815 } // namespace v8 | 807 } // namespace v8 |
816 | 808 |
817 #endif // V8_OBJECTS_VISITING_INL_H_ | 809 #endif // V8_OBJECTS_VISITING_INL_H_ |
OLD | NEW |