1. 13 Jul, 2016 1 commit
    • bmeurer's avatar
      [turbofan] Introduce CheckedUint32Div and CheckUint32Mod operators. · 15ebec03
      bmeurer authored
      Checked integer division and modulus can be done more efficiently
      if we know that the inputs are in Unsigned32 range.
      
      Drive-by-fix: Replace the TypeCheckKind on NodeInfo by a proper
      restriction type, and thread the feedback type through binary
      Number operations similar to what we do for their speculative
      versions. Also deal with Unsigned32 inputs for integer multiplication.
      
      R=jarin@chromium.org
      BUG=v8:4583,v8:5141
      
      Review-Url: https://codereview.chromium.org/2149493002
      Cr-Commit-Position: refs/heads/master@{#37703}
      15ebec03
  2. 12 Jul, 2016 2 commits
    • mstarzinger's avatar
      [turbofan] Speed up structural graph verification. · f3ca2142
      mstarzinger authored
      This removes the checking for use-def and def-use chain links from the
      graph verification. Presence of such links can only be violated by a bug
      in the actual {Node} implementation itself. That container class is also
      covered by unit tests.
      
      The verification in question was useful in the early days when the graph
      implementation itself was prone to bugs. By now it has stabilized and
      spending O(n^2) time during graph verification is too wasteful to still
      be considered a reasonable trade-off.
      
      R=jarin@chromium.org
      TEST=unittests/NodeTest.*
      
      Review-Url: https://codereview.chromium.org/2140973003
      Cr-Commit-Position: refs/heads/master@{#37670}
      f3ca2142
    • bmeurer's avatar
      [turbofan] Unify BooleanToNumber, StringToNumber and PlainPrimitiveToNumber. · 85969ede
      bmeurer authored
      The PlainPrimitiveToNumber operator performs a superset of the operations
      previously performed by the BooleanToNumber and StringToNumber operators,
      so we can just use the special lowering rules for PlainPrimitiveToNumber
      based on the input type and get rid of the specialized operators.
      
      R=jarin@chromium.org
      
      Review-Url: https://codereview.chromium.org/2139183002
      Cr-Commit-Position: refs/heads/master@{#37669}
      85969ede
  3. 11 Jul, 2016 1 commit
    • bmeurer's avatar
      [turbofan] Introduce CheckedInt32Div and CheckedInt32Mod operators. · 03bde266
      bmeurer authored
      Consume Smi/Signed32 feedback for division and modulus and introduce
      appropriate checked operators. This is especially important for modulus
      where the Float64Mod operator is significantly slower than Int32Mod on
      most platforms. For division it's mostly important to propagate
      integerness, i.e. to avoid follow-up conversions between float and
      int32.
      
      Drive-by-fix: Use Int32Mod for the ModulusStub (and the bytecode handler)
      when the inputs are both Smi.
      
      R=jarin@chromium.org
      
      Review-Url: https://codereview.chromium.org/2138633002
      Cr-Commit-Position: refs/heads/master@{#37621}
      03bde266
  4. 01 Jul, 2016 1 commit
    • bmeurer's avatar
      [builtins] Unify most of the remaining Math builtins. · 0a0fe8fb
      bmeurer authored
      Import fdlibm versions of acos, acosh, asin and asinh, which are more
      precise and produce the same result across platforms (we were using
      libm versions for asin and acos so far, where both speed and precision
      depended on the operating system so far). Introduce appropriate TurboFan
      operators for these functions and use them both for inlining and for the
      generic builtin.
      
      Also migrate the Math.imul and Math.fround builtins to TurboFan builtins
      to ensure that their behavior is always exactly the same as the inlined
      TurboFan version (i.e. C++ truncation semantics for double to float
      don't necessarily meet the JavaScript semantics).
      
      For completeness, also migrate Math.sign, which can even get some nice
      love in TurboFan.
      
      Drive-by-fix: Some alpha-sorting on the Math related functions, and
      cleanup the list of Math intrinsics that we have to export via the
      native context currently.
      
      BUG=v8:3266,v8:3496,v8:3509,v8:3952,v8:5169,v8:5170,v8:5171,v8:5172
      TBR=rossberg@chromium.org
      R=franzih@chromium.org
      
      Review-Url: https://codereview.chromium.org/2116753002
      Cr-Commit-Position: refs/heads/master@{#37476}
      0a0fe8fb
  5. 30 Jun, 2016 2 commits
  6. 29 Jun, 2016 1 commit
  7. 28 Jun, 2016 4 commits
  8. 21 Jun, 2016 1 commit
    • bmeurer's avatar
      [turbofan] Address the useless overflow bit materialization. · 00889cc2
      bmeurer authored
      Add control dependencies to Projection and Int32Add/SubWithOverflow
      operators, to prevent the scheduler from moving the Projection nodes
      into the wrong place. This way the instruction selection can combine
      the Int32Add/SubWithOverflow operations with the DeoptimizeIf and/or
      DeoptimizeUnless nodes. This needs new operators CheckedInt32Add and
      CheckedInt32Sub so that we can delay the actual lowering until the
      effect/control linearizer.
      
      This also makes CheckIf operator obsolete, so we can drop it.
      
      R=jarin@chromium.org
      
      Review-Url: https://codereview.chromium.org/2082993002
      Cr-Commit-Position: refs/heads/master@{#37148}
      00889cc2
  9. 20 Jun, 2016 4 commits
    • bmeurer's avatar
      [turbofan] Introduce CheckTaggedSigned and CheckTaggedPointer operators. · 99eb5686
      bmeurer authored
      These are used to check for Smi or HeapObject, and we use them
      appropriately in JSNativeContextSpecialization, so we don't need
      to introduce dependencies on concrete control flow and/or concrete
      frame states.
      
      They will be optimized by a proper check elimination reducer,
      which will be added in a separate CL.
      
      R=jarin@chromium.org
      BUG=v8:4470
      
      Review-Url: https://codereview.chromium.org/2082523002
      Cr-Commit-Position: refs/heads/master@{#37096}
      99eb5686
    • machenbach's avatar
      Revert of [turbofan] Introduce CheckUnless. (patchset #1 id:1 of... · 46c21b2c
      machenbach authored
      Revert of [turbofan] Introduce CheckUnless. (patchset #1 id:1 of https://codereview.chromium.org/2080113002/ )
      
      Reason for revert:
      [Sheriff] Speculative revert: Seems to lead to devtools crashes:
      https://build.chromium.org/p/client.v8.fyi/builders/V8-Blink%20Win/builds/5259
      
      Original issue's description:
      > [turbofan] Introduce CheckUnless.
      >
      > Similarly to CheckIf, CheckUnless is a deoptimization without a specific
      > frame state. A frame state is assigned during effect-control linearization
      > (and CheckUnless is turned into DeoptimizeUnless).
      >
      > At the moment, the new operator is only used at one place in native context
      > specialization, but we should use it everywhere. The advantage of
      > CHeckUnless is that it avoids non-truncating uses of values by frame
      > states. This particular change is aimed at Octane's crypto, where this
      > enables to turn one NumberMultiply into Int32Mul, and thus improve
      > the score by more than 10% (it also needs minus zero truncation and
      > typing to be improved, but those CLs are already in flight).
      >
      > BUG=v8:4470
      > R=bmeurer@chromium.org
      >
      > Committed: https://crrev.com/85fde59d538e0dcaf461108086c2f7cf904f567a
      > Cr-Commit-Position: refs/heads/master@{#37085}
      
      TBR=bmeurer@chromium.org,jarin@chromium.org
      # Skipping CQ checks because original CL landed less than 1 days ago.
      NOPRESUBMIT=true
      NOTREECHECKS=true
      NOTRY=true
      BUG=v8:4470
      
      Review-Url: https://codereview.chromium.org/2078333002
      Cr-Commit-Position: refs/heads/master@{#37090}
      46c21b2c
    • bmeurer's avatar
      [builtins] Introduce proper Float64Tan operator. · c87168bc
      bmeurer authored
      Import base::ieee754::tan() from fdlibm and introduce Float64Tan TurboFan
      operator based on that, similar to what we do for Float64Cos and Float64Sin.
      Rewrite Math.tan() as TurboFan builtin and use those operators to also
      inline Math.tan() into optimized TurboFan functions.
      
      Drive-by-fix: Kill the %_ConstructDouble intrinsics, and provide only
      the %ConstructDouble runtime entry for writing tests.
      
      BUG=v8:5086,v8:5126
      R=yangguo@chromium.org
      
      Review-Url: https://codereview.chromium.org/2083453002
      Cr-Commit-Position: refs/heads/master@{#37087}
      c87168bc
    • jarin's avatar
      [turbofan] Introduce CheckUnless. · 85fde59d
      jarin authored
      Similarly to CheckIf, CheckUnless is a deoptimization without a specific
      frame state. A frame state is assigned during effect-control linearization
      (and CheckUnless is turned into DeoptimizeUnless).
      
      At the moment, the new operator is only used at one place in native context
      specialization, but we should use it everywhere. The advantage of
      CHeckUnless is that it avoids non-truncating uses of values by frame
      states. This particular change is aimed at Octane's crypto, where this
      enables to turn one NumberMultiply into Int32Mul, and thus improve
      the score by more than 10% (it also needs minus zero truncation and
      typing to be improved, but those CLs are already in flight).
      
      BUG=v8:4470
      R=bmeurer@chromium.org
      
      Review-Url: https://codereview.chromium.org/2080113002
      Cr-Commit-Position: refs/heads/master@{#37085}
      85fde59d
  10. 19 Jun, 2016 1 commit
  11. 17 Jun, 2016 3 commits
  12. 16 Jun, 2016 4 commits
  13. 15 Jun, 2016 3 commits
    • bmeurer's avatar
      [turbofan] Introduce a dedicated CheckBounds operator. · 2267ccb1
      bmeurer authored
      This CheckBounds simplified operator is similar to the HBoundsCheck in
      Crankshaft, and is hooked up to the new type feedback support in the
      SimplifiedLowering. We use it to check the index bounds for keyed
      property accesses.
      
      Note to perf sheriffs: This will tank quite a few benchmarks, as the
      operator makes some redundant branch elimination ineffective for
      certain patterns of keyed accesses. This does require more serious
      redundancy elimination, which we will do in a separate CL. So ignore
      any regressions from this CL, we know there will be a few.
      
      R=jarin@chromium.org
      BUG=v8:4470,v8:5100
      
      Committed: https://crrev.com/85e5567dae66a918500ae94c5568221137a0f5d4
      Review-Url: https://codereview.chromium.org/2035893004
      Cr-Original-Commit-Position: refs/heads/master@{#36947}
      Cr-Commit-Position: refs/heads/master@{#37003}
      2267ccb1
    • bmeurer's avatar
      [turbofan] Introduce CheckHole and CheckHoleNaN operators. · 502dd40c
      bmeurer authored
      These simplified operators are used to perform the hole checks when
      loading elements from a holey array. Depending on the CheckHoleMode,
      they either return the hole as undefined or some NaN, or deoptimize
      if the value is the hole or the hole NaN.
      
      R=jarin@chromium.org
      
      Review-Url: https://codereview.chromium.org/2066223002
      Cr-Commit-Position: refs/heads/master@{#37001}
      502dd40c
    • bmeurer's avatar
      [turbofan] Unify the PlainPrimitive as Number treatment. · ed0039a7
      bmeurer authored
      Now that we have the PlainPrimitiveToNumber operator(s), we can unify
      all the places where we expect a number, but can also safely handle any
      plain-primitive (via ToNumber truncation).
      
      Drive-by-fix: Also handle Math.min consistently with Math.max.
      
      R=jarin@chromium.org
      
      Review-Url: https://codereview.chromium.org/2064953004
      Cr-Commit-Position: refs/heads/master@{#36984}
      ed0039a7
  14. 14 Jun, 2016 4 commits
  15. 13 Jun, 2016 2 commits
    • bmeurer's avatar
      [builtins] Introduce proper Float64Atan and Float64Atan2 operators. · 89d8c57b
      bmeurer authored
      Import base::ieee754::atan() and base::ieee754::atan2() from fdlibm and
      introduce Float64Atan and Float64Atan2 TurboFan operators based on those,
      similar to what we already did for Float64Log and Float64Log1p. Rewrite
      Math.atan() and Math.atan2() as TurboFan builtin and use the operators
      to also inline Math.atan() and Math.atan2() into optimized TurboFan functions.
      
      R=yangguo@chromium.org
      BUG=v8:5086,v8:5095
      
      Review-Url: https://codereview.chromium.org/2065503002
      Cr-Commit-Position: refs/heads/master@{#36916}
      89d8c57b
    • bmeurer's avatar
      [builtins] Introduce proper Float64Log1p operator. · 7ceed92a
      bmeurer authored
      Import base::ieee754::log1p() from fdlibm and introduce a Float64Log1p
      TurboFan operator based on that, similar to what we do for Float64Log.
      Rewrite Math.log1p() as TurboFan builtin and use that operator to also
      inline Math.log1p() into optimized TurboFan functions.
      
      Also unify the handling of the special IEEE 754 functions somewhat in
      the TurboFan backends. At some point we can hopefully express this
      completely in the InstructionSelector (once we have an idea what to do
      with the ST(0) return issue on IA-32/X87).
      
      Drive-by-fix: Add some more test coverage for the log function.
      
      R=yangguo@chromium.org
      BUG=v8:5086,v8:5092
      
      Review-Url: https://codereview.chromium.org/2060743002
      Cr-Commit-Position: refs/heads/master@{#36914}
      7ceed92a
  16. 10 Jun, 2016 1 commit
    • jarin's avatar
      [turbofan] Introduce PlainPrimitiveToNumber. · 2890137b
      jarin authored
      This should solve the problem with missing checkpoints after JSToNumber
      (PlainPrimitiveToNumber is marked no-write, so the frame-state
      propagation should see through it.)
      
      Unfortunately, this also duplicates the word32- and float64-truncation
      magic that we have for JSToNumber in "simplified lowering".
      
      Review-Url: https://codereview.chromium.org/2059653002
      Cr-Commit-Position: refs/heads/master@{#36881}
      2890137b
  17. 09 Jun, 2016 2 commits
  18. 03 Jun, 2016 1 commit
    • bmeurer's avatar
      [builtins] Migrate Math.log to TurboFan. · f2da19fe
      bmeurer authored
      Introduce a dedicated Float64Log machine operator, that is either
      implemented by a direct C call or by platform specific code, i.e.
      using the FPU on x64 and ia32.
      
      This operator is used to implement Math.log as a proper TurboFan
      builtin on top of the CodeStubAssembler.
      
      Also introduce a NumberLog simplified operator on top of Float64Log
      and use that for the fast inline path of Math.log inside TurboFan
      optimized code.
      
      BUG=v8:5065
      
      Review-Url: https://codereview.chromium.org/2029413005
      Cr-Commit-Position: refs/heads/master@{#36703}
      f2da19fe
  19. 02 Jun, 2016 2 commits
    • jarin's avatar
      [turbofan] Initial version of number type feedback. · 216bcf9f
      jarin authored
      This introduces optimized number operations based on type feedback.
      
      Summary of changes:
      
      1. Typed lowering produces SpeculativeNumberAdd/Subtract for JSAdd/Subtract if
         there is suitable feedback. The speculative nodes are connected to both the
         effect chain and the control chain and they retain the eager frame state.
      
      2. Simplified lowering now executes in three phases:
        a. Propagation phase computes truncations by traversing the graph from uses to
           definitions until checkpoint is reached. It also records type-check decisions
           for later typing phase, and computes representation.
        b. The typing phase computes more precise types base on the speculative types (and recomputes
           representation for affected nodes).
        c. The lowering phase performs lowering and inserts representation changes and/or checks.
      
      3. Effect-control linearization lowers the checks to machine graphs.
      
      Notes:
      
      - SimplifiedLowering will be refactored to have handling of each operation one place and
        with clearer input/output protocol for each sub-phase. I would prefer to do this once
        we have more operations implemented, and the pattern is clearer.
      
      - The check operations (Checked<A>To<B>) should have some flags that would affect
        the kind of truncations that they can handle. E.g., if we know that a node produces
        a number, we can omit the oddball check in the CheckedTaggedToFloat64 lowering.
      
      - In future, we want the typer to reuse the logic from OperationTyper.
      
      BUG=v8:4583
      LOG=n
      
      Review-Url: https://codereview.chromium.org/1921563002
      Cr-Commit-Position: refs/heads/master@{#36674}
      216bcf9f
    • bmeurer's avatar
      [turbofan] Add new StringFromCharCode simplified operator. · 5a3a6daf
      bmeurer authored
      We use StringFromCharCode to optimize calls to String.fromCharCode with
      a single Number argument for now. We will use it to also implement the
      charAt method on the String prototype.
      
      R=jarin@chromium.org
      
      Review-Url: https://codereview.chromium.org/2037453003
      Cr-Commit-Position: refs/heads/master@{#36668}
      5a3a6daf