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

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

Issue 1580233003: [turbofan] avoid xchg instruction on Intel (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 11 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
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 #if V8_TARGET_ARCH_X64 5 #if V8_TARGET_ARCH_X64
6 6
7 #include "src/crankshaft/x64/lithium-gap-resolver-x64.h" 7 #include "src/crankshaft/x64/lithium-gap-resolver-x64.h"
8 8
9 #include "src/crankshaft/x64/lithium-codegen-x64.h" 9 #include "src/crankshaft/x64/lithium-codegen-x64.h"
10 10
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 void LGapResolver::EmitSwap(int index) { 237 void LGapResolver::EmitSwap(int index) {
238 LOperand* source = moves_[index].source(); 238 LOperand* source = moves_[index].source();
239 LOperand* destination = moves_[index].destination(); 239 LOperand* destination = moves_[index].destination();
240 240
241 // Dispatch on the source and destination operand kinds. Not all 241 // Dispatch on the source and destination operand kinds. Not all
242 // combinations are possible. 242 // combinations are possible.
243 if (source->IsRegister() && destination->IsRegister()) { 243 if (source->IsRegister() && destination->IsRegister()) {
244 // Swap two general-purpose registers. 244 // Swap two general-purpose registers.
245 Register src = cgen_->ToRegister(source); 245 Register src = cgen_->ToRegister(source);
246 Register dst = cgen_->ToRegister(destination); 246 Register dst = cgen_->ToRegister(destination);
247 __ xchgq(dst, src); 247 __ movp(kScratchRegister, src);
248 __ movp(src, dst);
249 __ movp(dst, kScratchRegister);
248 250
249 } else if ((source->IsRegister() && destination->IsStackSlot()) || 251 } else if ((source->IsRegister() && destination->IsStackSlot()) ||
250 (source->IsStackSlot() && destination->IsRegister())) { 252 (source->IsStackSlot() && destination->IsRegister())) {
251 // Swap a general-purpose register and a stack slot. 253 // Swap a general-purpose register and a stack slot.
252 Register reg = 254 Register reg =
253 cgen_->ToRegister(source->IsRegister() ? source : destination); 255 cgen_->ToRegister(source->IsRegister() ? source : destination);
254 Operand mem = 256 Operand mem =
255 cgen_->ToOperand(source->IsRegister() ? destination : source); 257 cgen_->ToOperand(source->IsRegister() ? destination : source);
256 __ movp(kScratchRegister, mem); 258 __ movp(kScratchRegister, mem);
257 __ movp(mem, reg); 259 __ movp(mem, reg);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 } 312 }
311 } 313 }
312 } 314 }
313 315
314 #undef __ 316 #undef __
315 317
316 } // namespace internal 318 } // namespace internal
317 } // namespace v8 319 } // namespace v8
318 320
319 #endif // V8_TARGET_ARCH_X64 321 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698