static JSValue retrieveCallerFunction(ExecState* exec, JSFunction* functionObj) { StackIterator iter = exec->find(functionObj, skipOverBoundFunctions); if (iter != exec->end()) ++iter; return iter != exec->end() && iter->callee() ? iter->callee() : jsNull(); }
PassRefPtr<ScriptCallStack> createScriptCallStack(JSC::ExecState* exec, size_t maxStackSize) { Vector<ScriptCallFrame> frames; ASSERT(exec); CallFrame* frame = exec->vm().topCallFrame; StackIterator iter = frame->begin(); if (iter.numberOfFrames() > 1) ++iter; for (; iter != frame->end() && maxStackSize--; ++iter) { // This early exit is necessary to maintain our old behaviour // but the stack trace we produce now is complete and handles all // ways in which code may be running if (!iter->callee() && frames.size()) break; unsigned line; unsigned column; iter->computeLineAndColumn(line, column); frames.append(ScriptCallFrame(iter->functionName(), iter->sourceURL(), line, column)); } return ScriptCallStack::create(frames); }