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

Unified Diff: src/compiler/ia32/code-generator-ia32.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/compiler/x64/code-generator-x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/ia32/code-generator-ia32.cc
diff --git a/src/compiler/ia32/code-generator-ia32.cc b/src/compiler/ia32/code-generator-ia32.cc
index 9bb5a22cd19b45707165323321d109aaeca32cc9..f63bc22e4344fe65a875ea3c7cc341a98caa362a 100644
--- a/src/compiler/ia32/code-generator-ia32.cc
+++ b/src/compiler/ia32/code-generator-ia32.cc
@@ -1616,10 +1616,19 @@ void CodeGenerator::AssembleSwap(InstructionOperand* source,
// Register-register.
Register src = g.ToRegister(source);
Register dst = g.ToRegister(destination);
- __ xchg(dst, src);
+ __ push(src);
yosin_UTC9 2016/01/20 01:48:18 Just a curiosity, why don't you use XOR-technique
+ __ mov(src, dst);
+ __ pop(dst);
} else if (source->IsRegister() && destination->IsStackSlot()) {
// Register-memory.
- __ xchg(g.ToRegister(source), g.ToOperand(destination));
+ Register src = g.ToRegister(source);
+ __ push(src);
+ frame_access_state()->IncreaseSPDelta(1);
+ Operand dst = g.ToOperand(destination);
+ __ mov(src, dst);
+ frame_access_state()->IncreaseSPDelta(-1);
+ dst = g.ToOperand(destination);
+ __ pop(dst);
} else if (source->IsStackSlot() && destination->IsStackSlot()) {
// Memory-memory.
Operand dst1 = g.ToOperand(destination);
« no previous file with comments | « no previous file | src/compiler/x64/code-generator-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698