mirror of
https://github.com/Samsung/escargot.git
synced 2026-06-22 10:01:50 +00:00
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:
parent
ccdf475f9b
commit
f56a557ff5
22 changed files with 277 additions and 186 deletions
|
|
@ -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()) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue