Remove duplicated check code in Construct operation

* Object::construct directly calls each internal construct method without any check code
* ByteCodeInterpreter::constructOperation is added to run IsConstructor check code

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
This commit is contained in:
HyukWoo Park 2020-03-10 17:51:38 +09:00 committed by Boram Bae
commit d9a9bcf860
5 changed files with 21 additions and 13 deletions

View file

@ -130,9 +130,6 @@ public:
Object* ScriptFunctionObject::construct(ExecutionState& state, const size_t argc, NULLABLE Value* argv, Object* newTarget)
{
if (UNLIKELY(!newTarget->isConstructor())) {
ErrorObject::throwBuiltinError(state, ErrorObject::TypeError, errorMessage_Not_Constructor_Function, codeBlock()->functionName());
}
// Assert: Type(newTarget) is Object.
ASSERT(newTarget->isObject());
ASSERT(newTarget->isConstructor());