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

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

Issue 12391055: Cleaned up CpuFeature scope handling. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fixed nits Created 7 years, 9 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/mips/lithium-codegen-mips.cc ('k') | src/mips/macro-assembler-mips.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 ASSERT(moves_[index].destination()->Equals(moves_[root_index_].source())); 165 ASSERT(moves_[index].destination()->Equals(moves_[root_index_].source()));
166 ASSERT(!in_cycle_); 166 ASSERT(!in_cycle_);
167 in_cycle_ = true; 167 in_cycle_ = true;
168 LOperand* source = moves_[index].source(); 168 LOperand* source = moves_[index].source();
169 saved_destination_ = moves_[index].destination(); 169 saved_destination_ = moves_[index].destination();
170 if (source->IsRegister()) { 170 if (source->IsRegister()) {
171 __ mov(kLithiumScratchReg, cgen_->ToRegister(source)); 171 __ mov(kLithiumScratchReg, cgen_->ToRegister(source));
172 } else if (source->IsStackSlot()) { 172 } else if (source->IsStackSlot()) {
173 __ lw(kLithiumScratchReg, cgen_->ToMemOperand(source)); 173 __ lw(kLithiumScratchReg, cgen_->ToMemOperand(source));
174 } else if (source->IsDoubleRegister()) { 174 } else if (source->IsDoubleRegister()) {
175 CpuFeatures::Scope scope(FPU); 175 CpuFeatureScope scope(cgen_->masm(), FPU);
176 __ mov_d(kLithiumScratchDouble, cgen_->ToDoubleRegister(source)); 176 __ mov_d(kLithiumScratchDouble, cgen_->ToDoubleRegister(source));
177 } else if (source->IsDoubleStackSlot()) { 177 } else if (source->IsDoubleStackSlot()) {
178 CpuFeatures::Scope scope(FPU); 178 CpuFeatureScope scope(cgen_->masm(), FPU);
179 __ ldc1(kLithiumScratchDouble, cgen_->ToMemOperand(source)); 179 __ ldc1(kLithiumScratchDouble, cgen_->ToMemOperand(source));
180 } else { 180 } else {
181 UNREACHABLE(); 181 UNREACHABLE();
182 } 182 }
183 // This move will be done by restoring the saved value to the destination. 183 // This move will be done by restoring the saved value to the destination.
184 moves_[index].Eliminate(); 184 moves_[index].Eliminate();
185 } 185 }
186 186
187 187
188 void LGapResolver::RestoreValue() { 188 void LGapResolver::RestoreValue() {
189 ASSERT(in_cycle_); 189 ASSERT(in_cycle_);
190 ASSERT(saved_destination_ != NULL); 190 ASSERT(saved_destination_ != NULL);
191 191
192 // Spilled value is in kLithiumScratchReg or kLithiumScratchDouble. 192 // Spilled value is in kLithiumScratchReg or kLithiumScratchDouble.
193 if (saved_destination_->IsRegister()) { 193 if (saved_destination_->IsRegister()) {
194 __ mov(cgen_->ToRegister(saved_destination_), kLithiumScratchReg); 194 __ mov(cgen_->ToRegister(saved_destination_), kLithiumScratchReg);
195 } else if (saved_destination_->IsStackSlot()) { 195 } else if (saved_destination_->IsStackSlot()) {
196 __ sw(kLithiumScratchReg, cgen_->ToMemOperand(saved_destination_)); 196 __ sw(kLithiumScratchReg, cgen_->ToMemOperand(saved_destination_));
197 } else if (saved_destination_->IsDoubleRegister()) { 197 } else if (saved_destination_->IsDoubleRegister()) {
198 CpuFeatures::Scope scope(FPU); 198 CpuFeatureScope scope(cgen_->masm(), FPU);
199 __ mov_d(cgen_->ToDoubleRegister(saved_destination_), 199 __ mov_d(cgen_->ToDoubleRegister(saved_destination_),
200 kLithiumScratchDouble); 200 kLithiumScratchDouble);
201 } else if (saved_destination_->IsDoubleStackSlot()) { 201 } else if (saved_destination_->IsDoubleStackSlot()) {
202 CpuFeatures::Scope scope(FPU); 202 CpuFeatureScope scope(cgen_->masm(), FPU);
203 __ sdc1(kLithiumScratchDouble, 203 __ sdc1(kLithiumScratchDouble,
204 cgen_->ToMemOperand(saved_destination_)); 204 cgen_->ToMemOperand(saved_destination_));
205 } else { 205 } else {
206 UNREACHABLE(); 206 UNREACHABLE();
207 } 207 }
208 208
209 in_cycle_ = false; 209 in_cycle_ = false;
210 saved_destination_ = NULL; 210 saved_destination_ = NULL;
211 } 211 }
212 212
(...skipping 16 matching lines...) Expand all
229 229
230 } else if (source->IsStackSlot()) { 230 } else if (source->IsStackSlot()) {
231 MemOperand source_operand = cgen_->ToMemOperand(source); 231 MemOperand source_operand = cgen_->ToMemOperand(source);
232 if (destination->IsRegister()) { 232 if (destination->IsRegister()) {
233 __ lw(cgen_->ToRegister(destination), source_operand); 233 __ lw(cgen_->ToRegister(destination), source_operand);
234 } else { 234 } else {
235 ASSERT(destination->IsStackSlot()); 235 ASSERT(destination->IsStackSlot());
236 MemOperand destination_operand = cgen_->ToMemOperand(destination); 236 MemOperand destination_operand = cgen_->ToMemOperand(destination);
237 if (in_cycle_) { 237 if (in_cycle_) {
238 if (!destination_operand.OffsetIsInt16Encodable()) { 238 if (!destination_operand.OffsetIsInt16Encodable()) {
239 CpuFeatures::Scope scope(FPU); 239 CpuFeatureScope scope(cgen_->masm(), FPU);
240 // 'at' is overwritten while saving the value to the destination. 240 // 'at' is overwritten while saving the value to the destination.
241 // Therefore we can't use 'at'. It is OK if the read from the source 241 // Therefore we can't use 'at'. It is OK if the read from the source
242 // destroys 'at', since that happens before the value is read. 242 // destroys 'at', since that happens before the value is read.
243 // This uses only a single reg of the double reg-pair. 243 // This uses only a single reg of the double reg-pair.
244 __ lwc1(kLithiumScratchDouble, source_operand); 244 __ lwc1(kLithiumScratchDouble, source_operand);
245 __ swc1(kLithiumScratchDouble, destination_operand); 245 __ swc1(kLithiumScratchDouble, destination_operand);
246 } else { 246 } else {
247 __ lw(at, source_operand); 247 __ lw(at, source_operand);
248 __ sw(at, destination_operand); 248 __ sw(at, destination_operand);
249 } 249 }
(...skipping 19 matching lines...) Expand all
269 __ li(kLithiumScratchReg, 269 __ li(kLithiumScratchReg,
270 Operand(cgen_->ToInteger32(constant_source))); 270 Operand(cgen_->ToInteger32(constant_source)));
271 } else { 271 } else {
272 __ LoadObject(kLithiumScratchReg, 272 __ LoadObject(kLithiumScratchReg,
273 cgen_->ToHandle(constant_source)); 273 cgen_->ToHandle(constant_source));
274 } 274 }
275 __ sw(kLithiumScratchReg, cgen_->ToMemOperand(destination)); 275 __ sw(kLithiumScratchReg, cgen_->ToMemOperand(destination));
276 } 276 }
277 277
278 } else if (source->IsDoubleRegister()) { 278 } else if (source->IsDoubleRegister()) {
279 CpuFeatures::Scope scope(FPU); 279 CpuFeatureScope scope(cgen_->masm(), FPU);
280 DoubleRegister source_register = cgen_->ToDoubleRegister(source); 280 DoubleRegister source_register = cgen_->ToDoubleRegister(source);
281 if (destination->IsDoubleRegister()) { 281 if (destination->IsDoubleRegister()) {
282 __ mov_d(cgen_->ToDoubleRegister(destination), source_register); 282 __ mov_d(cgen_->ToDoubleRegister(destination), source_register);
283 } else { 283 } else {
284 ASSERT(destination->IsDoubleStackSlot()); 284 ASSERT(destination->IsDoubleStackSlot());
285 MemOperand destination_operand = cgen_->ToMemOperand(destination); 285 MemOperand destination_operand = cgen_->ToMemOperand(destination);
286 __ sdc1(source_register, destination_operand); 286 __ sdc1(source_register, destination_operand);
287 } 287 }
288 288
289 } else if (source->IsDoubleStackSlot()) { 289 } else if (source->IsDoubleStackSlot()) {
290 CpuFeatures::Scope scope(FPU); 290 CpuFeatureScope scope(cgen_->masm(), FPU);
291 MemOperand source_operand = cgen_->ToMemOperand(source); 291 MemOperand source_operand = cgen_->ToMemOperand(source);
292 if (destination->IsDoubleRegister()) { 292 if (destination->IsDoubleRegister()) {
293 __ ldc1(cgen_->ToDoubleRegister(destination), source_operand); 293 __ ldc1(cgen_->ToDoubleRegister(destination), source_operand);
294 } else { 294 } else {
295 ASSERT(destination->IsDoubleStackSlot()); 295 ASSERT(destination->IsDoubleStackSlot());
296 MemOperand destination_operand = cgen_->ToMemOperand(destination); 296 MemOperand destination_operand = cgen_->ToMemOperand(destination);
297 if (in_cycle_) { 297 if (in_cycle_) {
298 // kLithiumScratchDouble was used to break the cycle, 298 // kLithiumScratchDouble was used to break the cycle,
299 // but kLithiumScratchReg is free. 299 // but kLithiumScratchReg is free.
300 MemOperand source_high_operand = 300 MemOperand source_high_operand =
(...skipping 13 matching lines...) Expand all
314 UNREACHABLE(); 314 UNREACHABLE();
315 } 315 }
316 316
317 moves_[index].Eliminate(); 317 moves_[index].Eliminate();
318 } 318 }
319 319
320 320
321 #undef __ 321 #undef __
322 322
323 } } // namespace v8::internal 323 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/mips/lithium-codegen-mips.cc ('k') | src/mips/macro-assembler-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698