void SnapshotExtractor::MarkFunctionBody(Js::FunctionBody* fb) { if(this->m_marks.MarkAndTestAddr<MarkTableTag::FunctionBodyTag>(fb)) { Js::FunctionBody* currfb = fb->GetScriptContext()->TTDContextInfo->ResolveParentBody(fb); while(currfb != nullptr && this->m_marks.MarkAndTestAddr<MarkTableTag::FunctionBodyTag>(currfb)) { currfb = currfb->GetScriptContext()->TTDContextInfo->ResolveParentBody(currfb); } } }
void Sym::Dump(IRDumpFlags flags, const ValueType valueType) { bool const AsmDumpMode = flags & IRDumpFlags_AsmDumpMode; bool const SimpleForm = !!(flags & IRDumpFlags_SimpleForm); if (AsmDumpMode) { if (this->IsStackSym() && this->AsStackSym()->IsArgSlotSym()) { Output::Print(L"arg "); } else if (this->IsStackSym() && this->AsStackSym()->IsParamSlotSym()) { Output::Print(L"param "); } } else { if (this->IsStackSym() && this->AsStackSym()->IsArgSlotSym()) { if (this->AsStackSym()->m_isInlinedArgSlot) { Output::Print(L"iarg%d", this->AsStackSym()->GetArgSlotNum()); } else { Output::Print(L"arg%d", this->AsStackSym()->GetArgSlotNum()); } Output::Print(L"(s%d)", m_id); } else if (this->IsStackSym() && this->AsStackSym()->IsParamSlotSym()) { Output::Print(L"prm%d", this->AsStackSym()->GetParamSlotNum()); } else { if (!this->IsPropertySym() || !SimpleForm) { Output::Print(L"s%d", m_id); } if (this->IsStackSym()) { if(Js::Configuration::Global.flags.Debug && this->AsStackSym()->HasByteCodeRegSlot()) { StackSym* sym = this->AsStackSym(); Js::FunctionBody* functionBody = sym->GetByteCodeFunc()->GetJnFunction(); if(functionBody->GetPropertyIdOnRegSlotsContainer()) { if(functionBody->IsNonTempLocalVar(sym->GetByteCodeRegSlot())) { uint index = sym->GetByteCodeRegSlot() - functionBody->GetConstantCount(); Js::PropertyId propertyId = functionBody->GetPropertyIdOnRegSlotsContainer()->propertyIdsForRegSlots[index]; Output::Print(L"(%s)", functionBody->GetScriptContext()->GetPropertyNameLocked(propertyId)->GetBuffer()); } } } if (this->AsStackSym()->IsVar()) { if (this->AsStackSym()->HasObjectTypeSym() && !SimpleForm) { Output::Print(L"<s%d>", this->AsStackSym()->GetObjectTypeSym()->m_id); } } else { StackSym *varSym = this->AsStackSym()->GetVarEquivSym(nullptr); if (varSym) { Output::Print(L"(s%d)", varSym->m_id); } } if (!SimpleForm) { if (this->AsStackSym()->m_builtInIndex != Js::BuiltinFunction::None) { Output::Print(L"[ffunc]"); } } } } if(IsStackSym()) { IR::Opnd::DumpValueType(valueType); } } if (this->IsPropertySym()) { PropertySym *propertySym = this->AsPropertySym(); if (!SimpleForm) { Output::Print(L"("); } Js::ScriptContext* scriptContext; switch (propertySym->m_fieldKind) { case PropertyKindData: { propertySym->m_stackSym->Dump(flags, valueType); scriptContext = propertySym->m_func->GetScriptContext(); Js::PropertyRecord const* fieldName = scriptContext->GetPropertyNameLocked(propertySym->m_propertyId); Output::Print(L"->%s", fieldName->GetBuffer()); break; } case PropertyKindSlots: case PropertyKindSlotArray: propertySym->m_stackSym->Dump(flags, valueType); Output::Print(L"[%d]", propertySym->m_propertyId); break; case PropertyKindLocalSlots: propertySym->m_stackSym->Dump(flags, valueType); Output::Print(L"l[%d]", propertySym->m_propertyId); break; default: AssertMsg(0, "Unknown field kind"); break; } if (!SimpleForm) { Output::Print(L")"); } } }