Bug 151997 - DFG should reduce division of a constant by a constant.
Summary: DFG should reduce division of a constant by a constant.
Status: ASSIGNED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Mark Lam
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2015-12-08 10:01 PST by Mark Lam
Modified: 2015-12-08 10:34 PST (History)
7 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Lam 2015-12-08 10:01:00 PST
Running LayoutTests/svg/in-html/sizing/svg-inline.html produces a scenario where we see a division of a constant by another constant:

    (lldb) p leftOperand
    (JSC::SnippetOperand) $0 = {
      m_resultType = (m_type = '\x05')
      m_type = ConstInt32
      m_val = (int32Val = 600, doubleVal = 6.0841863318852727E-310, rawBits = 123145302311512)
    }
    (lldb) p rightOperand
    (JSC::SnippetOperand) $1 = {
      m_resultType = (m_type = '\x05')
      m_type = ConstInt32
      m_val = (int32Val = 100, doubleVal = 6.0841863318605694E-310, rawBits = 123145302311012)
    }

The DFG should have folded this into a constant int 6.
Comment 1 Radar WebKit Bug Importer 2015-12-08 10:25:26 PST
<rdar://problem/23804458>
Comment 2 Filip Pizlo 2015-12-08 10:34:26 PST
Please postpone this work until we have a complete story for prediction propagation from snippets. And when you do implement this please make sure that you do it in the abstract interpreter and that the snippets continue to work even if they see constant inputs. We do not guarantee complete constant folding as a prerequisite for code generation.