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

Unified Diff: runtime/vm/object.cc

Issue 2992013002: [vm] Change TypedData_getUint64 native method to silently cast values (Closed)
Patch Set: Loop test to verify optimized mode too Created 3 years, 5 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
« no previous file with comments | « runtime/vm/object.h ('k') | tests/corelib_2/corelib_2.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index c5faed86ee98228f863825674ed14900e357236c..269decc2b7ccaab4b3e1bbfd43c76f344c4b76c3 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -18155,15 +18155,18 @@ RawInteger* Integer::New(int64_t value, Heap::Space space) {
}
RawInteger* Integer::NewFromUint64(uint64_t value, Heap::Space space) {
- if (value > static_cast<uint64_t>(Mint::kMaxValue)) {
- if (FLAG_limit_ints_to_64_bits) {
- // Out of range.
- return Integer::null();
- } else {
- return Bigint::NewFromUint64(value, space);
- }
+ if (!FLAG_limit_ints_to_64_bits &&
+ (value > static_cast<uint64_t>(Mint::kMaxValue))) {
+ return Bigint::NewFromUint64(value, space);
+ }
+ return Integer::New(static_cast<int64_t>(value), space);
+}
+
+bool Integer::IsValidUint64(uint64_t value) {
+ if (FLAG_limit_ints_to_64_bits) {
+ return (value <= static_cast<uint64_t>(Mint::kMaxValue));
} else {
- return Integer::New(value, space);
siva 2017/07/31 21:46:08 why is it not ok to just change this to return
alexmarkov 2017/07/31 23:58:12 Integer::NewFromUint64 is called from 2 places: Da
+ return true;
}
}
« no previous file with comments | « runtime/vm/object.h ('k') | tests/corelib_2/corelib_2.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698