Chromium Code Reviews

Unified Diff: src/compiler/ia32/code-generator-ia32.cc

Issue 1596593002: [hack] flags for xchg perf study 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.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « no previous file | src/flag-definitions.h » ('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 f63bc22e4344fe65a875ea3c7cc341a98caa362a..16144c488c7d942b71964800d53e2e09c66b3ffa 100644
--- a/src/compiler/ia32/code-generator-ia32.cc
+++ b/src/compiler/ia32/code-generator-ia32.cc
@@ -1616,9 +1616,21 @@ void CodeGenerator::AssembleSwap(InstructionOperand* source,
// Register-register.
Register src = g.ToRegister(source);
Register dst = g.ToRegister(destination);
- __ push(src);
- __ mov(src, dst);
- __ pop(dst);
+ if (FLAG_use_xor) {
+ __ xor_(src, dst);
+ __ xor_(dst, src);
+ __ xor_(src, dst);
+ } else if (FLAG_use_xchg) {
+ __ xchg(src, dst);
+ } else if (FLAG_use_movs) {
+ __ mov(esi, src);
+ __ mov(src, dst);
+ __ mov(dst, esi);
+ } else {
+ __ push(src);
+ __ mov(src, dst);
+ __ pop(dst);
+ }
} else if (source->IsRegister() && destination->IsStackSlot()) {
// Register-memory.
Register src = g.ToRegister(source);
« no previous file with comments | « no previous file | src/flag-definitions.h » ('j') | no next file with comments »

Powered by Google App Engine