mirror of
https://github.com/Samsung/escargot.git
synced 2026-06-22 10:01:50 +00:00
1. use typed allocate for all long-live objects
2. implicitly delete AST when ast is useless 3. allocate String::emptyString correctly 4. hide ptr in LeakChecker for better tracing Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
This commit is contained in:
parent
f95fd596ef
commit
2fc34d628a
44 changed files with 350 additions and 140 deletions
|
|
@ -268,6 +268,22 @@ Object::Object(ExecutionState& state)
|
|||
{
|
||||
}
|
||||
|
||||
void* Object::operator new(size_t size)
|
||||
{
|
||||
static bool typeInited = false;
|
||||
static GC_descr descr;
|
||||
if (!typeInited) {
|
||||
GC_word obj_bitmap[GC_BITMAP_SIZE(Object)] = { 0 };
|
||||
GC_set_bit(obj_bitmap, GC_WORD_OFFSET(Object, m_structure));
|
||||
GC_set_bit(obj_bitmap, GC_WORD_OFFSET(Object, m_rareData));
|
||||
GC_set_bit(obj_bitmap, GC_WORD_OFFSET(Object, m_prototype));
|
||||
GC_set_bit(obj_bitmap, GC_WORD_OFFSET(Object, m_values));
|
||||
descr = GC_make_descriptor(obj_bitmap, GC_WORD_LEN(Object));
|
||||
typeInited = true;
|
||||
}
|
||||
return GC_MALLOC_EXPLICITLY_TYPED(size, descr);
|
||||
}
|
||||
|
||||
void Object::initPlainObject(ExecutionState& state)
|
||||
{
|
||||
m_prototype = state.context()->globalObject()->objectPrototype()->asObject();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue