Skip to content

Commit 9d9f7f4

Browse files
committed
[MERGE #6098 @wyrichte] Fixes #5990 - fixes incorrect argsInsCount in AsmJs ("this" was being considered in AsmJs)
Merge pull request #6098 from wyrichte:build/wyrichte/asmjs
2 parents fe84b27 + dad5ca6 commit 9d9f7f4

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

lib/Backend/BackwardPass.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7865,7 +7865,8 @@ BackwardPass::DeadStoreInstr(IR::Instr *instr)
78657865

78667866
if (instr->m_opcode == Js::OpCode::ArgIn_A)
78677867
{
7868-
//Ignore tracking ArgIn for "this", as argInsCount only tracks other params - unless it is a asmjs function(which doesn't have a "this").
7868+
// Ignore tracking ArgIn for "this" as argInsCount only tracks other
7869+
// params, unless it is a AsmJS function (which doesn't have a "this").
78697870
if (instr->GetSrc1()->AsSymOpnd()->m_sym->AsStackSym()->GetParamSlotNum() != 1 || func->GetJITFunctionBody()->IsAsmJsMode())
78707871
{
78717872
Assert(this->func->argInsCount > 0);

lib/Backend/GlobOpt.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,13 @@ void
165165
GlobOpt::Optimize()
166166
{
167167
this->objectTypeSyms = nullptr;
168-
this->func->argInsCount = this->func->GetInParamsCount() - 1; //Don't include "this" pointer in the count.
168+
169+
this->func->argInsCount = this->func->GetInParamsCount();
170+
if (!func->GetJITFunctionBody()->IsAsmJsMode())
171+
{
172+
// Don't include "this" pointer in the count when not in AsmJs mode (AsmJS does not have "this").
173+
this->func->argInsCount--;
174+
}
169175

170176
if (!func->DoGlobOpt())
171177
{

0 commit comments

Comments
 (0)