OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/base/adapters.h" | 5 #include "src/base/adapters.h" |
6 #include "src/base/bits.h" | 6 #include "src/base/bits.h" |
7 #include "src/compiler/instruction-selector-impl.h" | 7 #include "src/compiler/instruction-selector-impl.h" |
8 #include "src/compiler/node-matchers.h" | 8 #include "src/compiler/node-matchers.h" |
9 #include "src/compiler/node-properties.h" | 9 #include "src/compiler/node-properties.h" |
10 | 10 |
(...skipping 1836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1847 InstructionOperand offset_operand = g.CanBeImmediate(offset, opcode) | 1847 InstructionOperand offset_operand = g.CanBeImmediate(offset, opcode) |
1848 ? g.UseImmediate(offset) | 1848 ? g.UseImmediate(offset) |
1849 : g.UseRegister(offset); | 1849 : g.UseRegister(offset); |
1850 | 1850 |
1851 InstructionOperand length_operand = (!g.CanBeImmediate(offset, opcode)) | 1851 InstructionOperand length_operand = (!g.CanBeImmediate(offset, opcode)) |
1852 ? g.CanBeImmediate(length, opcode) | 1852 ? g.CanBeImmediate(length, opcode) |
1853 ? g.UseImmediate(length) | 1853 ? g.UseImmediate(length) |
1854 : g.UseRegister(length) | 1854 : g.UseRegister(length) |
1855 : g.UseRegister(length); | 1855 : g.UseRegister(length); |
1856 | 1856 |
| 1857 if (length->opcode() == IrOpcode::kInt32Constant) { |
| 1858 Int32Matcher m(length); |
| 1859 if (m.IsPowerOf2()) { |
| 1860 Emit(opcode, g.DefineAsRegister(node), offset_operand, |
| 1861 g.UseImmediate(length), g.UseRegister(buffer)); |
| 1862 return; |
| 1863 } |
| 1864 } |
| 1865 |
1857 Emit(opcode | AddressingModeField::encode(kMode_MRI), | 1866 Emit(opcode | AddressingModeField::encode(kMode_MRI), |
1858 g.DefineAsRegister(node), offset_operand, length_operand, | 1867 g.DefineAsRegister(node), offset_operand, length_operand, |
1859 g.UseRegister(buffer)); | 1868 g.UseRegister(buffer)); |
1860 } | 1869 } |
1861 | 1870 |
1862 | 1871 |
1863 void InstructionSelector::VisitCheckedStore(Node* node) { | 1872 void InstructionSelector::VisitCheckedStore(Node* node) { |
1864 MachineRepresentation rep = CheckedStoreRepresentationOf(node->op()); | 1873 MachineRepresentation rep = CheckedStoreRepresentationOf(node->op()); |
1865 Mips64OperandGenerator g(this); | 1874 Mips64OperandGenerator g(this); |
1866 Node* const buffer = node->InputAt(0); | 1875 Node* const buffer = node->InputAt(0); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1899 InstructionOperand offset_operand = g.CanBeImmediate(offset, opcode) | 1908 InstructionOperand offset_operand = g.CanBeImmediate(offset, opcode) |
1900 ? g.UseImmediate(offset) | 1909 ? g.UseImmediate(offset) |
1901 : g.UseRegister(offset); | 1910 : g.UseRegister(offset); |
1902 | 1911 |
1903 InstructionOperand length_operand = (!g.CanBeImmediate(offset, opcode)) | 1912 InstructionOperand length_operand = (!g.CanBeImmediate(offset, opcode)) |
1904 ? g.CanBeImmediate(length, opcode) | 1913 ? g.CanBeImmediate(length, opcode) |
1905 ? g.UseImmediate(length) | 1914 ? g.UseImmediate(length) |
1906 : g.UseRegister(length) | 1915 : g.UseRegister(length) |
1907 : g.UseRegister(length); | 1916 : g.UseRegister(length); |
1908 | 1917 |
| 1918 if (length->opcode() == IrOpcode::kInt32Constant) { |
| 1919 Int32Matcher m(length); |
| 1920 if (m.IsPowerOf2()) { |
| 1921 Emit(opcode, g.NoOutput(), offset_operand, g.UseImmediate(length), |
| 1922 g.UseRegisterOrImmediateZero(value), g.UseRegister(buffer)); |
| 1923 return; |
| 1924 } |
| 1925 } |
| 1926 |
1909 Emit(opcode | AddressingModeField::encode(kMode_MRI), g.NoOutput(), | 1927 Emit(opcode | AddressingModeField::encode(kMode_MRI), g.NoOutput(), |
1910 offset_operand, length_operand, g.UseRegisterOrImmediateZero(value), | 1928 offset_operand, length_operand, g.UseRegisterOrImmediateZero(value), |
1911 g.UseRegister(buffer)); | 1929 g.UseRegister(buffer)); |
1912 } | 1930 } |
1913 | 1931 |
1914 | 1932 |
1915 namespace { | 1933 namespace { |
1916 | 1934 |
1917 // Shared routine for multiple compare operations. | 1935 // Shared routine for multiple compare operations. |
1918 static void VisitCompare(InstructionSelector* selector, InstructionCode opcode, | 1936 static void VisitCompare(InstructionSelector* selector, InstructionCode opcode, |
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2623 } else { | 2641 } else { |
2624 DCHECK(kArchVariant == kMips64r2); | 2642 DCHECK(kArchVariant == kMips64r2); |
2625 return MachineOperatorBuilder::AlignmentRequirements:: | 2643 return MachineOperatorBuilder::AlignmentRequirements:: |
2626 NoUnalignedAccessSupport(); | 2644 NoUnalignedAccessSupport(); |
2627 } | 2645 } |
2628 } | 2646 } |
2629 | 2647 |
2630 } // namespace compiler | 2648 } // namespace compiler |
2631 } // namespace internal | 2649 } // namespace internal |
2632 } // namespace v8 | 2650 } // namespace v8 |
OLD | NEW |