1. implement ObjectDefineOwnPropertyOperation

2. Add errorcode in ScriptError
3. Fix array length bug
4. Fix ObjectPropertyDescriptor::ObjectPropertyDescriptor(ExecutionState& state, Object* obj)

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
This commit is contained in:
seonghyun kim 2016-12-23 22:21:22 +09:00
commit 5bca24da82
18 changed files with 244 additions and 125 deletions

View file

@ -553,11 +553,22 @@ void ByteCodeInterpreter::interpret(ExecutionState& state, CodeBlock* codeBlock,
CreateArrayOpcodeLbl : {
CreateArray* code = (CreateArray*)currentCode;
registerFile[code->m_registerIndex] = new ArrayObject(state);
ArrayObject* arr = new ArrayObject(state);
arr->setLength(state, code->m_length);
registerFile[code->m_registerIndex] = arr;
ADD_PROGRAM_COUNTER(CreateArray);
NEXT_INSTRUCTION();
}
ObjectDefineOwnPropertyOperationOpcodeLbl : {
ObjectDefineOwnPropertyOperation* code = (ObjectDefineOwnPropertyOperation*)currentCode;
const Value& willBeObject = registerFile[code->m_objectRegisterIndex];
const Value& property = registerFile[code->m_propertyRegisterIndex];
willBeObject.asObject()->defineOwnProperty(state, ObjectPropertyName(state, property), ObjectPropertyDescriptor(registerFile[code->m_loadRegisterIndex], ObjectPropertyDescriptor::AllPresent));
ADD_PROGRAM_COUNTER(ObjectDefineOwnPropertyOperation);
NEXT_INSTRUCTION();
}
DeclareVarVariableOpcodeLbl : {
DeclareVarVariable* code = (DeclareVarVariable*)currentCode;
record->createMutableBinding(state, code->m_name, false);