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

Side by Side Diff: src/mips64/lithium-gap-resolver-mips64.cc

Issue 371923006: Add mips64 port. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebase Created 6 years, 5 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 | « src/mips64/lithium-gap-resolver-mips64.h ('k') | src/mips64/lithium-mips64.h » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/mips/lithium-codegen-mips.h" 7 #include "src/mips64/lithium-codegen-mips64.h"
8 #include "src/mips/lithium-gap-resolver-mips.h" 8 #include "src/mips64/lithium-gap-resolver-mips64.h"
9 9
10 namespace v8 { 10 namespace v8 {
11 namespace internal { 11 namespace internal {
12 12
13 LGapResolver::LGapResolver(LCodeGen* owner) 13 LGapResolver::LGapResolver(LCodeGen* owner)
14 : cgen_(owner), 14 : cgen_(owner),
15 moves_(32, owner->zone()), 15 moves_(32, owner->zone()),
16 root_index_(0), 16 root_index_(0),
17 in_cycle_(false), 17 in_cycle_(false),
18 saved_destination_(NULL) {} 18 saved_destination_(NULL) {}
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 // moves_[root_index]. After performing all moves in the tree rooted 140 // moves_[root_index]. After performing all moves in the tree rooted
141 // in that move, we save the value to that source. 141 // in that move, we save the value to that source.
142 ASSERT(moves_[index].destination()->Equals(moves_[root_index_].source())); 142 ASSERT(moves_[index].destination()->Equals(moves_[root_index_].source()));
143 ASSERT(!in_cycle_); 143 ASSERT(!in_cycle_);
144 in_cycle_ = true; 144 in_cycle_ = true;
145 LOperand* source = moves_[index].source(); 145 LOperand* source = moves_[index].source();
146 saved_destination_ = moves_[index].destination(); 146 saved_destination_ = moves_[index].destination();
147 if (source->IsRegister()) { 147 if (source->IsRegister()) {
148 __ mov(kLithiumScratchReg, cgen_->ToRegister(source)); 148 __ mov(kLithiumScratchReg, cgen_->ToRegister(source));
149 } else if (source->IsStackSlot()) { 149 } else if (source->IsStackSlot()) {
150 __ lw(kLithiumScratchReg, cgen_->ToMemOperand(source)); 150 __ ld(kLithiumScratchReg, cgen_->ToMemOperand(source));
151 } else if (source->IsDoubleRegister()) { 151 } else if (source->IsDoubleRegister()) {
152 __ mov_d(kLithiumScratchDouble, cgen_->ToDoubleRegister(source)); 152 __ mov_d(kLithiumScratchDouble, cgen_->ToDoubleRegister(source));
153 } else if (source->IsDoubleStackSlot()) { 153 } else if (source->IsDoubleStackSlot()) {
154 __ ldc1(kLithiumScratchDouble, cgen_->ToMemOperand(source)); 154 __ ldc1(kLithiumScratchDouble, cgen_->ToMemOperand(source));
155 } else { 155 } else {
156 UNREACHABLE(); 156 UNREACHABLE();
157 } 157 }
158 // This move will be done by restoring the saved value to the destination. 158 // This move will be done by restoring the saved value to the destination.
159 moves_[index].Eliminate(); 159 moves_[index].Eliminate();
160 } 160 }
161 161
162 162
163 void LGapResolver::RestoreValue() { 163 void LGapResolver::RestoreValue() {
164 ASSERT(in_cycle_); 164 ASSERT(in_cycle_);
165 ASSERT(saved_destination_ != NULL); 165 ASSERT(saved_destination_ != NULL);
166 166
167 // Spilled value is in kLithiumScratchReg or kLithiumScratchDouble. 167 // Spilled value is in kLithiumScratchReg or kLithiumScratchDouble.
168 if (saved_destination_->IsRegister()) { 168 if (saved_destination_->IsRegister()) {
169 __ mov(cgen_->ToRegister(saved_destination_), kLithiumScratchReg); 169 __ mov(cgen_->ToRegister(saved_destination_), kLithiumScratchReg);
170 } else if (saved_destination_->IsStackSlot()) { 170 } else if (saved_destination_->IsStackSlot()) {
171 __ sw(kLithiumScratchReg, cgen_->ToMemOperand(saved_destination_)); 171 __ sd(kLithiumScratchReg, cgen_->ToMemOperand(saved_destination_));
172 } else if (saved_destination_->IsDoubleRegister()) { 172 } else if (saved_destination_->IsDoubleRegister()) {
173 __ mov_d(cgen_->ToDoubleRegister(saved_destination_), 173 __ mov_d(cgen_->ToDoubleRegister(saved_destination_),
174 kLithiumScratchDouble); 174 kLithiumScratchDouble);
175 } else if (saved_destination_->IsDoubleStackSlot()) { 175 } else if (saved_destination_->IsDoubleStackSlot()) {
176 __ sdc1(kLithiumScratchDouble, 176 __ sdc1(kLithiumScratchDouble,
177 cgen_->ToMemOperand(saved_destination_)); 177 cgen_->ToMemOperand(saved_destination_));
178 } else { 178 } else {
179 UNREACHABLE(); 179 UNREACHABLE();
180 } 180 }
181 181
182 in_cycle_ = false; 182 in_cycle_ = false;
183 saved_destination_ = NULL; 183 saved_destination_ = NULL;
184 } 184 }
185 185
186 186
187 void LGapResolver::EmitMove(int index) { 187 void LGapResolver::EmitMove(int index) {
188 LOperand* source = moves_[index].source(); 188 LOperand* source = moves_[index].source();
189 LOperand* destination = moves_[index].destination(); 189 LOperand* destination = moves_[index].destination();
190 190
191 // Dispatch on the source and destination operand kinds. Not all 191 // Dispatch on the source and destination operand kinds. Not all
192 // combinations are possible. 192 // combinations are possible.
193 193
194 if (source->IsRegister()) { 194 if (source->IsRegister()) {
195 Register source_register = cgen_->ToRegister(source); 195 Register source_register = cgen_->ToRegister(source);
196 if (destination->IsRegister()) { 196 if (destination->IsRegister()) {
197 __ mov(cgen_->ToRegister(destination), source_register); 197 __ mov(cgen_->ToRegister(destination), source_register);
198 } else { 198 } else {
199 ASSERT(destination->IsStackSlot()); 199 ASSERT(destination->IsStackSlot());
200 __ sw(source_register, cgen_->ToMemOperand(destination)); 200 __ sd(source_register, cgen_->ToMemOperand(destination));
201 } 201 }
202 } else if (source->IsStackSlot()) { 202 } else if (source->IsStackSlot()) {
203 MemOperand source_operand = cgen_->ToMemOperand(source); 203 MemOperand source_operand = cgen_->ToMemOperand(source);
204 if (destination->IsRegister()) { 204 if (destination->IsRegister()) {
205 __ lw(cgen_->ToRegister(destination), source_operand); 205 __ ld(cgen_->ToRegister(destination), source_operand);
206 } else { 206 } else {
207 ASSERT(destination->IsStackSlot()); 207 ASSERT(destination->IsStackSlot());
208 MemOperand destination_operand = cgen_->ToMemOperand(destination); 208 MemOperand destination_operand = cgen_->ToMemOperand(destination);
209 if (in_cycle_) { 209 if (in_cycle_) {
210 if (!destination_operand.OffsetIsInt16Encodable()) { 210 if (!destination_operand.OffsetIsInt16Encodable()) {
211 // 'at' is overwritten while saving the value to the destination. 211 // 'at' is overwritten while saving the value to the destination.
212 // Therefore we can't use 'at'. It is OK if the read from the source 212 // Therefore we can't use 'at'. It is OK if the read from the source
213 // destroys 'at', since that happens before the value is read. 213 // destroys 'at', since that happens before the value is read.
214 // This uses only a single reg of the double reg-pair. 214 // This uses only a single reg of the double reg-pair.
215 __ lwc1(kLithiumScratchDouble, source_operand); 215 __ ldc1(kLithiumScratchDouble, source_operand);
216 __ swc1(kLithiumScratchDouble, destination_operand); 216 __ sdc1(kLithiumScratchDouble, destination_operand);
217 } else { 217 } else {
218 __ lw(at, source_operand); 218 __ ld(at, source_operand);
219 __ sw(at, destination_operand); 219 __ sd(at, destination_operand);
220 } 220 }
221 } else { 221 } else {
222 __ lw(kLithiumScratchReg, source_operand); 222 __ ld(kLithiumScratchReg, source_operand);
223 __ sw(kLithiumScratchReg, destination_operand); 223 __ sd(kLithiumScratchReg, destination_operand);
224 } 224 }
225 } 225 }
226 226
227 } else if (source->IsConstantOperand()) { 227 } else if (source->IsConstantOperand()) {
228 LConstantOperand* constant_source = LConstantOperand::cast(source); 228 LConstantOperand* constant_source = LConstantOperand::cast(source);
229 if (destination->IsRegister()) { 229 if (destination->IsRegister()) {
230 Register dst = cgen_->ToRegister(destination); 230 Register dst = cgen_->ToRegister(destination);
231 Representation r = cgen_->IsSmi(constant_source) 231 if (cgen_->IsSmi(constant_source)) {
232 ? Representation::Smi() : Representation::Integer32(); 232 __ li(dst, Operand(cgen_->ToSmi(constant_source)));
233 if (cgen_->IsInteger32(constant_source)) { 233 } else if (cgen_->IsInteger32(constant_source)) {
234 __ li(dst, Operand(cgen_->ToRepresentation(constant_source, r))); 234 __ li(dst, Operand(cgen_->ToInteger32(constant_source)));
235 } else { 235 } else {
236 __ li(dst, cgen_->ToHandle(constant_source)); 236 __ li(dst, cgen_->ToHandle(constant_source));
237 } 237 }
238 } else if (destination->IsDoubleRegister()) { 238 } else if (destination->IsDoubleRegister()) {
239 DoubleRegister result = cgen_->ToDoubleRegister(destination); 239 DoubleRegister result = cgen_->ToDoubleRegister(destination);
240 double v = cgen_->ToDouble(constant_source); 240 double v = cgen_->ToDouble(constant_source);
241 __ Move(result, v); 241 __ Move(result, v);
242 } else { 242 } else {
243 ASSERT(destination->IsStackSlot()); 243 ASSERT(destination->IsStackSlot());
244 ASSERT(!in_cycle_); // Constant moves happen after all cycles are gone. 244 ASSERT(!in_cycle_); // Constant moves happen after all cycles are gone.
245 Representation r = cgen_->IsSmi(constant_source) 245 if (cgen_->IsSmi(constant_source)) {
246 ? Representation::Smi() : Representation::Integer32(); 246 __ li(kLithiumScratchReg, Operand(cgen_->ToSmi(constant_source)));
247 if (cgen_->IsInteger32(constant_source)) { 247 __ sd(kLithiumScratchReg, cgen_->ToMemOperand(destination));
248 __ li(kLithiumScratchReg, 248 } else if (cgen_->IsInteger32(constant_source)) {
249 Operand(cgen_->ToRepresentation(constant_source, r))); 249 __ li(kLithiumScratchReg, Operand(cgen_->ToInteger32(constant_source)));
250 __ sd(kLithiumScratchReg, cgen_->ToMemOperand(destination));
250 } else { 251 } else {
251 __ li(kLithiumScratchReg, cgen_->ToHandle(constant_source)); 252 __ li(kLithiumScratchReg, cgen_->ToHandle(constant_source));
253 __ sd(kLithiumScratchReg, cgen_->ToMemOperand(destination));
252 } 254 }
253 __ sw(kLithiumScratchReg, cgen_->ToMemOperand(destination));
254 } 255 }
255 256
256 } else if (source->IsDoubleRegister()) { 257 } else if (source->IsDoubleRegister()) {
257 DoubleRegister source_register = cgen_->ToDoubleRegister(source); 258 DoubleRegister source_register = cgen_->ToDoubleRegister(source);
258 if (destination->IsDoubleRegister()) { 259 if (destination->IsDoubleRegister()) {
259 __ mov_d(cgen_->ToDoubleRegister(destination), source_register); 260 __ mov_d(cgen_->ToDoubleRegister(destination), source_register);
260 } else { 261 } else {
261 ASSERT(destination->IsDoubleStackSlot()); 262 ASSERT(destination->IsDoubleStackSlot());
262 MemOperand destination_operand = cgen_->ToMemOperand(destination); 263 MemOperand destination_operand = cgen_->ToMemOperand(destination);
263 __ sdc1(source_register, destination_operand); 264 __ sdc1(source_register, destination_operand);
(...skipping 26 matching lines...) Expand all
290 UNREACHABLE(); 291 UNREACHABLE();
291 } 292 }
292 293
293 moves_[index].Eliminate(); 294 moves_[index].Eliminate();
294 } 295 }
295 296
296 297
297 #undef __ 298 #undef __
298 299
299 } } // namespace v8::internal 300 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/mips64/lithium-gap-resolver-mips64.h ('k') | src/mips64/lithium-mips64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698