Index: src/heap/objects-visiting-inl.h |
diff --git a/src/heap/objects-visiting-inl.h b/src/heap/objects-visiting-inl.h |
index 1851b66651f4962a0ccedc695e62d616a62b45ed..ddfae0e59587eb134989078cb89ed96ba57174f3 100644 |
--- a/src/heap/objects-visiting-inl.h |
+++ b/src/heap/objects-visiting-inl.h |
@@ -494,6 +494,14 @@ |
// non-flushable, because it is required for bailing out from |
// optimized code. |
collector->code_flusher()->AddCandidate(function); |
+ // Visit shared function info immediately to avoid double checking |
+ // of its flushability later. This is just an optimization because |
+ // the shared function info would eventually be visited. |
+ SharedFunctionInfo* shared = function->shared(); |
+ if (StaticVisitor::MarkObjectWithoutPush(heap, shared)) { |
+ StaticVisitor::MarkObject(heap, shared->map()); |
+ VisitSharedFunctionInfoWeakCode(heap, shared); |
+ } |
// Treat the reference to the code object weakly. |
VisitJSFunctionWeakCode(map, object); |
return; |