Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions lib/Runtime/Base/ScriptContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2821,17 +2821,30 @@ namespace Js
while (asmEnvIter.IsValid())
{
// we are attaching, change frame setup for asm.js frame to javascript frame
SList<AsmJsScriptFunction*> * funcList = asmEnvIter.CurrentValue();
SList<AsmJsScriptFunction *> * funcList = asmEnvIter.CurrentValue();
Assert(!funcList->Empty());
void* newEnv = AsmJsModuleInfo::ConvertFrameForJavascript(asmEnvIter.CurrentKey(), funcList->Head());
while (!funcList->Empty())
funcList->Iterate([&](AsmJsScriptFunction * func)
{
AsmJsScriptFunction* func = funcList->Pop();
func->GetEnvironment()->SetItem(0, newEnv);
func->SetModuleMemory(nullptr);
}
});
asmEnvIter.MoveNext();
}

// walk through and clean up the asm.js fields as a discrete step, because module might be multiply linked
auto asmCleanupIter = asmJsEnvironmentMap->GetIterator();
while (asmCleanupIter.IsValid())
{
SList<AsmJsScriptFunction *> * funcList = asmCleanupIter.CurrentValue();
Assert(!funcList->Empty());
funcList->Iterate([](AsmJsScriptFunction * func)
{
func->SetModuleMemory(nullptr);
func->GetFunctionBody()->ResetAsmJsInfo();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GetFunctionBody() guarantees to return non-null?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be in this list, scriptFunction->GetFunctionBody()->GetAsmJsFunctionInfo() must be non-null (from TransitionEnvironmentForDebugger). But that also assumes GetFunctionBody() is non-null.

From comment "// We should have force parsed the function, and have a function body" in RecyclerFunctionCallbackForDebugger, and my understanding that we full parse everything when we attach debugger, I took this as truth. If you want, I can add an assert here/in TransitionEnvironmentForDebugger, if nothing else but for the sake of clarity.

});
asmCleanupIter.MoveNext();
}

ReleaseTemporaryAllocator(tmpAlloc);
#endif
END_TRANSLATE_OOM_TO_HRESULT(hrEntryPointUpdate);
Expand Down