OLD | NEW |
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 1897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1908 | 1908 |
1909 void CodeGenerator::AssembleSwap(InstructionOperand* source, | 1909 void CodeGenerator::AssembleSwap(InstructionOperand* source, |
1910 InstructionOperand* destination) { | 1910 InstructionOperand* destination) { |
1911 X87OperandConverter g(this, nullptr); | 1911 X87OperandConverter g(this, nullptr); |
1912 // Dispatch on the source and destination operand kinds. Not all | 1912 // Dispatch on the source and destination operand kinds. Not all |
1913 // combinations are possible. | 1913 // combinations are possible. |
1914 if (source->IsRegister() && destination->IsRegister()) { | 1914 if (source->IsRegister() && destination->IsRegister()) { |
1915 // Register-register. | 1915 // Register-register. |
1916 Register src = g.ToRegister(source); | 1916 Register src = g.ToRegister(source); |
1917 Register dst = g.ToRegister(destination); | 1917 Register dst = g.ToRegister(destination); |
1918 __ xchg(dst, src); | 1918 __ push(src); |
| 1919 __ mov(src, dst); |
| 1920 __ pop(dst); |
1919 } else if (source->IsRegister() && destination->IsStackSlot()) { | 1921 } else if (source->IsRegister() && destination->IsStackSlot()) { |
1920 // Register-memory. | 1922 // Register-memory. |
1921 __ xchg(g.ToRegister(source), g.ToOperand(destination)); | 1923 Register src = g.ToRegister(source); |
| 1924 __ push(src); |
| 1925 frame_access_state()->IncreaseSPDelta(1); |
| 1926 Operand dst = g.ToOperand(destination); |
| 1927 __ mov(src, dst); |
| 1928 frame_access_state()->IncreaseSPDelta(-1); |
| 1929 dst = g.ToOperand(destination); |
| 1930 __ pop(dst); |
1922 } else if (source->IsStackSlot() && destination->IsStackSlot()) { | 1931 } else if (source->IsStackSlot() && destination->IsStackSlot()) { |
1923 // Memory-memory. | 1932 // Memory-memory. |
1924 Operand dst1 = g.ToOperand(destination); | 1933 Operand dst1 = g.ToOperand(destination); |
1925 __ push(dst1); | 1934 __ push(dst1); |
1926 frame_access_state()->IncreaseSPDelta(1); | 1935 frame_access_state()->IncreaseSPDelta(1); |
1927 Operand src1 = g.ToOperand(source); | 1936 Operand src1 = g.ToOperand(source); |
1928 __ push(src1); | 1937 __ push(src1); |
1929 Operand dst2 = g.ToOperand(destination); | 1938 Operand dst2 = g.ToOperand(destination); |
1930 __ pop(dst2); | 1939 __ pop(dst2); |
1931 frame_access_state()->IncreaseSPDelta(-1); | 1940 frame_access_state()->IncreaseSPDelta(-1); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1997 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; | 2006 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; |
1998 __ Nop(padding_size); | 2007 __ Nop(padding_size); |
1999 } | 2008 } |
2000 } | 2009 } |
2001 | 2010 |
2002 #undef __ | 2011 #undef __ |
2003 | 2012 |
2004 } // namespace compiler | 2013 } // namespace compiler |
2005 } // namespace internal | 2014 } // namespace internal |
2006 } // namespace v8 | 2015 } // namespace v8 |
OLD | NEW |