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

Unified Diff: runtime/vm/dart_api_impl.cc

Issue 2977143002: Revert "Option to truncate integers to 64 bits, part 2" (Closed)
Patch Set: 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/bigint_test.cc ('k') | runtime/vm/dart_api_impl_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/dart_api_impl.cc
diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc
index b33699429fef3dc04ca5fd0d2bd464a9cafdb199..f4caf77da76ee1cbf1244d70bdf491e39dac9ab3 100644
--- a/runtime/vm/dart_api_impl.cc
+++ b/runtime/vm/dart_api_impl.cc
@@ -269,7 +269,6 @@ static bool GetNativeUnsignedIntegerArgument(NativeArguments* arguments,
obj = arguments->NativeArgAt(arg_index);
intptr_t cid = obj.GetClassId();
if (cid == kBigintCid) {
- ASSERT(!Bigint::IsDisabled());
const Bigint& bigint = Bigint::Cast(obj);
if (bigint.FitsIntoUint64()) {
*value = bigint.AsUint64Value();
@@ -2013,7 +2012,6 @@ DART_EXPORT Dart_Handle Dart_IntegerFitsIntoUint64(Dart_Handle integer,
if (int_obj.IsMint()) {
*fits = !int_obj.IsNegative();
} else {
- ASSERT(!Bigint::IsDisabled());
*fits = Bigint::Cast(int_obj).FitsIntoUint64();
}
return Api::Success();
@@ -2039,12 +2037,7 @@ DART_EXPORT Dart_Handle Dart_NewIntegerFromUint64(uint64_t value) {
DARTSCOPE(Thread::Current());
CHECK_CALLBACK_STATE(T);
API_TIMELINE_DURATION;
- RawInteger* integer = Integer::NewFromUint64(value);
- if (integer == Integer::null()) {
- return Api::NewError("%s: Cannot create Dart integer from value %" Pu64,
- CURRENT_FUNC, value);
- }
- return Api::NewHandle(T, integer);
+ return Api::NewHandle(T, Integer::NewFromUint64(value));
}
DART_EXPORT Dart_Handle Dart_NewIntegerFromHexCString(const char* str) {
@@ -2052,12 +2045,7 @@ DART_EXPORT Dart_Handle Dart_NewIntegerFromHexCString(const char* str) {
CHECK_CALLBACK_STATE(T);
API_TIMELINE_DURATION;
const String& str_obj = String::Handle(Z, String::New(str));
- RawInteger* integer = Integer::New(str_obj);
- if (integer == Integer::null()) {
- return Api::NewError("%s: Cannot create Dart integer from string %s",
- CURRENT_FUNC, str);
- }
- return Api::NewHandle(T, integer);
+ return Api::NewHandle(T, Integer::New(str_obj));
}
DART_EXPORT Dart_Handle Dart_IntegerToInt64(Dart_Handle integer,
@@ -2081,7 +2069,6 @@ DART_EXPORT Dart_Handle Dart_IntegerToInt64(Dart_Handle integer,
*value = int_obj.AsInt64Value();
return Api::Success();
} else {
- ASSERT(!Bigint::IsDisabled());
const Bigint& bigint = Bigint::Cast(int_obj);
if (bigint.FitsIntoInt64()) {
*value = bigint.AsInt64Value();
@@ -2119,7 +2106,6 @@ DART_EXPORT Dart_Handle Dart_IntegerToUint64(Dart_Handle integer,
return Api::Success();
}
} else {
- ASSERT(!Bigint::IsDisabled());
const Bigint& bigint = Bigint::Cast(int_obj);
if (bigint.FitsIntoUint64()) {
*value = bigint.AsUint64Value();
« no previous file with comments | « runtime/vm/bigint_test.cc ('k') | runtime/vm/dart_api_impl_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698