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

Unified Diff: runtime/vm/intrinsifier_mips.cc

Issue 1096063002: Fix array allocation overflow check on arm/arm64/mips. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 8 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/intrinsifier_arm64.cc ('k') | runtime/vm/object_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intrinsifier_mips.cc
===================================================================
--- runtime/vm/intrinsifier_mips.cc (revision 45353)
+++ runtime/vm/intrinsifier_mips.cc (working copy)
@@ -200,8 +200,9 @@
__ lw(V0, Address(V0, 0)); \
\
/* T2: allocation size. */ \
- __ AdduDetectOverflow(T1, V0, T2, CMPRES1); \
- __ bltz(CMPRES1, &fall_through); \
+ __ addu(T1, V0, T2); \
+ /* Branch on unsigned overflow. */ \
+ __ BranchUnsignedLess(T1, V0, &fall_through); \
\
/* Check if the allocation fits into the remaining space. */ \
/* V0: potential new object start. */ \
@@ -1763,6 +1764,7 @@
const Register length_reg = T2;
__ mov(T6, length_reg); // Save the length register.
+ // TODO(koda): Protect against negative length and overflow here.
__ SmiUntag(length_reg);
const intptr_t fixed_size = sizeof(RawString) + kObjectAlignment - 1;
__ AddImmediate(length_reg, fixed_size);
@@ -1777,8 +1779,8 @@
__ lw(V0, Address(T3, 0));
// length_reg: allocation size.
- __ AdduDetectOverflow(T1, V0, length_reg, CMPRES1);
- __ bltz(CMPRES1, failure); // Fail on overflow.
+ __ addu(T1, V0, length_reg);
+ __ BranchUnsignedLess(T1, V0, failure); // Fail on unsigned overflow.
// Check if the allocation fits into the remaining space.
// V0: potential new object start.
« no previous file with comments | « runtime/vm/intrinsifier_arm64.cc ('k') | runtime/vm/object_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698