-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimize JSON #4077
Optimize JSON #4077
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -538,27 +538,25 @@ namespace Js | |
} | ||
|
||
// If exoticToPrim is not undefined, then | ||
if (nullptr != exoticToPrim) | ||
Assert(nullptr != exoticToPrim); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be a fail-fast? What guarantees that this is always not null? #Resolved There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If this is null then result is nullptr and it's not valid to pass nullptr to GetTypeId (prefast took issue with this due to some of the annotations I added). If we get to this point, we will always have called |
||
ThreadContext * threadContext = requestContext->GetThreadContext(); | ||
result = threadContext->ExecuteImplicitCall(exoticToPrim, ImplicitCall_ToPrimitive, [=]()->Js::Var | ||
{ | ||
ThreadContext * threadContext = requestContext->GetThreadContext(); | ||
result = threadContext->ExecuteImplicitCall(exoticToPrim, ImplicitCall_ToPrimitive, [=]()->Js::Var | ||
{ | ||
// Stack object should have a pre-op bail on implicit call. We shouldn't see them here. | ||
Assert(!ThreadContext::IsOnStack(recyclableObject)); | ||
|
||
// Let result be the result of calling the[[Call]] internal method of exoticToPrim, with input as thisArgument and(hint) as argumentsList. | ||
return CALL_FUNCTION(threadContext, exoticToPrim, CallInfo(CallFlags_Value, 2), recyclableObject, hintString); | ||
}); | ||
// Stack object should have a pre-op bail on implicit call. We shouldn't see them here. | ||
Assert(!ThreadContext::IsOnStack(recyclableObject)); | ||
|
||
if (!result) | ||
{ | ||
// There was an implicit call and implicit calls are disabled. This would typically cause a bailout. | ||
Assert(threadContext->IsDisableImplicitCall()); | ||
return requestContext->GetLibrary()->GetNull(); | ||
} | ||
// Let result be the result of calling the[[Call]] internal method of exoticToPrim, with input as thisArgument and(hint) as argumentsList. | ||
return CALL_FUNCTION(threadContext, exoticToPrim, CallInfo(CallFlags_Value, 2), recyclableObject, hintString); | ||
}); | ||
|
||
Assert(!CrossSite::NeedMarshalVar(result, requestContext)); | ||
if (!result) | ||
{ | ||
// There was an implicit call and implicit calls are disabled. This would typically cause a bailout. | ||
Assert(threadContext->IsDisableImplicitCall()); | ||
return requestContext->GetLibrary()->GetNull(); | ||
} | ||
|
||
Assert(!CrossSite::NeedMarshalVar(result, requestContext)); | ||
// If result is an ECMAScript language value and Type(result) is not Object, then return result. | ||
if (TaggedInt::Is(result) || !JavascriptOperators::IsObjectType(JavascriptOperators::GetTypeId(result))) | ||
{ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh- didn't know this existed...is there a compile assert or test that exists to remind us to update this? #Resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah there is a compile assert #Closed