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

Unified Diff: runtime/vm/assembler_mips.cc

Issue 13722022: Adds macros to the MIPS assembler for detecting overflow. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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/assembler_mips.h ('k') | runtime/vm/assembler_mips_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/assembler_mips.cc
===================================================================
--- runtime/vm/assembler_mips.cc (revision 20999)
+++ runtime/vm/assembler_mips.cc (working copy)
@@ -79,6 +79,44 @@
}
+void Assembler::AdduDetectOverflow(Register rd, Register rs, Register rt,
+ Register ro, Register scratch) {
+ ASSERT(rd != ro);
+ ASSERT(rd != TMP);
+ ASSERT(ro != TMP);
+ ASSERT(ro != rs);
+ ASSERT(ro != rt);
+
+ if ((rs == rt) && (rd == rs)) {
+ ASSERT(scratch != kNoRegister);
+ ASSERT(rd != scratch);
+ ASSERT(ro != scratch);
+ ASSERT(scratch != TMP);
+ mov(scratch, rt);
+ rt = scratch;
+ }
+
+ if (rd == rs) {
+ mov(TMP, rs); // Preserve rs.
+ addu(rd, rs, rt); // rs is overwritten.
+ xor_(TMP, rd, TMP); // Original rs.
+ xor_(ro, rd, rt);
+ and_(ro, ro, TMP);
+ } else if (rd == rt) {
+ mov(TMP, rt); // Preserve rt.
+ addu(rd, rs, rt); // rt is overwritten.
+ xor_(TMP, rd, TMP); // Original rt.
+ xor_(ro, rd, rs);
+ and_(ro, ro, TMP);
+ } else {
+ addu(rd, rs, rt);
+ xor_(ro, rd, rs);
+ xor_(TMP, rd, rt);
+ and_(ro, TMP, ro);
+ }
+}
+
+
void Assembler::LoadObject(Register rd, const Object& object) {
// Smi's and VM heap objects are never relocated; do not use object pool.
if (object.IsSmi()) {
« no previous file with comments | « runtime/vm/assembler_mips.h ('k') | runtime/vm/assembler_mips_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698