Implement ES6 Symbol.hasInstance, iterator, toStringTag, toPrimitive and built-ins (#46)

* Implement Array.from
* Disable part of ES6-shim due to wrong implementation

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
This commit is contained in:
김승현/Tizen Platform Lab(SR)/Engineer/삼성전자 2018-01-19 15:20:27 +09:00 committed by 양지윤/Tizen Platform Lab(SR)/Engineer/삼성전자
commit e66f512b32
61 changed files with 1407 additions and 419 deletions

View file

@ -25,6 +25,7 @@ namespace Escargot {
extern size_t g_doubleInSmallValueTag;
extern size_t g_objectRareDataTag;
extern size_t g_symbolTag;
Value VMInstance::functionPrototypeNativeGetter(ExecutionState& state, Object* self, const SmallValue& privateDataFromObjectPrivateArea)
{
@ -182,6 +183,13 @@ VMInstance::VMInstance(const char* locale, const char* timezone)
ObjectRareData data(nullptr);
g_objectRareDataTag = *((size_t*)&data);
Symbol sm(nullptr);
g_symbolTag = *((size_t*)&sm);
#define DECLARE_GLOBAL_SYMBOLS(name) m_globalSymbols.name = new Symbol(String::fromASCII("Symbol." #name));
DEFINE_GLOBAL_SYMBOLS(DECLARE_GLOBAL_SYMBOLS);
#undef DECLARE_GLOBAL_SYMBOLS
ExecutionState stateForInit((Context*)nullptr);
ObjectStructure defaultStructureForObject(stateForInit);
@ -238,6 +246,8 @@ VMInstance::VMInstance(const char* locale, const char* timezone)
m_defaultStructureForStringObject = m_defaultStructureForObject->addProperty(stateForInit, m_staticStrings.length, ObjectStructurePropertyDescriptor::createDataButHasNativeGetterSetterDescriptor(&stringLengthGetterSetterData));
m_defaultStructureForSymbolObject = m_defaultStructureForObject;
m_defaultStructureForRegExpObject = m_defaultStructureForObject->addProperty(stateForInit, m_staticStrings.lastIndex,
ObjectStructurePropertyDescriptor::createDataButHasNativeGetterSetterDescriptor(&regexpLastIndexGetterSetterData));
// TODO(ES6): Below RegExp data properties is changed to accessor properties of RegExp.prototype in ES6.