1. trait invalid LHS assigment correctly

2. implement ThrowStaticErrorOperation
3. optimize Get,SetObjectOpcode
4. optimize builtinArrayConstructor, Concat
5. implement SmallValue::fromValueForCtor it gives better performance when creating SmallValue from Value
6. add m_tag in String it gives the way to find typeof PointerValue without virtual function calling.
   we can remove this member variable when our project is ported into small device it has small memory

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
This commit is contained in:
seonghyun kim 2017-03-17 16:19:29 +09:00
commit 738dd930b0
17 changed files with 150 additions and 82 deletions

View file

@ -318,7 +318,7 @@ Value ByteCodeInterpreter::interpret(ExecutionState& state, ByteCodeBlock* byteC
const Value& willBeObject = registerFile[code->m_objectRegisterIndex];
const Value& property = registerFile[code->m_propertyRegisterIndex];
PointerValue* v;
if (LIKELY(willBeObject.isPointerValue() && (v = willBeObject.asPointerValue())->hasTag(g_arrayObjectTag))) {
if (LIKELY(willBeObject.isObject() && (v = willBeObject.asPointerValue())->hasTag(g_arrayObjectTag))) {
ArrayObject* arr = (ArrayObject*)v;
if (LIKELY(arr->isFastModeArray())) {
uint32_t idx;
@ -339,22 +339,14 @@ Value ByteCodeInterpreter::interpret(ExecutionState& state, ByteCodeBlock* byteC
}
}
}
Object* obj;
if (LIKELY(willBeObject.isObject())) {
obj = willBeObject.asObject();
} else {
obj = fastToObject(state, willBeObject);
}
registerFile[code->m_storeRegisterIndex] = obj->getIndexedProperty(state, property).value(state, obj);
ADD_PROGRAM_COUNTER(GetObject);
NEXT_INSTRUCTION();
goto GetObjectOpcodeSlowCase;
}
SetObjectOpcodeLbl : {
SetObject* code = (SetObject*)programCounter;
const Value& willBeObject = registerFile[code->m_objectRegisterIndex];
const Value& property = registerFile[code->m_propertyRegisterIndex];
if (LIKELY(willBeObject.isPointerValue() && (willBeObject.asPointerValue())->hasTag(g_arrayObjectTag))) {
if (LIKELY(willBeObject.isObject() && (willBeObject.asPointerValue())->hasTag(g_arrayObjectTag))) {
ArrayObject* arr = willBeObject.asObject()->asArrayObject();
if (LIKELY(arr->isFastModeArray())) {
uint32_t idx;
@ -678,6 +670,21 @@ Value ByteCodeInterpreter::interpret(ExecutionState& state, ByteCodeBlock* byteC
NEXT_INSTRUCTION();
}
GetObjectOpcodeSlowCase : {
GetObject* code = (GetObject*)programCounter;
const Value& willBeObject = registerFile[code->m_objectRegisterIndex];
const Value& property = registerFile[code->m_propertyRegisterIndex];
Object* obj;
if (LIKELY(willBeObject.isObject())) {
obj = willBeObject.asObject();
} else {
obj = fastToObject(state, willBeObject);
}
registerFile[code->m_storeRegisterIndex] = obj->getIndexedProperty(state, property).value(state, obj);
ADD_PROGRAM_COUNTER(GetObject);
NEXT_INSTRUCTION();
}
SetObjectOpcodeSlowCase : {
SetObject* code = (SetObject*)programCounter;
const Value& willBeObject = registerFile[code->m_objectRegisterIndex];
@ -938,6 +945,11 @@ Value ByteCodeInterpreter::interpret(ExecutionState& state, ByteCodeBlock* byteC
return ret;
}
ThrowStaticErrorOperationOpcodeLbl : {
ThrowStaticErrorOperation* code = (ThrowStaticErrorOperation*)programCounter;
ErrorObject::throwBuiltinError(state, (ErrorObject::Code)code->m_errorKind, code->m_errorMessage);
}
EndOpcodeLbl:
CallNativeFunctionOpcodeLbl:
CallBoundFunctionOpcodeLbl: