Revise function call & Realm

* Revise Object::getPrototypeFromConstructor. we should get prototype from context of consturctor
* We should pass Optional<Object*> instead of Value with newTarget.
* Give correct prototype value for function prototypes and functions
* Implement %ThrowTypeError% correctly

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
This commit is contained in:
Seonghyun Kim 2020-04-01 10:40:26 +09:00 committed by Boram Bae
commit 1bd124fc1b
56 changed files with 642 additions and 646 deletions

View file

@ -94,7 +94,7 @@ bool NativeFunctionObject::isConstructor() const
}
template <bool isConstruct>
Value NativeFunctionObject::processNativeFunctionCall(ExecutionState& state, const Value& receiverSrc, const size_t argc, Value* argv, Object* newTarget)
Value NativeFunctionObject::processNativeFunctionCall(ExecutionState& state, const Value& receiverSrc, const size_t argc, Value* argv, Optional<Object*> newTarget)
{
volatile int sp;
size_t currentStackBase = (size_t)&sp;
@ -145,7 +145,7 @@ Value NativeFunctionObject::processNativeFunctionCall(ExecutionState& state, con
return result;
} else {
ASSERT(!newTarget);
return code->m_fn(newState, receiver, argc, argv, Value());
return code->m_fn(newState, receiver, argc, argv, nullptr);
}
}