⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 283300 in webkit


Ignore:
Timestamp:
Sep 29, 2021, 10:27:45 PM (5 years ago)
Author:
mark.lam@apple.com
Message:

DFG strength reduction on % operator should handle an INT_MIN divisor.
https://bugs.webkit.org/show_bug.cgi?id=230391
<rdar://problem/83229740>

Reviewed by Robin Morisset.

JSTests:

  • stress/dfg-strength-reduction-on-mod-should-handle-INT_MIN.js: Added.

Source/JavaScriptCore:

  • dfg/DFGStrengthReductionPhase.cpp:

(JSC::DFG::StrengthReductionPhase::handleNode):

Location:
trunk
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/JSTests/ChangeLog

    r283293 r283300  
     12021-09-29  Mark Lam  <mark.lam@apple.com>
     2
     3        DFG strength reduction on % operator should handle an INT_MIN divisor.
     4        https://bugs.webkit.org/show_bug.cgi?id=230391
     5        <rdar://problem/83229740>
     6
     7        Reviewed by Robin Morisset.
     8
     9        * stress/dfg-strength-reduction-on-mod-should-handle-INT_MIN.js: Added.
     10
    1112021-09-29  Saam Barati  <sbarati@apple.com>
    212
  • trunk/Source/JavaScriptCore/ChangeLog

    r283293 r283300  
     12021-09-29  Mark Lam  <mark.lam@apple.com>
     2
     3        DFG strength reduction on % operator should handle an INT_MIN divisor.
     4        https://bugs.webkit.org/show_bug.cgi?id=230391
     5        <rdar://problem/83229740>
     6
     7        Reviewed by Robin Morisset.
     8
     9        * dfg/DFGStrengthReductionPhase.cpp:
     10        (JSC::DFG::StrengthReductionPhase::handleNode):
     11
    1122021-09-29  Saam Barati  <sbarati@apple.com>
    213
  • trunk/Source/JavaScriptCore/dfg/DFGStrengthReductionPhase.cpp

    r283232 r283300  
    11/*
    2  * Copyright (C) 2013-2019 Apple Inc. All rights reserved.
     2 * Copyright (C) 2013-2021 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    198198                && m_node->child1()->op() == ArithMod
    199199                && m_node->child1()->binaryUseKind() == Int32Use
    200                 && m_node->child1()->child2()->isInt32Constant()
    201                 && std::abs(m_node->child1()->child2()->asInt32()) <= std::abs(m_node->child2()->asInt32())) {
     200                && m_node->child1()->child2()->isInt32Constant()) {
     201
     202                int32_t const1 = m_node->child1()->child2()->asInt32();
     203                int32_t const2 = m_node->child2()->asInt32();
     204
     205                if (const1 == INT_MIN || const2 == INT_MIN)
     206                    break; // std::abs(INT_MIN) is undefined.
     207
     208                if (std::abs(const1) <= std::abs(const2))
    202209                    convertToIdentityOverChild1();
    203210            }
Note: See TracChangeset for help on using the changeset viewer.