Skip to content
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

[JSC] Make DFG mayExit more precise #14857

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 105 additions & 0 deletions Source/JavaScriptCore/dfg/DFGMayExit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ ExitMode mayExitImpl(Graph& graph, Node* node, StateType& state)
case DoubleConstant:
case LazyJSConstant:
case Int52Constant:
case ConstantStoragePointer:
case MovHint:
case InitializeEntrypointArguments:
case SetLocal:
Expand Down Expand Up @@ -102,8 +103,16 @@ ExitMode mayExitImpl(Graph& graph, Node* node, StateType& state)
case PutByOffset:
case PutClosureVar:
case PutInternalField:
case PutGlobalVariable:
case GetByOffset:
case GetClosureVar:
case GetInternalField:
case GetGlobalLexicalVariable:
case GetGlobalVar:
case RecordRegExpCachedResult:
case NukeStructureAndSetButterfly:
case GetButterfly:
case GetIndexedPropertyStorage:
case FilterCallLinkStatus:
case FilterGetByStatus:
case FilterPutByStatus:
Expand All @@ -112,6 +121,9 @@ ExitMode mayExitImpl(Graph& graph, Node* node, StateType& state)
case FilterCheckPrivateBrandStatus:
case FilterSetPrivateBrandStatus:
case ExtractFromTuple:
case CompareBelow:
case CompareBelowEq:
case CompareEqPtr:
break;

case EnumeratorNextUpdatePropertyName:
Expand Down Expand Up @@ -141,6 +153,8 @@ ExitMode mayExitImpl(Graph& graph, Node* node, StateType& state)
case RegExpExecNonGlobalOrSticky:
case RegExpMatchFastGlobal:
case CallWasm:
case AllocatePropertyStorage:
case ReallocatePropertyStorage:
result = ExitsForExceptions;
break;

Expand All @@ -149,6 +163,97 @@ ExitMode mayExitImpl(Graph& graph, Node* node, StateType& state)
break;
return Exits;

case ArithBitNot:
if (node->child1().useKind() == Int32Use)
break;
return Exits;

case ArithAbs:
if (node->arithMode() == Arith::Mode::Unchecked && node->child1().useKind() == Int32Use)
break;
return Exits;

case ArithMin:
case ArithMax:
if (graph.child(node, 0).useKind() == Int32Use)
break;
if (graph.child(node, 0).useKind() == DoubleRepUse)
break;
return Exits;

case ArithBitRShift:
case ArithBitLShift:
case BitURShift:
case ArithBitAnd:
case ArithBitOr:
case ArithBitXor:
if (node->isBinaryUseKind(Int32Use))
break;
return Exits;

case ArithClz32:
if (node->child1().useKind() == Int32Use || node->child1().useKind() == KnownInt32Use)
break;
return Exits;

case ArithAdd:
case ArithSub:
case ArithMul:
if (node->arithMode() == Arith::Mode::Unchecked && node->isBinaryUseKind(Int32Use))
break;
if (node->isBinaryUseKind(DoubleRepUse))
break;
return Exits;

case ArithNegate:
if (node->arithMode() == Arith::Mode::Unchecked && node->child1().useKind() == Int32Use)
break;
if (node->child1().useKind() == DoubleRepUse)
break;
return Exits;

case ArithDiv:
case ArithMod:
case ArithFRound:
if (node->isBinaryUseKind(DoubleRepUse))
break;
return Exits;

case CompareEq:
case CompareStrictEq:
case CompareLess:
case CompareLessEq:
case CompareGreater:
case CompareGreaterEq:
if (node->isBinaryUseKind(Int32Use))
break;
if (node->isBinaryUseKind(DoubleRepUse))
break;
if (node->isBinaryUseKind(Int52RepUse))
break;
return Exits;

case ArithPow:
if (node->isBinaryUseKind(Int32Use))
break;
if (node->isBinaryUseKind(DoubleRepUse))
break;
return Exits;

case ArithRound:
case ArithFloor:
case ArithCeil:
case ArithTrunc:
if (node->child1().useKind() == DoubleRepUse && !producesInteger(node->arithRoundingMode()))
break;
return Exits;

case ArithSqrt:
case ArithUnary:
if (node->child1().useKind() == DoubleRepUse)
break;
return Exits;

default:
// If in doubt, return true.
return Exits;
Expand Down