• yutak's avatar
    BlinkGCPlugin: Handle omitted trace() in intermediary classes. · 4a636301
    yutak authored
    As a result of introducing templated traceImpl() function, the callee part of
    "Base::trace()" call (i.e. Base::trace) may not be fully resolved at the time
    of the plugin execution. This has caused another issue in cases where trace()
    is intentionally omitted because the class has no fields to trace.
    
    Consider the following example:
    
        class A : public GarbageCollected<A> { trace() { ... } };
        class B : public A { /* No trace() */ };
        class C : public B { trace() { B::trace(visitor); } };
    
    The "B::trace()" call in C is actually A::trace(). If the callee part "B::trace"
    is unresolved, we only know that "there is a function call which will be
    resolved to A::trace()". We still want to mark B as traced when we see such
    a function call.
    
    This patch fixes this trace call detection logic so we can handle this case.
    The new logic keeps going up the class hierarchy while the class is not
    required to have a trace method, and if we find a class that matches the class
    of the (unresolved) callee part, we mark the direct base class of the original
    class as traced.
    
    BUG=462511
    R=kouhei@chromium.org
    CC=zerny@chromium.org, oilpan-reviews@chromium.org
    
    Review URL: https://codereview.chromium.org/964273002
    
    Cr-Commit-Position: refs/heads/master@{#318665}
    4a636301
BlinkGCPlugin.cpp 72.4 KB