Chromium Code Reviews| Index: runtime/lib/double.cc |
| =================================================================== |
| --- runtime/lib/double.cc (revision 23032) |
| +++ runtime/lib/double.cc (working copy) |
| @@ -16,6 +16,7 @@ |
| namespace dart { |
| +DECLARE_FLAG(bool, throw_on_javascript_int_overflow); |
| DECLARE_FLAG(bool, trace_intrinsified_natives); |
| DEFINE_NATIVE_ENTRY(Double_doubleFromInteger, 2) { |
| @@ -81,7 +82,12 @@ |
| } |
| const Bigint& big = Bigint::Handle(BigintOperations::NewFromDouble(val)); |
| if (BigintOperations::FitsIntoInt64(big)) { |
| - return Integer::New(BigintOperations::ToInt64(big)); |
| + const Integer& i = Integer::Handle( |
| + Integer::New(BigintOperations::ToInt64(big))); |
| + if (FLAG_throw_on_javascript_int_overflow && !i.FitsIn53Bits()) { |
|
siva
2013/05/23 17:38:57
just
if (FLAG_throw_on_javascript_int_overflow) {
|
| + Integer::CheckForFiftyThreeBitOverflow(i, "DoubleToInteger"); |
| + } |
| + return i.raw(); |
| } else { |
| return big.raw(); |
| } |