mirror of
https://github.com/Samsung/escargot.git
synced 2026-06-22 10:01:50 +00:00
Implement general tail call optimization
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
This commit is contained in:
parent
65558531f8
commit
023b7ea014
27 changed files with 368 additions and 89 deletions
|
|
@ -278,7 +278,7 @@ ByteCodeBlock* ByteCodeGenerator::generateByteCode(Context* context, Interpreted
|
|||
|
||||
block->m_code.shrinkToFit();
|
||||
block->m_requiredTotalRegisterNumber = block->m_requiredOperandRegisterNumber + codeBlock->totalStackAllocatedVariableSize() + block->m_numeralLiteralData.size();
|
||||
block->m_needsExtendedExectuionState = ctx.m_needsExtendedExecutionState;
|
||||
block->m_needsExtendedExecutionState = ctx.m_needsExtendedExecutionState;
|
||||
|
||||
#if defined(ENABLE_CODE_CACHE)
|
||||
// cache bytecode right before relocation
|
||||
|
|
@ -612,6 +612,13 @@ void ByteCodeGenerator::relocateByteCode(ByteCodeBlock* block)
|
|||
ASSIGN_STACKINDEX_IF_NEEDED(cd->m_argumentsStartIndex, stackBase, stackBaseWillBe, stackVariableSize);
|
||||
break;
|
||||
}
|
||||
case TailCallOpcode: {
|
||||
TailCall* cd = (TailCall*)currentCode;
|
||||
ASSIGN_STACKINDEX_IF_NEEDED(cd->m_receiverIndex, stackBase, stackBaseWillBe, stackVariableSize);
|
||||
ASSIGN_STACKINDEX_IF_NEEDED(cd->m_calleeIndex, stackBase, stackBaseWillBe, stackVariableSize);
|
||||
ASSIGN_STACKINDEX_IF_NEEDED(cd->m_argumentsStartIndex, stackBase, stackBaseWillBe, stackVariableSize);
|
||||
break;
|
||||
}
|
||||
case TailRecursionOpcode: {
|
||||
TailRecursion* cd = (TailRecursion*)currentCode;
|
||||
ASSIGN_STACKINDEX_IF_NEEDED(cd->m_receiverIndex, stackBase, stackBaseWillBe, stackVariableSize);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue