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

Unified Diff: runtime/vm/object.cc

Issue 1644223006: Fix some more shorten-64-to-32 warnings: (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address review comments. Created 4 years, 11 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') | runtime/vm/profiler.h » ('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 d1d590c0cee2a5e467a72c81cf3287b5c8991788..340735fd95a9ef2c78f56c677e0707da75423b09 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -17994,7 +17994,7 @@ RawInteger* Integer::New(int64_t value, Heap::Space space, const bool silent) {
const bool is_smi = Smi::IsValid(value);
if (!silent &&
FLAG_throw_on_javascript_int_overflow &&
- !Utils::IsJavascriptInt64(value)) {
+ !Utils::IsJavascriptInt(value)) {
const Integer& i = is_smi ?
Integer::Handle(Smi::New(static_cast<intptr_t>(value))) :
Integer::Handle(Mint::New(value, space));
@@ -18092,7 +18092,7 @@ bool Integer::CheckJavascriptIntegerOverflow() const {
value = AsInt64Value();
}
}
- return !Utils::IsJavascriptInt64(value);
+ return !Utils::IsJavascriptInt(value);
}
@@ -18114,7 +18114,9 @@ RawInteger* Integer::AsValidInteger() const {
if (Bigint::Cast(*this).FitsIntoInt64()) {
const int64_t value = AsInt64Value();
if (Smi::IsValid(value)) {
- return Smi::New(value);
+ // This cast is safe because Smi::IsValid verifies that value will fit.
+ intptr_t val = static_cast<intptr_t>(value);
+ return Smi::New(val);
}
return Mint::New(value);
}
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/profiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698