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

Issue 795713003: Steps towards unification of number bitset and range types. (Closed)

Created:
6 years ago by Jarin
Modified:
5 years, 10 months ago
Reviewers:
rossberg
CC:
v8-dev, Benedikt Meurer
Base URL:
https://chromium.googlesource.com/v8/v8.git@master
Target Ref:
refs/pending/heads/master
Project:
v8
Visibility:
Public.

Description

Steps towards unification of number bitset and range types. - New invariant on union types: if the union has a range then the number bits in the bitset must be cleared. - Various tweaks in intersection and union to satisfy the invariant. - Exposed and used representation bits in range types (and the Limits helper class). - Implemented Glb for ranges so that the Is predicate handles ranges correctly. - Change typer weakening so that it does not rely on GetRange. However, the code still seems to be a bit fragile. - Removed the Smi types from the type system core, instead introduced Signed31, Unsigned30 and created constructors for Small(Un)Signed that point to the right type for the architecture. - Punched a hole in the config to be able to get to the isolate so that it is possible to allocate heap numbers for newly created ranges. R=rossberg@chromium.org BUG=

Patch Set 1 #

Patch Set 2 : Remove forgotten comment #

Patch Set 3 : Rebase #

Patch Set 4 : Remove an unused variable. #

Patch Set 5 : Fix BitsetType::Max for OtherNumber with missing representation #

Total comments: 57

Patch Set 6 : Rebase #

Patch Set 7 : Small fixes #

Patch Set 8 : Remove bitset representations from RangeType, ConstantType #

Patch Set 9 : Plug the OtherNumber bitset hole #

Patch Set 10 : Restrict representation on ranges to numbers during normalization #

Total comments: 29

Patch Set 11 : Addressing review comments. #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats (+509 lines, -249 lines) Patch
M src/compiler/change-lowering.cc View 1 chunk +1 line, -1 line 0 comments Download
M src/compiler/typer.cc View 1 2 3 4 5 6 7 2 chunks +44 lines, -33 lines 0 comments Download
M src/types.h View 1 2 3 4 5 6 7 8 9 10 14 chunks +80 lines, -62 lines 1 comment Download
M src/types.cc View 1 2 3 4 5 6 7 8 9 10 19 chunks +326 lines, -92 lines 1 comment Download
M src/types-inl.h View 1 2 3 4 5 6 2 chunks +5 lines, -0 lines 0 comments Download
M test/cctest/compiler/test-js-typed-lowering.cc View 1 2 3 4 5 6 7 8 9 10 2 chunks +14 lines, -18 lines 0 comments Download
M test/cctest/test-types.cc View 1 2 3 4 5 6 7 8 9 10 6 chunks +27 lines, -36 lines 1 comment Download
M test/cctest/types-fuzz.h View 1 2 3 4 5 6 7 8 9 10 2 chunks +7 lines, -0 lines 1 comment Download
M test/unittests/compiler/change-lowering-unittest.cc View 1 2 3 4 5 6 7 1 chunk +1 line, -1 line 0 comments Download
M test/unittests/compiler/js-builtin-reducer-unittest.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +4 lines, -6 lines 0 comments Download

Messages

Total messages: 8 (1 generated)
Jarin
Could you take a look, please?
6 years ago (2014-12-11 18:37:21 UTC) #1
rossberg
https://codereview.chromium.org/795713003/diff/80001/src/compiler/change-lowering.cc File src/compiler/change-lowering.cc (right): https://codereview.chromium.org/795713003/diff/80001/src/compiler/change-lowering.cc#newcode166 src/compiler/change-lowering.cc:166: } else if (NodeProperties::GetBounds(value).upper->Is(Type::Signed31())) { I think this should ...
6 years ago (2014-12-12 13:57:51 UTC) #2
rossberg
https://codereview.chromium.org/795713003/diff/80001/src/types.h File src/types.h (right): https://codereview.chromium.org/795713003/diff/80001/src/types.h#newcode814 src/types.h:814: bitset Representation() { return REPRESENTATION(this->Get(0)->AsBitset()); } On 2014/12/12 13:57:51, ...
6 years ago (2014-12-12 15:30:41 UTC) #3
Jarin
Thanks. Addressed some of the comments (sorry for the rebase from the last review). Some ...
5 years, 11 months ago (2015-01-08 14:30:28 UTC) #5
rossberg
https://codereview.chromium.org/795713003/diff/80001/src/compiler/typer.cc File src/compiler/typer.cc (right): https://codereview.chromium.org/795713003/diff/80001/src/compiler/typer.cc#newcode873 src/compiler/typer.cc:873: return Type::Unsigned31(); On 2015/01/08 14:30:27, jarin wrote: > On ...
5 years, 11 months ago (2015-01-15 15:15:12 UTC) #6
Jarin
https://codereview.chromium.org/795713003/diff/80001/src/compiler/typer.cc File src/compiler/typer.cc (right): https://codereview.chromium.org/795713003/diff/80001/src/compiler/typer.cc#newcode873 src/compiler/typer.cc:873: return Type::Unsigned31(); On 2015/01/15 15:15:11, rossberg wrote: > On ...
5 years, 11 months ago (2015-01-16 16:28:40 UTC) #7
rossberg
5 years, 11 months ago (2015-01-19 11:43:56 UTC) #8
LGTM, only nits.

