Add IsHTMLDDA feature

* https://www.ecma-international.org/ecma-262/#sec-IsHTMLDDA-internal-slot
* IsHTMLDDA internal slot is an ECMAScript feature for Web Browsers
* IsHTMLDDA is currently enabled only for test mode (we can enable it later if it is really used by third party app)
* some related operations are optionally fixed

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
This commit is contained in:
HyukWoo Park 2020-10-28 17:06:10 +09:00 committed by Patrick Kim
commit e0bd962e6e
11 changed files with 93 additions and 32 deletions

View file

@ -3584,14 +3584,21 @@ NEVER_INLINE void ByteCodeInterpreter::unaryTypeof(ExecutionState& state, UnaryT
} else {
ASSERT(val.isPointerValue());
PointerValue* p = val.asPointerValue();
if (p->isCallable()) {
val = state.context()->staticStrings().function.string();
} else if (p->isSymbol()) {
if (p->isSymbol()) {
val = state.context()->staticStrings().symbol.string();
} else if (p->isBigInt()) {
val = state.context()->staticStrings().bigint.string();
} else {
val = state.context()->staticStrings().object.string();
ASSERT(p->isObject());
if (!p->isCallable()) {
val = state.context()->staticStrings().object.string();
#if defined(ESCARGOT_ENABLE_TEST)
} else if (UNLIKELY(p->asObject()->isHTMLDDA())) {
val = state.context()->staticStrings().undefined.string();
#endif
} else {
val = state.context()->staticStrings().function.string();
}
}
}