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 1246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1257 __ lea(i.OutputRegister(), i.MemoryOperand()); | 1257 __ lea(i.OutputRegister(), i.MemoryOperand()); |
1258 } | 1258 } |
1259 } else { | 1259 } else { |
1260 __ lea(i.OutputRegister(), i.MemoryOperand()); | 1260 __ lea(i.OutputRegister(), i.MemoryOperand()); |
1261 } | 1261 } |
1262 break; | 1262 break; |
1263 } | 1263 } |
1264 case kX87Push: | 1264 case kX87Push: |
1265 if (instr->InputAt(0)->IsDoubleRegister()) { | 1265 if (instr->InputAt(0)->IsDoubleRegister()) { |
1266 auto allocated = AllocatedOperand::cast(*instr->InputAt(0)); | 1266 auto allocated = AllocatedOperand::cast(*instr->InputAt(0)); |
1267 if (allocated.machine_type() == kRepFloat32) { | 1267 if (allocated.representation() == MachineRepresentation::kFloat32) { |
1268 __ sub(esp, Immediate(kDoubleSize)); | 1268 __ sub(esp, Immediate(kDoubleSize)); |
1269 __ fst_s(Operand(esp, 0)); | 1269 __ fst_s(Operand(esp, 0)); |
1270 } else { | 1270 } else { |
1271 DCHECK(allocated.machine_type() == kRepFloat64); | 1271 DCHECK(allocated.representation() == MachineRepresentation::kFloat64); |
1272 __ sub(esp, Immediate(kDoubleSize)); | 1272 __ sub(esp, Immediate(kDoubleSize)); |
1273 __ fst_d(Operand(esp, 0)); | 1273 __ fst_d(Operand(esp, 0)); |
1274 } | 1274 } |
1275 } else if (instr->InputAt(0)->IsDoubleStackSlot()) { | 1275 } else if (instr->InputAt(0)->IsDoubleStackSlot()) { |
1276 auto allocated = AllocatedOperand::cast(*instr->InputAt(0)); | 1276 auto allocated = AllocatedOperand::cast(*instr->InputAt(0)); |
1277 if (allocated.machine_type() == kRepFloat32) { | 1277 if (allocated.representation() == MachineRepresentation::kFloat32) { |
1278 __ sub(esp, Immediate(kDoubleSize)); | 1278 __ sub(esp, Immediate(kDoubleSize)); |
1279 __ fld_s(i.InputOperand(0)); | 1279 __ fld_s(i.InputOperand(0)); |
1280 __ fstp_s(MemOperand(esp, 0)); | 1280 __ fstp_s(MemOperand(esp, 0)); |
1281 } else { | 1281 } else { |
1282 DCHECK(allocated.machine_type() == kRepFloat64); | 1282 DCHECK(allocated.representation() == MachineRepresentation::kFloat64); |
1283 __ sub(esp, Immediate(kDoubleSize)); | 1283 __ sub(esp, Immediate(kDoubleSize)); |
1284 __ fld_d(i.InputOperand(0)); | 1284 __ fld_d(i.InputOperand(0)); |
1285 __ fstp_d(MemOperand(esp, 0)); | 1285 __ fstp_d(MemOperand(esp, 0)); |
1286 } | 1286 } |
1287 frame_access_state()->IncreaseSPDelta(kDoubleSize / kPointerSize); | 1287 frame_access_state()->IncreaseSPDelta(kDoubleSize / kPointerSize); |
1288 } else if (HasImmediateInput(instr, 0)) { | 1288 } else if (HasImmediateInput(instr, 0)) { |
1289 __ push(i.InputImmediate(0)); | 1289 __ push(i.InputImmediate(0)); |
1290 frame_access_state()->IncreaseSPDelta(1); | 1290 frame_access_state()->IncreaseSPDelta(1); |
1291 } else { | 1291 } else { |
1292 __ push(i.InputOperand(0)); | 1292 __ push(i.InputOperand(0)); |
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1861 Operand dst0 = g.ToOperand(destination); | 1861 Operand dst0 = g.ToOperand(destination); |
1862 Operand dst1 = g.HighOperand(destination); | 1862 Operand dst1 = g.HighOperand(destination); |
1863 __ Move(dst0, Immediate(lower)); | 1863 __ Move(dst0, Immediate(lower)); |
1864 __ Move(dst1, Immediate(upper)); | 1864 __ Move(dst1, Immediate(upper)); |
1865 } | 1865 } |
1866 } | 1866 } |
1867 } else if (source->IsDoubleRegister()) { | 1867 } else if (source->IsDoubleRegister()) { |
1868 DCHECK(destination->IsDoubleStackSlot()); | 1868 DCHECK(destination->IsDoubleStackSlot()); |
1869 Operand dst = g.ToOperand(destination); | 1869 Operand dst = g.ToOperand(destination); |
1870 auto allocated = AllocatedOperand::cast(*source); | 1870 auto allocated = AllocatedOperand::cast(*source); |
1871 switch (allocated.machine_type()) { | 1871 switch (allocated.representation()) { |
1872 case kRepFloat32: | 1872 case MachineRepresentation::kFloat32: |
1873 __ fst_s(dst); | 1873 __ fst_s(dst); |
1874 break; | 1874 break; |
1875 case kRepFloat64: | 1875 case MachineRepresentation::kFloat64: |
1876 __ fst_d(dst); | 1876 __ fst_d(dst); |
1877 break; | 1877 break; |
1878 default: | 1878 default: |
1879 UNREACHABLE(); | 1879 UNREACHABLE(); |
1880 } | 1880 } |
1881 } else if (source->IsDoubleStackSlot()) { | 1881 } else if (source->IsDoubleStackSlot()) { |
1882 DCHECK(destination->IsDoubleRegister() || destination->IsDoubleStackSlot()); | 1882 DCHECK(destination->IsDoubleRegister() || destination->IsDoubleStackSlot()); |
1883 Operand src = g.ToOperand(source); | 1883 Operand src = g.ToOperand(source); |
1884 auto allocated = AllocatedOperand::cast(*source); | 1884 auto allocated = AllocatedOperand::cast(*source); |
1885 if (destination->IsDoubleRegister()) { | 1885 if (destination->IsDoubleRegister()) { |
1886 // always only push one value into the x87 stack. | 1886 // always only push one value into the x87 stack. |
1887 __ fstp(0); | 1887 __ fstp(0); |
1888 switch (allocated.machine_type()) { | 1888 switch (allocated.representation()) { |
1889 case kRepFloat32: | 1889 case MachineRepresentation::kFloat32: |
1890 __ fld_s(src); | 1890 __ fld_s(src); |
1891 break; | 1891 break; |
1892 case kRepFloat64: | 1892 case MachineRepresentation::kFloat64: |
1893 __ fld_d(src); | 1893 __ fld_d(src); |
1894 break; | 1894 break; |
1895 default: | 1895 default: |
1896 UNREACHABLE(); | 1896 UNREACHABLE(); |
1897 } | 1897 } |
1898 } else { | 1898 } else { |
1899 Operand dst = g.ToOperand(destination); | 1899 Operand dst = g.ToOperand(destination); |
1900 switch (allocated.machine_type()) { | 1900 switch (allocated.representation()) { |
1901 case kRepFloat32: | 1901 case MachineRepresentation::kFloat32: |
1902 __ fld_s(src); | 1902 __ fld_s(src); |
1903 __ fstp_s(dst); | 1903 __ fstp_s(dst); |
1904 break; | 1904 break; |
1905 case kRepFloat64: | 1905 case MachineRepresentation::kFloat64: |
1906 __ fld_d(src); | 1906 __ fld_d(src); |
1907 __ fstp_d(dst); | 1907 __ fstp_d(dst); |
1908 break; | 1908 break; |
1909 default: | 1909 default: |
1910 UNREACHABLE(); | 1910 UNREACHABLE(); |
1911 } | 1911 } |
1912 } | 1912 } |
1913 } else { | 1913 } else { |
1914 UNREACHABLE(); | 1914 UNREACHABLE(); |
1915 } | 1915 } |
(...skipping 22 matching lines...) Expand all Loading... |
1938 __ push(src1); | 1938 __ push(src1); |
1939 Operand dst2 = g.ToOperand(destination); | 1939 Operand dst2 = g.ToOperand(destination); |
1940 __ pop(dst2); | 1940 __ pop(dst2); |
1941 frame_access_state()->IncreaseSPDelta(-1); | 1941 frame_access_state()->IncreaseSPDelta(-1); |
1942 Operand src2 = g.ToOperand(source); | 1942 Operand src2 = g.ToOperand(source); |
1943 __ pop(src2); | 1943 __ pop(src2); |
1944 } else if (source->IsDoubleRegister() && destination->IsDoubleRegister()) { | 1944 } else if (source->IsDoubleRegister() && destination->IsDoubleRegister()) { |
1945 UNREACHABLE(); | 1945 UNREACHABLE(); |
1946 } else if (source->IsDoubleRegister() && destination->IsDoubleStackSlot()) { | 1946 } else if (source->IsDoubleRegister() && destination->IsDoubleStackSlot()) { |
1947 auto allocated = AllocatedOperand::cast(*source); | 1947 auto allocated = AllocatedOperand::cast(*source); |
1948 switch (allocated.machine_type()) { | 1948 switch (allocated.representation()) { |
1949 case kRepFloat32: | 1949 case MachineRepresentation::kFloat32: |
1950 __ fld_s(g.ToOperand(destination)); | 1950 __ fld_s(g.ToOperand(destination)); |
1951 __ fxch(); | 1951 __ fxch(); |
1952 __ fstp_s(g.ToOperand(destination)); | 1952 __ fstp_s(g.ToOperand(destination)); |
1953 break; | 1953 break; |
1954 case kRepFloat64: | 1954 case MachineRepresentation::kFloat64: |
1955 __ fld_d(g.ToOperand(destination)); | 1955 __ fld_d(g.ToOperand(destination)); |
1956 __ fxch(); | 1956 __ fxch(); |
1957 __ fstp_d(g.ToOperand(destination)); | 1957 __ fstp_d(g.ToOperand(destination)); |
1958 break; | 1958 break; |
1959 default: | 1959 default: |
1960 UNREACHABLE(); | 1960 UNREACHABLE(); |
1961 } | 1961 } |
1962 } else if (source->IsDoubleStackSlot() && destination->IsDoubleStackSlot()) { | 1962 } else if (source->IsDoubleStackSlot() && destination->IsDoubleStackSlot()) { |
1963 auto allocated = AllocatedOperand::cast(*source); | 1963 auto allocated = AllocatedOperand::cast(*source); |
1964 switch (allocated.machine_type()) { | 1964 switch (allocated.representation()) { |
1965 case kRepFloat32: | 1965 case MachineRepresentation::kFloat32: |
1966 __ fld_s(g.ToOperand(source)); | 1966 __ fld_s(g.ToOperand(source)); |
1967 __ fld_s(g.ToOperand(destination)); | 1967 __ fld_s(g.ToOperand(destination)); |
1968 __ fstp_s(g.ToOperand(source)); | 1968 __ fstp_s(g.ToOperand(source)); |
1969 __ fstp_s(g.ToOperand(destination)); | 1969 __ fstp_s(g.ToOperand(destination)); |
1970 break; | 1970 break; |
1971 case kRepFloat64: | 1971 case MachineRepresentation::kFloat64: |
1972 __ fld_d(g.ToOperand(source)); | 1972 __ fld_d(g.ToOperand(source)); |
1973 __ fld_d(g.ToOperand(destination)); | 1973 __ fld_d(g.ToOperand(destination)); |
1974 __ fstp_d(g.ToOperand(source)); | 1974 __ fstp_d(g.ToOperand(source)); |
1975 __ fstp_d(g.ToOperand(destination)); | 1975 __ fstp_d(g.ToOperand(destination)); |
1976 break; | 1976 break; |
1977 default: | 1977 default: |
1978 UNREACHABLE(); | 1978 UNREACHABLE(); |
1979 } | 1979 } |
1980 } else { | 1980 } else { |
1981 // No other combinations are possible. | 1981 // No other combinations are possible. |
(...skipping 25 matching lines...) Expand all Loading... |
2007 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; | 2007 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; |
2008 __ Nop(padding_size); | 2008 __ Nop(padding_size); |
2009 } | 2009 } |
2010 } | 2010 } |
2011 | 2011 |
2012 #undef __ | 2012 #undef __ |
2013 | 2013 |
2014 } // namespace compiler | 2014 } // namespace compiler |
2015 } // namespace internal | 2015 } // namespace internal |
2016 } // namespace v8 | 2016 } // namespace v8 |
OLD | NEW |