Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit d3498a8

Browse files
alexmarkovcommit-bot@chromium.org
authored andcommitted
[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 dart-lang/sdk#31600 Change-Id: I59631102230156f6480a27e6d43d5e3fa5551c8b Reviewed-on: https://dart-review.googlesource.com/c/81338 Commit-Queue: Zach Anderson <zra@google.com> Auto-Submit: Alexander Markov <alexmarkov@google.com> Reviewed-by: Zach Anderson <zra@google.com>
1 parent 9e9746a commit d3498a8

File tree

1 file changed

+0
-19
lines changed

1 file changed

+0
-19
lines changed

runtime/vm/object.cc

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19424,23 +19424,12 @@ const char* Integer::ToCString() const {
1942419424
return "NULL Integer";
1942519425
}
1942619426

19427-
// String representation of kMaxInt64 + 1.
19428-
static const char* kMaxInt64Plus1 = "9223372036854775808";
19429-
1943019427
RawInteger* Integer::New(const String& str, Heap::Space space) {
1943119428
// We are not supposed to have integers represented as two byte strings.
1943219429
ASSERT(str.IsOneByteString());
1943319430
int64_t value = 0;
1943419431
const char* cstr = str.ToCString();
1943519432
if (!OS::StringToInt64(cstr, &value)) {
19436-
// TODO(T31600): Remove overflow checking code when 64-bit ints semantics
19437-
// are only supported through the Kernel FE.
19438-
if (strcmp(cstr, kMaxInt64Plus1) == 0) {
19439-
// Allow MAX_INT64 + 1 integer literal as it can be used as an argument
19440-
// of unary minus to produce MIN_INT64 value. The value is automatically
19441-
// wrapped to MIN_INT64.
19442-
return Integer::New(kMinInt64, space);
19443-
}
1944419433
// Out of range.
1944519434
return Integer::null();
1944619435
}
@@ -19453,14 +19442,6 @@ RawInteger* Integer::NewCanonical(const String& str) {
1945319442
int64_t value = 0;
1945419443
const char* cstr = str.ToCString();
1945519444
if (!OS::StringToInt64(cstr, &value)) {
19456-
// TODO(T31600): Remove overflow checking code when 64-bit ints semantics
19457-
// are only supported through the Kernel FE.
19458-
if (strcmp(cstr, kMaxInt64Plus1) == 0) {
19459-
// Allow MAX_INT64 + 1 integer literal as it can be used as an argument
19460-
// of unary minus to produce MIN_INT64 value. The value is automatically
19461-
// wrapped to MIN_INT64.
19462-
return Mint::NewCanonical(kMinInt64);
19463-
}
1946419445
// Out of range.
1946519446
return Integer::null();
1946619447
}

0 commit comments

Comments
 (0)