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

Issue 14962008: Fix issue 5275: The VM must always generate the most compact form of an integer (Smi, Mint or Bigin… (Closed)

Created:
7 years, 7 months ago by srdjan
Modified:
7 years, 7 months ago
Reviewers:
siva, Ivan Posva
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Fix issue 5275: The VM must always generate the most compact form of an integer (Smi, Mint or Bigint). Hide methods that can be used to bypass that assumption and require the use of Integer::NewXXX which is guaranteed to return the most compact integer form. R=asiva@google.com Committed: https://code.google.com/p/dart/source/detail?r=22816

Patch Set 1 #

Total comments: 6

Patch Set 2 : #

Patch Set 3 : #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats (+56 lines, -36 lines) Patch
M runtime/lib/double.cc View 1 1 chunk +2 lines, -4 lines 2 comments Download
M runtime/lib/typed_data.cc View 1 2 chunks +2 lines, -6 lines 0 comments Download
M runtime/vm/bigint_operations.cc View 1 2 1 chunk +3 lines, -0 lines 0 comments Download
M runtime/vm/isolate.cc View 1 1 chunk +3 lines, -1 line 0 comments Download
M runtime/vm/object.h View 1 3 chunks +18 lines, -7 lines 2 comments Download
M runtime/vm/object.cc View 1 1 chunk +2 lines, -1 line 0 comments Download
M runtime/vm/object_test.cc View 1 5 chunks +22 lines, -15 lines 0 comments Download
M runtime/vm/snapshot_test.cc View 1 2 chunks +4 lines, -2 lines 0 comments Download

Messages

Total messages: 7 (0 generated)
srdjan
7 years, 7 months ago (2013-05-16 18:15:06 UTC) #1
siva
LGTM with couple of comments. https://codereview.chromium.org/14962008/diff/1/runtime/lib/double.cc File runtime/lib/double.cc (right): https://codereview.chromium.org/14962008/diff/1/runtime/lib/double.cc#newcode84 runtime/lib/double.cc:84: return BigintOperations::ToSmi(big); Do we ...
7 years, 7 months ago (2013-05-16 19:52:50 UTC) #2
srdjan
Thanks. https://codereview.chromium.org/14962008/diff/1/runtime/lib/double.cc File runtime/lib/double.cc (right): https://codereview.chromium.org/14962008/diff/1/runtime/lib/double.cc#newcode84 runtime/lib/double.cc:84: return BigintOperations::ToSmi(big); On 2013/05/16 19:52:50, siva wrote: > ...
7 years, 7 months ago (2013-05-16 20:03:31 UTC) #3
srdjan
Also added a fix to BigintOperations::ToMint; it coudl not handle zero Bigints.
7 years, 7 months ago (2013-05-16 20:34:33 UTC) #4
srdjan
Committed patchset #3 manually as r22816 (presubmit successful).
7 years, 7 months ago (2013-05-16 20:49:13 UTC) #5
Ivan Posva
DBC -ip https://codereview.chromium.org/14962008/diff/16001/runtime/lib/double.cc File runtime/lib/double.cc (right): https://codereview.chromium.org/14962008/diff/16001/runtime/lib/double.cc#newcode83 runtime/lib/double.cc:83: if (BigintOperations::FitsIntoMint(big)) { I find this very ...
7 years, 7 months ago (2013-05-16 21:46:53 UTC) #6
srdjan
7 years, 7 months ago (2013-05-16 21:53:46 UTC) #7
Message was sent while issue was closed.
Thanks!

https://codereview.chromium.org/14962008/diff/16001/runtime/lib/double.cc
File runtime/lib/double.cc (right):

https://codereview.chromium.org/14962008/diff/16001/runtime/lib/double.cc#new...
runtime/lib/double.cc:83: if (BigintOperations::FitsIntoMint(big)) {
On 2013/05/16 21:46:53, Ivan Posva wrote:
> I find this very confusing. This would be much more readable and easier to
> follow if we changed this to:
> if (BigintOperations::FitsIntoInt64(big)) {
>   return Integer::New(BigintOperations::ToInt64(big));
> }

Done in next CL.

https://codereview.chromium.org/14962008/diff/16001/runtime/vm/object.h
File runtime/vm/object.h (right):

https://codereview.chromium.org/14962008/diff/16001/runtime/vm/object.h#newco...
runtime/vm/object.h:4098: RawBigint* ArithmeticOp(Token::Kind operation, const
Bigint& other) const;
On 2013/05/16 21:46:53, Ivan Posva wrote:
> Shouldn't this return a RawInteger*?

Leaving it as Bigint, but rename and hide. Next CL.

Powered by Google App Engine
This is Rietveld 408576698