mirror of
https://github.com/Samsung/escargot.git
synced 2026-06-29 10:02:14 +00:00
* Optimize ObjectStructurePropertyDescriptor * Don't initialize inline storage of VectorWithInlineStorage * Add Object::setPrototypeForIntrinsicObjectCreation for fast initialize * Add ArrayObject::ArrayObject(ExecutionState& state, const uint64_t& size) for fast initialize * Store stack-limit instead of stack-base * Reduce size of ExecutionState * Add fast version of Object::ownPropertyKeys for optimize Object.keys * Add ValueVectorWithInlineStorage * Remove some compiler warnings Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
49 lines
1.9 KiB
C++
49 lines
1.9 KiB
C++
/*
|
|
* Copyright (c) 2018-present Samsung Electronics Co., Ltd
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2 of the License, or (at your option) any later version.
|
|
*
|
|
* This library is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with this library; if not, write to the Free Software
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
|
* USA
|
|
*/
|
|
|
|
#include "Escargot.h"
|
|
#include "SymbolObject.h"
|
|
#include "Context.h"
|
|
|
|
namespace Escargot {
|
|
|
|
SymbolObject::SymbolObject(ExecutionState& state, Symbol* value)
|
|
: Object(state, ESCARGOT_OBJECT_BUILTIN_PROPERTY_NUMBER + 1, true)
|
|
, m_primitiveValue(value)
|
|
{
|
|
m_structure = state.context()->defaultStructureForSymbolObject();
|
|
Object::setPrototypeForIntrinsicObjectCreation(state, state.context()->globalObject()->symbolPrototype());
|
|
}
|
|
|
|
void* SymbolObject::operator new(size_t size)
|
|
{
|
|
static bool typeInited = false;
|
|
static GC_descr descr;
|
|
if (!typeInited) {
|
|
GC_word obj_bitmap[GC_BITMAP_SIZE(SymbolObject)] = { 0 };
|
|
GC_set_bit(obj_bitmap, GC_WORD_OFFSET(SymbolObject, m_structure));
|
|
GC_set_bit(obj_bitmap, GC_WORD_OFFSET(SymbolObject, m_prototype));
|
|
GC_set_bit(obj_bitmap, GC_WORD_OFFSET(SymbolObject, m_values));
|
|
GC_set_bit(obj_bitmap, GC_WORD_OFFSET(SymbolObject, m_primitiveValue));
|
|
descr = GC_make_descriptor(obj_bitmap, GC_WORD_LEN(SymbolObject));
|
|
typeInited = true;
|
|
}
|
|
return GC_MALLOC_EXPLICITLY_TYPED(size, descr);
|
|
}
|
|
}
|