( Object o )
| 509 | } |
| 510 | |
| 511 | // Return the immediate dominator of this Node and compute dom tree depth. |
| 512 | Node idom() { return in(0); } |
| 513 | |
| 514 | // Find the lowest common ancestor in the current dominator tree. |
| 515 | Node domLCA(Node rhs) { |
| 516 | if( rhs==null ) return this; |
| 517 | Node lhs = this; |
| 518 | while( lhs != rhs ) { |
| 519 | if( lhs==null || rhs==null ) return null; |
| 520 | int comp = lhs.idepth() - rhs.idepth(); |
| 521 | if( comp >= 0 ) lhs = lhs.idom(); |
| 522 | if( comp <= 0 ) rhs = rhs.idom(); |
| 523 | } |
| 524 | return lhs; |