Reduce memory allocation during bytecode generation

* ByteCodeBlock does not hold location data info anymore
* location data of each bytecode is manually allocated only for stack-tracing or debugger mode
* duplicated String allocation for source code is removed

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
This commit is contained in:
HyukWoo Park 2020-08-03 17:19:29 +09:00 committed by Boram Bae
commit f56a557ff5
22 changed files with 277 additions and 186 deletions

View file

@ -267,9 +267,7 @@ void CodeCacheWriter::storeByteCodeBlock(ByteCodeBlock* block)
size_t size;
m_buffer.ensureSize(4 * sizeof(bool) + sizeof(uint16_t));
m_buffer.put(block->m_isEvalMode);
m_buffer.put(block->m_isOnGlobal);
m_buffer.ensureSize(2 * sizeof(bool) + sizeof(uint16_t));
m_buffer.put(block->m_shouldClearStack);
m_buffer.put(block->m_isOwnerMayFreed);
m_buffer.put((uint16_t)block->m_requiredRegisterFileSizeInValueSize);
@ -715,8 +713,6 @@ ByteCodeBlock* CodeCacheReader::loadByteCodeBlock(Context* context, Script* scri
size_t size;
ByteCodeBlock* block = new ByteCodeBlock(script->topCodeBlock());
block->m_isEvalMode = m_buffer.get<bool>();
block->m_isOnGlobal = m_buffer.get<bool>();
block->m_shouldClearStack = m_buffer.get<bool>();
block->m_isOwnerMayFreed = m_buffer.get<bool>();
block->m_requiredRegisterFileSizeInValueSize = m_buffer.get<uint16_t>();