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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/assembler_mips.h ('k') | runtime/vm/assembler_mips_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/globals.h" 5 #include "vm/globals.h"
6 #if defined(TARGET_ARCH_MIPS) 6 #if defined(TARGET_ARCH_MIPS)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/runtime_entry.h" 9 #include "vm/runtime_entry.h"
10 #include "vm/simulator.h" 10 #include "vm/simulator.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 lui(rd, Immediate(offset_high)); 72 lui(rd, Immediate(offset_high));
73 addu(rd, rd, PP); 73 addu(rd, rd, PP);
74 lw(rd, Address(rd, offset_low)); 74 lw(rd, Address(rd, offset_low));
75 } else { 75 } else {
76 lw(rd, Address(PP, offset_low)); 76 lw(rd, Address(PP, offset_low));
77 } 77 }
78 } 78 }
79 } 79 }
80 80
81 81
82 void Assembler::AdduDetectOverflow(Register rd, Register rs, Register rt,
83 Register ro, Register scratch) {
84 ASSERT(rd != ro);
85 ASSERT(rd != TMP);
86 ASSERT(ro != TMP);
87 ASSERT(ro != rs);
88 ASSERT(ro != rt);
89
90 if ((rs == rt) && (rd == rs)) {
91 ASSERT(scratch != kNoRegister);
92 ASSERT(rd != scratch);
93 ASSERT(ro != scratch);
94 ASSERT(scratch != TMP);
95 mov(scratch, rt);
96 rt = scratch;
97 }
98
99 if (rd == rs) {
100 mov(TMP, rs); // Preserve rs.
101 addu(rd, rs, rt); // rs is overwritten.
102 xor_(TMP, rd, TMP); // Original rs.
103 xor_(ro, rd, rt);
104 and_(ro, ro, TMP);
105 } else if (rd == rt) {
106 mov(TMP, rt); // Preserve rt.
107 addu(rd, rs, rt); // rt is overwritten.
108 xor_(TMP, rd, TMP); // Original rt.
109 xor_(ro, rd, rs);
110 and_(ro, ro, TMP);
111 } else {
112 addu(rd, rs, rt);
113 xor_(ro, rd, rs);
114 xor_(TMP, rd, rt);
115 and_(ro, TMP, ro);
116 }
117 }
118
119
82 void Assembler::LoadObject(Register rd, const Object& object) { 120 void Assembler::LoadObject(Register rd, const Object& object) {
83 // Smi's and VM heap objects are never relocated; do not use object pool. 121 // Smi's and VM heap objects are never relocated; do not use object pool.
84 if (object.IsSmi()) { 122 if (object.IsSmi()) {
85 LoadImmediate(rd, reinterpret_cast<int32_t>(object.raw())); 123 LoadImmediate(rd, reinterpret_cast<int32_t>(object.raw()));
86 } else if (object.InVMHeap()) { 124 } else if (object.InVMHeap()) {
87 // Make sure that class CallPattern is able to decode this load immediate. 125 // Make sure that class CallPattern is able to decode this load immediate.
88 int32_t object_raw = reinterpret_cast<int32_t>(object.raw()); 126 int32_t object_raw = reinterpret_cast<int32_t>(object.raw());
89 const uint16_t object_low = Utils::Low16Bits(object_raw); 127 const uint16_t object_low = Utils::Low16Bits(object_raw);
90 const uint16_t object_high = Utils::High16Bits(object_raw); 128 const uint16_t object_high = Utils::High16Bits(object_raw);
91 lui(rd, Immediate(object_high)); 129 lui(rd, Immediate(object_high));
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 b(&stop); 318 b(&stop);
281 Emit(reinterpret_cast<int32_t>(message)); 319 Emit(reinterpret_cast<int32_t>(message));
282 Bind(&stop); 320 Bind(&stop);
283 break_(Instr::kStopMessageCode); 321 break_(Instr::kStopMessageCode);
284 } 322 }
285 323
286 } // namespace dart 324 } // namespace dart
287 325
288 #endif // defined TARGET_ARCH_MIPS 326 #endif // defined TARGET_ARCH_MIPS
289 327
OLDNEW
« 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