String StackVisitor::Frame::functionName() const { String traceLine; switch (codeType()) { case CodeType::Wasm: traceLine = makeString(m_wasmFunctionIndexOrName); break; case CodeType::Eval: traceLine = "eval code"_s; break; case CodeType::Module: traceLine = "module code"_s; break; case CodeType::Native: { JSCell* callee = this->callee().asCell(); if (callee) traceLine = getCalculatedDisplayName(callFrame()->vm(), jsCast<JSObject*>(callee)).impl(); break; } case CodeType::Function: traceLine = getCalculatedDisplayName(callFrame()->vm(), jsCast<JSObject*>(this->callee().asCell())).impl(); break; case CodeType::Global: traceLine = "global code"_s; break; } return traceLine.isNull() ? emptyString() : traceLine; }
String StackVisitor::Frame::functionName() { String traceLine; JSObject* callee = this->callee(); switch (codeType()) { case CodeType::Eval: traceLine = ASCIILiteral("eval code"); break; case CodeType::Module: traceLine = ASCIILiteral("module code"); break; case CodeType::Native: if (callee) traceLine = getCalculatedDisplayName(callFrame(), callee).impl(); break; case CodeType::Function: traceLine = getCalculatedDisplayName(callFrame(), callee).impl(); break; case CodeType::Global: traceLine = ASCIILiteral("global code"); break; } return traceLine.isNull() ? emptyString() : traceLine; }
String StackVisitor::Frame::sourceURL() { String traceLine; switch (codeType()) { case CodeType::Eval: case CodeType::Function: case CodeType::Global: { String sourceURL = codeBlock()->ownerExecutable()->sourceURL(); if (!sourceURL.isEmpty()) traceLine = sourceURL.impl(); break; } case CodeType::Native: traceLine = ASCIILiteral("[native code]"); break; } return traceLine.isNull() ? emptyString() : traceLine; }
String StackVisitor::Frame::sourceURL() const { String traceLine; switch (codeType()) { case CodeType::Eval: case CodeType::Module: case CodeType::Function: case CodeType::Global: { String sourceURL = codeBlock()->ownerExecutable()->sourceURL(); if (!sourceURL.isEmpty()) traceLine = sourceURL.impl(); break; } case CodeType::Native: traceLine = "[native code]"_s; break; case CodeType::Wasm: traceLine = "[wasm code]"_s; break; } return traceLine.isNull() ? emptyString() : traceLine; }
CodeType GlobalFuncImp::codeType() const { return id == Eval ? EvalCode : codeType(); }