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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/compiler/x64/code-generator-x64.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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/compiler/code-generator.h" 5 #include "src/compiler/code-generator.h"
6 6
7 #include "src/ast/scopes.h" 7 #include "src/ast/scopes.h"
8 #include "src/compiler/code-generator-impl.h" 8 #include "src/compiler/code-generator-impl.h"
9 #include "src/compiler/gap-resolver.h" 9 #include "src/compiler/gap-resolver.h"
10 #include "src/compiler/node-matchers.h" 10 #include "src/compiler/node-matchers.h"
(...skipping 1598 matching lines...) Expand 10 before | Expand all | Expand 10 after
1609 1609
1610 void CodeGenerator::AssembleSwap(InstructionOperand* source, 1610 void CodeGenerator::AssembleSwap(InstructionOperand* source,
1611 InstructionOperand* destination) { 1611 InstructionOperand* destination) {
1612 IA32OperandConverter g(this, nullptr); 1612 IA32OperandConverter g(this, nullptr);
1613 // Dispatch on the source and destination operand kinds. Not all 1613 // Dispatch on the source and destination operand kinds. Not all
1614 // combinations are possible. 1614 // combinations are possible.
1615 if (source->IsRegister() && destination->IsRegister()) { 1615 if (source->IsRegister() && destination->IsRegister()) {
1616 // Register-register. 1616 // Register-register.
1617 Register src = g.ToRegister(source); 1617 Register src = g.ToRegister(source);
1618 Register dst = g.ToRegister(destination); 1618 Register dst = g.ToRegister(destination);
1619 __ xchg(dst, src); 1619 __ push(src);
yosin_UTC9 2016/01/20 01:48:18 Just a curiosity, why don't you use XOR-technique
1620 __ mov(src, dst);
1621 __ pop(dst);
1620 } else if (source->IsRegister() && destination->IsStackSlot()) { 1622 } else if (source->IsRegister() && destination->IsStackSlot()) {
1621 // Register-memory. 1623 // Register-memory.
1622 __ xchg(g.ToRegister(source), g.ToOperand(destination)); 1624 Register src = g.ToRegister(source);
1625 __ push(src);
1626 frame_access_state()->IncreaseSPDelta(1);
1627 Operand dst = g.ToOperand(destination);
1628 __ mov(src, dst);
1629 frame_access_state()->IncreaseSPDelta(-1);
1630 dst = g.ToOperand(destination);
1631 __ pop(dst);
1623 } else if (source->IsStackSlot() && destination->IsStackSlot()) { 1632 } else if (source->IsStackSlot() && destination->IsStackSlot()) {
1624 // Memory-memory. 1633 // Memory-memory.
1625 Operand dst1 = g.ToOperand(destination); 1634 Operand dst1 = g.ToOperand(destination);
1626 __ push(dst1); 1635 __ push(dst1);
1627 frame_access_state()->IncreaseSPDelta(1); 1636 frame_access_state()->IncreaseSPDelta(1);
1628 Operand src1 = g.ToOperand(source); 1637 Operand src1 = g.ToOperand(source);
1629 __ push(src1); 1638 __ push(src1);
1630 Operand dst2 = g.ToOperand(destination); 1639 Operand dst2 = g.ToOperand(destination);
1631 __ pop(dst2); 1640 __ pop(dst2);
1632 frame_access_state()->IncreaseSPDelta(-1); 1641 frame_access_state()->IncreaseSPDelta(-1);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1688 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; 1697 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc;
1689 __ Nop(padding_size); 1698 __ Nop(padding_size);
1690 } 1699 }
1691 } 1700 }
1692 1701
1693 #undef __ 1702 #undef __
1694 1703
1695 } // namespace compiler 1704 } // namespace compiler
1696 } // namespace internal 1705 } // namespace internal
1697 } // namespace v8 1706 } // namespace v8
OLDNEW
« 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