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

Issue 1121573004: Precise shift right result type derivation for all int32 input ranges.

Created:
5 years, 7 months ago by dougc
Modified:
4 years, 9 months ago
Reviewers:
CC:
v8-dev
Base URL:
https://chromium.googlesource.com/v8/v8.git@master
Target Ref:
refs/pending/heads/master
Project:
v8
Visibility:
Public.

Description

Precise shift right result type derivation for all int32 input ranges. The typer can do better for the shift right operation, and can compute the result range precisely and very simply in one line of code for each limit. The patch also canonicalizes the shift range which gives a precise result range for all int32 shift ranges. BUG=

Patch Set 1 #

Total comments: 1

Patch Set 2 : Split out the shift-right integer result type derivation. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+77 lines, -28 lines) Patch
M src/compiler/typer.h View 1 1 chunk +9 lines, -0 lines 0 comments Download
M src/compiler/typer.cc View 1 1 chunk +29 lines, -28 lines 0 comments Download
M test/unittests/compiler/typer-unittest.cc View 1 2 chunks +39 lines, -0 lines 0 comments Download

Messages

Total messages: 7 (2 generated)
dougc
5 years, 7 months ago (2015-05-04 01:36:38 UTC) #2
titzer
The logic looks good. I think we need to start splitting out some of this ...
5 years, 7 months ago (2015-05-06 11:53:13 UTC) #3
dougc
On 2015/05/06 11:53:13, titzer wrote: ... > Would it be possible to pull the integer ...
5 years, 7 months ago (2015-05-13 07:43:03 UTC) #4
Sven Panne
On 2015/05/13 07:43:03, dougc wrote: > [...] Yes this sounds good and improved testing performance. ...
5 years, 7 months ago (2015-05-18 12:10:17 UTC) #5
titzer
5 years, 7 months ago (2015-05-19 08:47:30 UTC) #6
On 2015/05/18 12:10:17, Sven Panne wrote:
> On 2015/05/13 07:43:03, dougc wrote:
> > [...] Yes this sounds good and improved testing performance. Note the test
is
> still
> > slow - more testing has been added. The test takes around 5 seconds here. If
> you
> > can give me a realistic time then testing can be scaled to fit? [...]
> 
> 5 seconds are roughly 2 orders of magnitude to big: If every test we run
during
> "make -j32 qc" took that long, it would roughly take 3.5 hours. So the rule of
> thumb is that a unit test should take a few dozen ms at most. Of course there
is
> a tension between good test coverage and testing time, but more exhaustive
tests
> should be split off into something separate (we discussed this several times
> already, but I'm not sure what the current state of this is).
> 

Yes, 5 seconds is a bit too long. If you run the test runner with --time, it
will output a list of the longest running tests. You don't want to make this
list :-) Under 100ms would be acceptable.


> What you could do for unit testing is: Generate some sane fixed number (e.g.
> 1000) of pseudo-random inputs to the function you want to test and check only
> those, probably for various "interesting" range combinations. This is e.g. the
> idea behind Haskell's QuickCheck
> (https://hackage.haskell.org/package/QuickCheck), and there are some C++ ports
> of this which might be worth considering, this kind of testing problem comes
up
> again and again.

Boundary cases and some systematic tests within reasonable limits would be fine.
Please don't add pseudo-random tests without a fixed seed; we have that in the
typer tests and then they fail nondeterministically--even if they catch a bug,
it may be several CLs too late.

Powered by Google App Engine
This is Rietveld 408576698