Restore "direct" call optimization for DECORATE

This commit is contained in:
Randy Heit 2016-02-18 22:05:16 -06:00
commit b1098ede93
3 changed files with 18 additions and 22 deletions

View file

@ -3202,24 +3202,6 @@ ExpEmit FxVMFunctionCall::Emit(VMFunctionBuilder *build, bool tailcall)
}
}
//==========================================================================
//
// FxVMFunctionCall :: GetDirectFunction
//
// If the function is not passed any explicit arguments, returns the
// function. Otherwise returns NULL.
//
//==========================================================================
VMFunction *FxVMFunctionCall::GetDirectFunction()
{
if (GetArgCount() == 0)
{
return GetVMFunction();
}
return NULL;
}
//==========================================================================
//
//
@ -3505,6 +3487,19 @@ ExpEmit FxReturnStatement::Emit(VMFunctionBuilder *build)
return ExpEmit();
}
VMFunction *FxReturnStatement::GetDirectFunction()
{
// If this return statement calls a function with no arguments,
// then it can be a "direct" function. That is, the DECORATE
// definition can call that function directly without wrapping
// it inside VM code.
if (Call != NULL && Call->GetArgCount() == 0)
{
return Call->GetVMFunction();
}
return NULL;
}
//==========================================================================
//
//==========================================================================