Chromium Code Reviews| Index: Source/bindings/dart/DartUtilities.cpp |
| diff --git a/Source/bindings/dart/DartUtilities.cpp b/Source/bindings/dart/DartUtilities.cpp |
| index 9326acf8ac5292d6643a7773997d8daa950da27b..3eaf9ff2a50196a7fa4268086fe7fe464fd0542e 100644 |
| --- a/Source/bindings/dart/DartUtilities.cpp |
| +++ b/Source/bindings/dart/DartUtilities.cpp |
| @@ -40,6 +40,7 @@ |
| #include "bindings/dart/V8Converter.h" |
| #include "bindings/v8/ScriptController.h" |
| #include "bindings/v8/SerializedScriptValue.h" |
| +#include "bindings/v8/V8Binding.h" |
| #include "core/dom/Document.h" |
| #include "core/html/canvas/DataView.h" |
| #include "core/inspector/ScriptArguments.h" |
| @@ -281,9 +282,12 @@ unsigned long long DartUtilities::dartToUnsignedLongLong(Dart_Handle object, Dar |
| Dart_Handle DartUtilities::numberToDart(double value) |
| { |
| - int intValue = static_cast<int>(value); |
| - if (value == intValue) |
| - return intToDart(intValue); |
| + // JS can store integer values that are no greater than 2^53 - 1. |
| + if (value <= kJSMaxInteger && value >= -kJSMaxInteger) { |
|
sra1
2013/10/18 02:56:28
nit: This would be slightly more readable:
if (-k
|
| + int64_t intValue = static_cast<int64_t>(value); |
| + if (value == intValue) |
| + return intToDart(intValue); |
| + } |
| return doubleToDart(value); |
| } |