unsigned CallFrame::bytecodeOffset() { if (!codeBlock()) return 0; #if ENABLE(DFG_JIT) if (hasLocationAsCodeOriginIndex()) return bytecodeOffsetFromCodeOriginIndex(); #endif return locationAsBytecodeOffset(); }
CodeOrigin CallFrame::codeOrigin() { if (!codeBlock()) return CodeOrigin(0); #if ENABLE(DFG_JIT) if (hasLocationAsCodeOriginIndex()) { unsigned index = locationAsCodeOriginIndex(); ASSERT(codeBlock()->canGetCodeOrigin(index)); return codeBlock()->codeOrigin(index); } #endif return CodeOrigin(locationAsBytecodeOffset()); }
unsigned CallFrame::bytecodeOffsetFromCodeOriginIndex() { ASSERT(hasLocationAsCodeOriginIndex()); CodeBlock* codeBlock = this->codeBlock(); ASSERT(codeBlock); CodeOrigin codeOrigin; unsigned index = locationAsCodeOriginIndex(); ASSERT(codeBlock->canGetCodeOrigin(index)); codeOrigin = codeBlock->codeOrigin(index); for (InlineCallFrame* inlineCallFrame = codeOrigin.inlineCallFrame; inlineCallFrame;) { if (inlineCallFrame->baselineCodeBlock() == codeBlock) return codeOrigin.bytecodeIndex; codeOrigin = inlineCallFrame->caller; inlineCallFrame = codeOrigin.inlineCallFrame; } return codeOrigin.bytecodeIndex; }