@@ -7716,45 +7716,37 @@ using namespace Js;
7716
7716
}
7717
7717
7718
7718
RecyclableObject* constructor = VarTo<RecyclableObject>(aClass);
7719
- if (scriptContext->GetConfig()->IsES6HasInstanceEnabled( ))
7719
+ if (VarIs<JavascriptFunction>(constructor ))
7720
7720
{
7721
- if (VarIs<JavascriptFunction>(constructor))
7721
+ JavascriptFunction* func = VarTo<JavascriptFunction>(constructor);
7722
+ if (func->IsBoundFunction())
7722
7723
{
7723
- JavascriptFunction* func = VarTo<JavascriptFunction>(constructor);
7724
- if (func->IsBoundFunction())
7725
- {
7726
- BoundFunction* boundFunc = (BoundFunction*)func;
7727
- constructor = boundFunc->GetTargetFunction();
7728
- }
7724
+ BoundFunction* boundFunc = (BoundFunction*)func;
7725
+ constructor = boundFunc->GetTargetFunction();
7729
7726
}
7730
-
7731
- Var instOfHandler = JavascriptOperators::GetPropertyNoCache(constructor,
7732
- PropertyIds::_symbolHasInstance, scriptContext);
7733
- if (JavascriptOperators::IsUndefinedObject(instOfHandler)
7734
- || instOfHandler == scriptContext->GetBuiltInLibraryFunction(JavascriptFunction::EntryInfo::SymbolHasInstance.GetOriginalEntryPoint()))
7727
+ }
7728
+
7729
+ Var instOfHandler = JavascriptOperators::GetPropertyNoCache(constructor,
7730
+ PropertyIds::_symbolHasInstance, scriptContext);
7731
+ if (JavascriptOperators::IsUndefinedObject(instOfHandler))
7732
+ {
7733
+ return JavascriptBoolean::ToVar(constructor->HasInstance(instance, scriptContext, inlineCache), scriptContext);
7734
+ }
7735
+ else
7736
+ {
7737
+ if (!JavascriptConversion::IsCallable(instOfHandler))
7735
7738
{
7736
- return JavascriptBoolean::ToVar(constructor->HasInstance(instance, scriptContext, inlineCache), scriptContext );
7739
+ JavascriptError::ThrowTypeError( scriptContext, JSERR_Property_NeedFunction, _u("Symbol[Symbol.hasInstance]") );
7737
7740
}
7738
- else
7739
- {
7740
- if (!JavascriptConversion::IsCallable(instOfHandler))
7741
- {
7742
- JavascriptError::ThrowTypeError(scriptContext, JSERR_Property_NeedFunction, _u("Symbol[Symbol.hasInstance]"));
7743
- }
7744
7741
7745
- ThreadContext * threadContext = scriptContext->GetThreadContext();
7746
- RecyclableObject *instFunc = VarTo<RecyclableObject>(instOfHandler);
7747
- Var result = threadContext->ExecuteImplicitCall(instFunc, ImplicitCall_Accessor, [=]()->Js::Var
7748
- {
7749
- return CALL_FUNCTION(scriptContext->GetThreadContext(), instFunc, CallInfo(CallFlags_Value, 2), constructor, instance);
7750
- });
7742
+ ThreadContext * threadContext = scriptContext->GetThreadContext();
7743
+ RecyclableObject *instFunc = VarTo<RecyclableObject>(instOfHandler);
7744
+ Var result = threadContext->ExecuteImplicitCall(instFunc, ImplicitCall_Accessor, [=]()->Js::Var
7745
+ {
7746
+ return CALL_FUNCTION(scriptContext->GetThreadContext(), instFunc, CallInfo(CallFlags_Value, 2), constructor, instance);
7747
+ });
7751
7748
7752
- return JavascriptBoolean::ToVar(JavascriptConversion::ToBoolean(result, scriptContext) ? TRUE : FALSE, scriptContext);
7753
- }
7754
- }
7755
- else
7756
- {
7757
- return JavascriptBoolean::ToVar(constructor->HasInstance(instance, scriptContext, inlineCache), scriptContext);
7749
+ return JavascriptBoolean::ToVar(JavascriptConversion::ToBoolean(result, scriptContext) ? TRUE : FALSE, scriptContext);
7758
7750
}
7759
7751
JIT_HELPER_END(ScrObj_OP_IsInst);
7760
7752
}
0 commit comments