Chromium Code Reviews| Index: runtime/vm/object.cc |
| diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc |
| index c5faed86ee98228f863825674ed14900e357236c..269decc2b7ccaab4b3e1bbfd43c76f344c4b76c3 100644 |
| --- a/runtime/vm/object.cc |
| +++ b/runtime/vm/object.cc |
| @@ -18155,15 +18155,18 @@ RawInteger* Integer::New(int64_t value, Heap::Space space) { |
| } |
| RawInteger* Integer::NewFromUint64(uint64_t value, Heap::Space space) { |
| - if (value > static_cast<uint64_t>(Mint::kMaxValue)) { |
| - if (FLAG_limit_ints_to_64_bits) { |
| - // Out of range. |
| - return Integer::null(); |
| - } else { |
| - return Bigint::NewFromUint64(value, space); |
| - } |
| + if (!FLAG_limit_ints_to_64_bits && |
| + (value > static_cast<uint64_t>(Mint::kMaxValue))) { |
| + return Bigint::NewFromUint64(value, space); |
| + } |
| + return Integer::New(static_cast<int64_t>(value), space); |
| +} |
| + |
| +bool Integer::IsValidUint64(uint64_t value) { |
| + if (FLAG_limit_ints_to_64_bits) { |
| + return (value <= static_cast<uint64_t>(Mint::kMaxValue)); |
| } else { |
| - return Integer::New(value, space); |
|
siva
2017/07/31 21:46:08
why is it not ok to just change this to
return
alexmarkov
2017/07/31 23:58:12
Integer::NewFromUint64 is called from 2 places: Da
|
| + return true; |
| } |
| } |