From d3498a81be013135e919fb3c652bcd06ee809a5b Mon Sep 17 00:00:00 2001 From: Alexander Markov Date: Thu, 25 Oct 2018 02:49:33 +0000 Subject: [PATCH] [vm] Cleanup int overflow checking This corner case was needed by old VM parser. Now that old VM parser is gone we can remove it. Closes https://github.com/dart-lang/sdk/issues/31600 Change-Id: I59631102230156f6480a27e6d43d5e3fa5551c8b Reviewed-on: https://dart-review.googlesource.com/c/81338 Commit-Queue: Zach Anderson Auto-Submit: Alexander Markov Reviewed-by: Zach Anderson --- runtime/vm/object.cc | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc index 92ac5fb2ca889..4bec000c109c1 100644 --- a/runtime/vm/object.cc +++ b/runtime/vm/object.cc @@ -19424,23 +19424,12 @@ const char* Integer::ToCString() const { return "NULL Integer"; } -// String representation of kMaxInt64 + 1. -static const char* kMaxInt64Plus1 = "9223372036854775808"; - RawInteger* Integer::New(const String& str, Heap::Space space) { // We are not supposed to have integers represented as two byte strings. ASSERT(str.IsOneByteString()); int64_t value = 0; const char* cstr = str.ToCString(); if (!OS::StringToInt64(cstr, &value)) { - // TODO(T31600): Remove overflow checking code when 64-bit ints semantics - // are only supported through the Kernel FE. - if (strcmp(cstr, kMaxInt64Plus1) == 0) { - // Allow MAX_INT64 + 1 integer literal as it can be used as an argument - // of unary minus to produce MIN_INT64 value. The value is automatically - // wrapped to MIN_INT64. - return Integer::New(kMinInt64, space); - } // Out of range. return Integer::null(); } @@ -19453,14 +19442,6 @@ RawInteger* Integer::NewCanonical(const String& str) { int64_t value = 0; const char* cstr = str.ToCString(); if (!OS::StringToInt64(cstr, &value)) { - // TODO(T31600): Remove overflow checking code when 64-bit ints semantics - // are only supported through the Kernel FE. - if (strcmp(cstr, kMaxInt64Plus1) == 0) { - // Allow MAX_INT64 + 1 integer literal as it can be used as an argument - // of unary minus to produce MIN_INT64 value. The value is automatically - // wrapped to MIN_INT64. - return Mint::NewCanonical(kMinInt64); - } // Out of range. return Integer::null(); }