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

Unified Diff: runtime/lib/typed_data.cc

Issue 15741019: Ensures that Bigints returned to Dart are all checked by Integer::AsValidInteger. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 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
« runtime/lib/integers.cc ('K') | « runtime/lib/integers.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/typed_data.cc
===================================================================
--- runtime/lib/typed_data.cc (revision 23089)
+++ runtime/lib/typed_data.cc (working copy)
@@ -110,6 +110,7 @@
return Bool::True().raw();
}
+
Ivan Posva 2013/05/23 21:37:54 ditto
zra 2013/05/23 22:14:38 Not sure what this is dittoing.
DEFINE_NATIVE_ENTRY(TypedData_setRange, 5) {
GET_NON_NULL_NATIVE_ARGUMENT(Instance, dst, arguments->NativeArgAt(0));
GET_NON_NULL_NATIVE_ARGUMENT(Smi, dst_start, arguments->NativeArgAt(1));
@@ -255,13 +256,9 @@
args.SetAt(0, error); \
Exceptions::ThrowByType(Exceptions::kArgument, args); \
} \
- Integer& result = Integer::Handle(); \
- if (value > static_cast<uint64_t>(Mint::kMaxValue)) { \
- result = BigintOperations::NewFromUint64(value); \
- } else { \
- result = Integer::New(value); \
- } \
- return result.raw(); \
+ const Bigint& result = \
Ivan Posva 2013/05/23 21:37:54 This instance feels like it would be better served
zra 2013/05/23 22:14:38 Done.
+ Bigint::Handle(BigintOperations::NewFromUint64(value)); \
+ return result.AsValidInteger(); \
} \
@@ -405,10 +402,8 @@
} else {
value = Utils::HostToBigEndian64(value);
}
- if (value > static_cast<uint64_t>(Mint::kMaxValue)) {
- return BigintOperations::NewFromUint64(value);
- }
- return Integer::New(value);
+ const Bigint& result = Bigint::Handle(BigintOperations::NewFromUint64(value));
Ivan Posva 2013/05/23 21:37:54 ditto
zra 2013/05/23 22:14:38 Done.
+ return result.AsValidInteger();
}
« runtime/lib/integers.cc ('K') | « runtime/lib/integers.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698