Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(541)

Issue 2309193003: [turbofan] Avoid overflow checks on SpeculativeNumberAdd/Subtract/Multiply. (Closed)

Created:
4 years, 3 months ago by Benedikt Meurer
Modified:
4 years, 3 months ago
Reviewers:
mvstanton
CC:
v8-reviews_googlegroups.com
Target Ref:
refs/pending/heads/master
Project:
v8
Visibility:
Public.

Description

[turbofan] Avoid overflow checks on SpeculativeNumberAdd/Subtract/Multiply. Keep the unrestricted feedback type around during retyping and use that to check whether an overflow check is actually necessary when doing the lowering of SpeculativeNumberAdd/Subtract/Multiply. If based on feedback that is taken for the inputs we already know that the result of the operation fits into Signed32 or Unsigned32 range, then we don't need to perform any overflow checks. R=mvstanton@chromium.org BUG=v8:5267, v8:5270 Committed: https://crrev.com/17dbaff9c77c3a3d5a7248fe302a43ca0b51ec26 Cr-Commit-Position: refs/heads/master@{#39198}

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+83 lines, -68 lines) Patch
M src/compiler/representation-change.h View 1 chunk +4 lines, -0 lines 0 comments Download
M src/compiler/representation-change.cc View 1 chunk +2 lines, -0 lines 0 comments Download
M src/compiler/simplified-lowering.cc View 10 chunks +77 lines, -68 lines 0 comments Download

Messages

Total messages: 13 (6 generated)
Benedikt Meurer
4 years, 3 months ago (2016-09-06 05:22:24 UTC) #1
Benedikt Meurer
Hey Michael, This change removes a bunch of unnecessary overflow checks that we saw in ...
4 years, 3 months ago (2016-09-06 05:24:13 UTC) #4
mvstanton
Let her rip :). LGTM.
4 years, 3 months ago (2016-09-06 08:55:29 UTC) #7
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2309193003/1
4 years, 3 months ago (2016-09-06 09:06:21 UTC) #9
commit-bot: I haz the power
Committed patchset #1 (id:1)
4 years, 3 months ago (2016-09-06 09:08:35 UTC) #10
commit-bot: I haz the power
Patchset 1 (id:??) landed as https://crrev.com/17dbaff9c77c3a3d5a7248fe302a43ca0b51ec26 Cr-Commit-Position: refs/heads/master@{#39198}
4 years, 3 months ago (2016-09-06 09:09:10 UTC) #12
Jarin
4 years, 3 months ago (2016-09-07 20:00:31 UTC) #13
Message was sent while issue was closed.
I really do not like the unrestricted type field just like I was not wild about
the restriction type. This is two extra full general types in NodeInfo (without
any explanation what they are good for) just for the sake of a few nodes that
restrict typing in a very constrained way (only Signed32 or Number).

Also, there is a bug in the "optimization" for unsigned values. I believe you
just cannot skip the overflow check for unsigned values - to do that you would
have to propagate unsigned restricted type during retyping. It might be doable,
but I would really prefer not to go there; at least not without some serious
test+documentation+refactoring effort. It is not hard to construct a repro:

function f(a) {
  a++; 
  a = Math.max(0, a);
  a++;
  return a;
}

f(0);
f(0);
%OptimizeFunctionOnNextCall(f);
assertEquals(2147483648, f(2147483646));

Powered by Google App Engine
This is Rietveld 408576698