https://codereview.chromium.org/795713003/diff/80001/src/compiler/typer.cc
File src/compiler/typer.cc (right):

https://codereview.chromium.org/795713003/diff/80001/src/compiler/typer.cc#ne...
src/compiler/typer.cc:873: return Type::Unsigned31();
On 2015/01/16 16:28:39, jarin wrote:
> On 2015/01/15 15:15:11, rossberg wrote:
> > On 2015/01/08 14:30:27, jarin wrote:
> > > On 2014/12/12 13:57:50, rossberg wrote:
> > > > Similarly here.
> > > 
> > > This is Unsigned31, so there is no Small* alternative for that.
> > 
> > Ah, right. I would prefer the name NonNegative32 for this type.
> 
> That's how it was and I changed it because you though Unsigned31 made more
> sense.

Then I was wrong. :)

> I think Unsigned31 is more consistent.

Only internally. Externally it's primarily the counterpart to Negative32.

https://codereview.chromium.org/795713003/diff/200001/src/types.cc
File src/types.cc (right):

https://codereview.chromium.org/795713003/diff/200001/src/types.cc#newcode470
src/types.cc:470: typename TypeImpl<Config>::bitset
TypeImpl<Config>::SignedSmallBits() {
On 2015/01/16 16:28:39, jarin wrote:
> On 2015/01/15 15:15:12, rossberg wrote:
> > Perhaps move these to types-inl.h?
> 
> Why? I believe that we should keep the *-inl.h files to absolutely necessary
> minimum.

Define "necessary". :) These are tiny and will probably be called often. The
other bitset factories are inline as well.

https://codereview.chromium.org/795713003/diff/200001/test/unittests/compiler...
File test/unittests/compiler/change-lowering-unittest.cc (right):

https://codereview.chromium.org/795713003/diff/200001/test/unittests/compiler...
test/unittests/compiler/change-lowering-unittest.cc:214:
NodeProperties::SetBounds(val, Bounds(Type::None(), Type::Signed31()));
On 2015/01/16 16:28:40, jarin wrote:
> On 2015/01/15 15:15:12, rossberg wrote:
> > Isn't it even wrong here? On 64 bits I mean?
> 
> No, this is ok, we are just saying that if incoming value is Signed31 then
> tagging is just a simple 32 bit shift by one.
> 
> This test does not really make much sense on 64 bits, but we do run it there
> anyway.

Even if it's ok, I still don't see why it is an improvement. ;)

https://codereview.chromium.org/795713003/diff/220001/src/types.cc
File src/types.cc (right):

https://codereview.chromium.org/795713003/diff/220001/src/types.cc#newcode1226
src/types.cc:1226: INTERNAL_BITSET_TYPE_LIST(BITSET_CONSTANT)
Nit: one more indentation oddity

https://codereview.chromium.org/795713003/diff/220001/src/types.h
File src/types.h (right):

https://codereview.chromium.org/795713003/diff/220001/src/types.h#newcode340
src/types.h:340: return BitsetType::New(BitsetType::SignedSmallBits());
Nit: I think you can drop the 'Bits" suffix now.

https://codereview.chromium.org/795713003/diff/220001/test/cctest/test-types.cc
File test/cctest/test-types.cc (right):

https://codereview.chromium.org/795713003/diff/220001/test/cctest/test-types....
test/cctest/test-types.cc:931: CheckSub(T.Signed31, T.Signed32);
Nit: change this back as well. It's actually important that the original is true
on all platforms.

https://codereview.chromium.org/795713003/diff/220001/test/cctest/types-fuzz.h
File test/cctest/types-fuzz.h (right):

https://codereview.chromium.org/795713003/diff/220001/test/cctest/types-fuzz....
test/cctest/types-fuzz.h:49: SmiValuesAre31Bits() ? Type::Signed31(region) :
Type::Signed32(region);
Hm, why don't you call Type::SignedSmall here?

Powered by Google App Engine
This is Rietveld 408576698