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

Unified Diff: runtime/vm/object.cc

Issue 329793002: Add missing javascript integer overflow check on 64-bit platforms. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 6 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/flow_graph_compiler_ia32.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
===================================================================
--- runtime/vm/object.cc (revision 37239)
+++ runtime/vm/object.cc (working copy)
@@ -15130,15 +15130,17 @@
RawInteger* Integer::New(int64_t value, Heap::Space space, const bool silent) {
- if ((value <= Smi::kMaxValue) && (value >= Smi::kMinValue)) {
- return Smi::New(value);
- }
+ const bool is_smi = (value <= Smi::kMaxValue) && (value >= Smi::kMinValue);
if (!silent &&
FLAG_throw_on_javascript_int_overflow &&
!IsJavascriptInt(value)) {
- const Integer& i = Integer::Handle(Mint::New(value));
+ const Integer& i = is_smi ? Integer::Handle(Smi::New(value))
+ : Integer::Handle(Mint::New(value));
ThrowJavascriptIntegerOverflow(i);
}
+ if (is_smi) {
+ return Smi::New(value);
+ }
return Mint::New(value, space);
}
« no previous file with comments | « runtime/vm/flow_graph_compiler_ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698