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

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
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 != scratch);
86 ASSERT(ro != scratch);
87 ASSERT(ro != rs);
88 ASSERT(ro != rt);
89
90 if ((rs == rt) && (rd == rs)) {
91 ASSERT(rd != TMP);
92 ASSERT(ro != TMP);
93 ASSERT(scratch != TMP);
94 mov(TMP, rt);
95 rt = TMP;
96 }
97
98 if (rd == rs) {
99 mov(scratch, rs); // Preserve rs.
100 addu(rd, rs, rt); // rs is overwritten.
101 xor_(scratch, rd, scratch); // Original rs.
102 xor_(ro, rd, rt);
103 and_(ro, ro, scratch);
104 } else if (rd == rt) {
105 mov(scratch, rt); // Preserve rt.
106 addu(rd, rs, rt); // rt is overwritten.
107 xor_(scratch, rd, scratch); // Original rt.
108 xor_(ro, rd, rs);
109 and_(ro, ro, scratch);
110 } else {
111 addu(rd, rs, rt);
112 xor_(ro, rd, rs);
113 xor_(scratch, rd, rt);
114 and_(ro, scratch, ro);
115 }
116 }
117
118
82 void Assembler::LoadObject(Register rd, const Object& object) { 119 void Assembler::LoadObject(Register rd, const Object& object) {
83 // Smi's and VM heap objects are never relocated; do not use object pool. 120 // Smi's and VM heap objects are never relocated; do not use object pool.
84 if (object.IsSmi()) { 121 if (object.IsSmi()) {
85 LoadImmediate(rd, reinterpret_cast<int32_t>(object.raw())); 122 LoadImmediate(rd, reinterpret_cast<int32_t>(object.raw()));
86 } else if (object.InVMHeap()) { 123 } else if (object.InVMHeap()) {
87 // Make sure that class CallPattern is able to decode this load immediate. 124 // Make sure that class CallPattern is able to decode this load immediate.
88 int32_t object_raw = reinterpret_cast<int32_t>(object.raw()); 125 int32_t object_raw = reinterpret_cast<int32_t>(object.raw());
89 const uint16_t object_low = Utils::Low16Bits(object_raw); 126 const uint16_t object_low = Utils::Low16Bits(object_raw);
90 const uint16_t object_high = Utils::High16Bits(object_raw); 127 const uint16_t object_high = Utils::High16Bits(object_raw);
91 lui(rd, Immediate(object_high)); 128 lui(rd, Immediate(object_high));
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 b(&stop); 317 b(&stop);
281 Emit(reinterpret_cast<int32_t>(message)); 318 Emit(reinterpret_cast<int32_t>(message));
282 Bind(&stop); 319 Bind(&stop);
283 break_(Instr::kStopMessageCode); 320 break_(Instr::kStopMessageCode);
284 } 321 }
285 322
286 } // namespace dart 323 } // namespace dart
287 324
288 #endif // defined TARGET_ARCH_MIPS 325 #endif // defined TARGET_ARCH_MIPS
289 326
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698