while (frame != null) {
List monitors = frame.getMonitors();
OopHandle givenHandle = obj.getHandle();
for (Iterator itr = monitors.iterator(); itr.hasNext();) {
MonitorInfo mi = (MonitorInfo) itr.next();
if (mi.eliminated() && frame.isCompiledFrame()) continue; // skip eliminated monitor
if (givenHandle.equals(mi.owner())) {
res++;
}
}
frame = (JavaVFrame) frame.javaSender();