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

@ -35,6 +35,22 @@
namespace Escargot {
void* Script::operator new(size_t size)
{
static bool typeInited = false;
static GC_descr descr;
if (!typeInited) {
GC_word obj_bitmap[GC_BITMAP_SIZE(Script)] = { 0 };
GC_set_bit(obj_bitmap, GC_WORD_OFFSET(Script, m_srcName));
GC_set_bit(obj_bitmap, GC_WORD_OFFSET(Script, m_sourceCode));
GC_set_bit(obj_bitmap, GC_WORD_OFFSET(Script, m_topCodeBlock));
GC_set_bit(obj_bitmap, GC_WORD_OFFSET(Script, m_moduleData));
descr = GC_make_descriptor(obj_bitmap, GC_WORD_LEN(Script));
typeInited = true;
}
return GC_MALLOC_EXPLICITLY_TYPED(size, descr);
}
bool Script::isExecuted()
{
if (isModule()) {