| 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 } |
| 497 // Treat the reference to the code object weakly. | 505 // Treat the reference to the code object weakly. |
| 498 VisitJSFunctionWeakCode(map, object); | 506 VisitJSFunctionWeakCode(map, object); |
| 499 return; | 507 return; |
| 500 } else { | 508 } else { |
| 501 // Visit all unoptimized code objects to prevent flushing them. | 509 // Visit all unoptimized code objects to prevent flushing them. |
| 502 StaticVisitor::MarkObject(heap, function->shared()->code()); | 510 StaticVisitor::MarkObject(heap, function->shared()->code()); |
| 503 } | 511 } |
| 504 } | 512 } |
| 505 VisitJSFunctionStrongCode(map, object); | 513 VisitJSFunctionStrongCode(map, object); |
| 506 } | 514 } |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 800 typedef FlexibleBodyVisitor<StaticVisitor, JSFunction::BodyDescriptorWeakCode, | 808 typedef FlexibleBodyVisitor<StaticVisitor, JSFunction::BodyDescriptorWeakCode, |
| 801 void> JSFunctionWeakCodeBodyVisitor; | 809 void> JSFunctionWeakCodeBodyVisitor; |
| 802 JSFunctionWeakCodeBodyVisitor::Visit(map, object); | 810 JSFunctionWeakCodeBodyVisitor::Visit(map, object); |
| 803 } | 811 } |
| 804 | 812 |
| 805 | 813 |
| 806 } // namespace internal | 814 } // namespace internal |
| 807 } // namespace v8 | 815 } // namespace v8 |
| 808 | 816 |
| 809 #endif // V8_OBJECTS_VISITING_INL_H_ | 817 #endif // V8_OBJECTS_VISITING_INL_H_ |
| OLD | NEW |