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

Unified Diff: Source/bindings/dart/V8Converter.cpp

Issue 27767003: Convert serialized values to ints if they are whole and less than 53 bits. (Closed) Base URL: svn://svn.chromium.org/multivm/trunk/webkit
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/bindings/dart/V8Converter.cpp
diff --git a/Source/bindings/dart/V8Converter.cpp b/Source/bindings/dart/V8Converter.cpp
index dd399ffb241fbd9f611929765f23af4a9e0154d6..ed4f4061001498c79e53507eb3623b901a39e1f2 100644
--- a/Source/bindings/dart/V8Converter.cpp
+++ b/Source/bindings/dart/V8Converter.cpp
@@ -170,8 +170,10 @@ Dart_Handle V8Converter::toDart(v8::Handle<v8::Value> value, V8ToDartMap& map, D
return Dart_Null();
if (value->IsString())
return map.put(value, stringToDart(value));
- if (value->IsInt32())
- return Dart_NewInteger(value->Int32Value());
+ if (value->IsNumber() && abs(value->IntegerValue()) <= pow(2, 53)) {
+ // JS can store integer values that are no greater than 2^53.
+ return Dart_NewInteger(value->IntegerValue());
+ }
if (value->IsBoolean())
return Dart_NewBoolean(value->BooleanValue());
if (value->IsNumber())
« Source/bindings/dart/DartUtilities.cpp ('K') | « Source/bindings/dart/DartUtilities.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698