0

我有源代码:

RenderPart* Frame::ownerRenderer() const
{
    HTMLFrameOwnerElement* ownerElement = m_ownerElement;
    if (!ownerElement)
        return 0;
    RenderObject* object = ownerElement->renderer();
    if (!object)
        return 0;
    // FIXME: If <object> is ever fixed to disassociate itself from frames
    // that it has started but canceled, then this can turn into an ASSERT
    // since m_ownerElement would be 0 when the load is canceled.
    // https://bugs.webkit.org/show_bug.cgi?id=18585
    if (!object->isRenderPart())
        return 0;
    return toRenderPart(object);
}

和 objdump:

00143408 <_ZNK7WebCore5Frame13ownerRendererEv>:
  143408:       b510            push    {r4, lr}
  14340a:       f8d0 32f0       ldr.w   r3, [r0, #752]                                 
  14340e:       b14b            cbz     r3, 143424 <_ZNK7WebCore5Frame13ownerRendererEv+0x1c>
  143410:       6a1c            ldr     r4, [r3, #32]                                  
  143412:       b13c            cbz     r4, 143424 <_ZNK7WebCore5Frame13ownerRendererEv+0x1c>
  143414:       6820            ldr     r0, [r4, #0]                                   
  143416:       f8d0 30b0       ldr.w   r3, [r0, #176]
  14341a:       4620            mov     r0, r4
  14341c:       4798            blx     r3
  14341e:       b108            cbz     r0, 143424 <_ZNK7WebCore5Frame13ownerRendererEv+0x1c>
  143420:       4620            mov     r0, r4
  143422:       e000            b.n     143426 <_ZNK7WebCore5Frame13ownerRendererEv+0x1e> 
  143424:       2000            movs    r0, #0
  143426:       bd10            pop     {r4, pc} 

现在想知道哪一行源码可以编译成143416行?

4

1 回答 1

2

我相信本质上是ownerElement->renderer.

142312 是最后一个if(!object)return 0下降到 143424-143426),然后 143414-14341a 正在准备函数调用ownerElement->renderer()

143414 正在将 ownerElement 放入 r0

143416 正在将 renderer() 的偏移量放入 r3

14341a 本质上是设置 this ptr 以在 renderer() 中使用(即 ownerElement)

14341c实际跳转到renderer()

于 2013-05-24T04:14:12.620 回答