Chromium Code Reviews| Index: runtime/vm/object.cc |
| diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc |
| index 7482015638326648d80173606445df517d1fcd6b..c3c2c3039b53c481f78f6e0828375873104ff9e9 100644 |
| --- a/runtime/vm/object.cc |
| +++ b/runtime/vm/object.cc |
| @@ -19168,6 +19168,12 @@ RawBigint* Bigint::New(bool neg, |
| RawBigint* Bigint::NewFromInt64(int64_t value, Heap::Space space) { |
|
siva
2017/02/22 01:48:51
This function seems to be used only as a convenien
regis
2017/02/22 17:30:48
Done.
|
| + if (FLAG_limit_ints_to_64_bits) { |
| + // The allocated Bigint value is not necessarily out of range, but it may |
| + // be used as an operand in an operation resulting in a Bigint. |
| + Exceptions::ThrowRangeErrorMsg( |
| + "Integer operand requires conversion to Bigint"); |
| + } |
| const TypedData& digits = TypedData::Handle(NewDigits(2, space)); |
| bool neg; |
| uint64_t abs_value; |
| @@ -19185,6 +19191,12 @@ RawBigint* Bigint::NewFromInt64(int64_t value, Heap::Space space) { |
| RawBigint* Bigint::NewFromUint64(uint64_t value, Heap::Space space) { |
| + if (FLAG_limit_ints_to_64_bits) { |
| + // The allocated Bigint value is not necessarily out of range, but it may |
| + // be used as an operand in an operation resulting in a Bigint. |
|
siva
2017/02/22 01:48:51
Why do you say the value is not necessarily out of
regis
2017/02/22 17:30:48
You are right. I duplicated the same comment witho
|
| + Exceptions::ThrowRangeErrorMsg( |
| + "Integer operand requires conversion to Bigint"); |
| + } |
| const TypedData& digits = TypedData::Handle(NewDigits(2, space)); |
| SetDigitAt(digits, 0, static_cast<uint32_t>(value)); |
| SetDigitAt(digits, 1, static_cast<uint32_t>(value >> 32)); |
| @@ -19195,6 +19207,12 @@ RawBigint* Bigint::NewFromUint64(uint64_t value, Heap::Space space) { |
| RawBigint* Bigint::NewFromShiftedInt64(int64_t value, |
| intptr_t shift, |
| Heap::Space space) { |
| + if (FLAG_limit_ints_to_64_bits) { |
| + // The allocated Bigint value is not necessarily out of range, but it may |
| + // be used as an operand in an operation resulting in a Bigint. |
| + Exceptions::ThrowRangeErrorMsg( |
| + "Integer operand requires conversion to Bigint"); |
| + } |
| ASSERT(kBitsPerDigit == 32); |
| ASSERT(shift >= 0); |
| const intptr_t digit_shift = shift / kBitsPerDigit; |
| @@ -19225,6 +19243,7 @@ RawBigint* Bigint::NewFromShiftedInt64(int64_t value, |
| RawBigint* Bigint::NewFromCString(const char* str, Heap::Space space) { |
| + // Allow parser to scan Bigint literal, even with --limit-ints-to-64-bits. |
| ASSERT(str != NULL); |
| bool neg = false; |
| TypedData& digits = TypedData::Handle(); |
| @@ -19246,6 +19265,7 @@ RawBigint* Bigint::NewFromCString(const char* str, Heap::Space space) { |
| RawBigint* Bigint::NewCanonical(const String& str) { |
| + // Allow parser to scan Bigint literal, even with --limit-ints-to-64-bits. |
| Thread* thread = Thread::Current(); |
| Zone* zone = thread->zone(); |
| Isolate* isolate = thread->isolate(); |