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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 | 273 |
274 DCHECK_NE(0u, input_count); | 274 DCHECK_NE(0u, input_count); |
275 DCHECK_NE(0u, output_count); | 275 DCHECK_NE(0u, output_count); |
276 DCHECK_GE(arraysize(inputs), input_count); | 276 DCHECK_GE(arraysize(inputs), input_count); |
277 DCHECK_GE(arraysize(outputs), output_count); | 277 DCHECK_GE(arraysize(outputs), output_count); |
278 DCHECK_NE(kMode_None, AddressingModeField::decode(opcode)); | 278 DCHECK_NE(kMode_None, AddressingModeField::decode(opcode)); |
279 | 279 |
280 opcode = cont->Encode(opcode); | 280 opcode = cont->Encode(opcode); |
281 if (cont->IsDeoptimize()) { | 281 if (cont->IsDeoptimize()) { |
282 selector->EmitDeoptimize(opcode, output_count, outputs, input_count, inputs, | 282 selector->EmitDeoptimize(opcode, output_count, outputs, input_count, inputs, |
283 cont->kind(), cont->reason(), cont->frame_state()); | 283 cont->reason(), cont->frame_state()); |
284 } else if (cont->IsTrap()) { | 284 } else if (cont->IsTrap()) { |
285 inputs[input_count++] = g.UseImmediate(cont->trap_id()); | 285 inputs[input_count++] = g.UseImmediate(cont->trap_id()); |
286 selector->Emit(opcode, output_count, outputs, input_count, inputs); | 286 selector->Emit(opcode, output_count, outputs, input_count, inputs); |
287 } else { | 287 } else { |
288 selector->Emit(opcode, output_count, outputs, input_count, inputs); | 288 selector->Emit(opcode, output_count, outputs, input_count, inputs); |
289 } | 289 } |
290 } | 290 } |
291 | 291 |
292 | 292 |
293 void VisitBinop(InstructionSelector* selector, Node* node, | 293 void VisitBinop(InstructionSelector* selector, Node* node, |
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
899 | 899 |
900 DCHECK_NE(0u, input_count); | 900 DCHECK_NE(0u, input_count); |
901 DCHECK_NE(0u, output_count); | 901 DCHECK_NE(0u, output_count); |
902 DCHECK_GE(arraysize(inputs), input_count); | 902 DCHECK_GE(arraysize(inputs), input_count); |
903 DCHECK_GE(arraysize(outputs), output_count); | 903 DCHECK_GE(arraysize(outputs), output_count); |
904 DCHECK_NE(kMode_None, AddressingModeField::decode(opcode)); | 904 DCHECK_NE(kMode_None, AddressingModeField::decode(opcode)); |
905 | 905 |
906 opcode = cont->Encode(opcode); | 906 opcode = cont->Encode(opcode); |
907 if (cont->IsDeoptimize()) { | 907 if (cont->IsDeoptimize()) { |
908 selector->EmitDeoptimize(opcode, output_count, outputs, input_count, inputs, | 908 selector->EmitDeoptimize(opcode, output_count, outputs, input_count, inputs, |
909 cont->kind(), cont->reason(), cont->frame_state()); | 909 cont->reason(), cont->frame_state()); |
910 } else if (cont->IsTrap()) { | 910 } else if (cont->IsTrap()) { |
911 inputs[input_count++] = g.UseImmediate(cont->trap_id()); | 911 inputs[input_count++] = g.UseImmediate(cont->trap_id()); |
912 selector->Emit(opcode, output_count, outputs, input_count, inputs); | 912 selector->Emit(opcode, output_count, outputs, input_count, inputs); |
913 } else { | 913 } else { |
914 selector->Emit(opcode, output_count, outputs, input_count, inputs); | 914 selector->Emit(opcode, output_count, outputs, input_count, inputs); |
915 } | 915 } |
916 } | 916 } |
917 | 917 |
918 | 918 |
919 template <typename TryMatchShift> | 919 template <typename TryMatchShift> |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1261 | 1261 |
1262 // result operand needs shift operator. | 1262 // result operand needs shift operator. |
1263 InstructionOperand shift_31 = g.UseImmediate(31); | 1263 InstructionOperand shift_31 = g.UseImmediate(31); |
1264 InstructionCode opcode = cont->Encode(kArmCmp) | | 1264 InstructionCode opcode = cont->Encode(kArmCmp) | |
1265 AddressingModeField::encode(kMode_Operand2_R_ASR_I); | 1265 AddressingModeField::encode(kMode_Operand2_R_ASR_I); |
1266 if (cont->IsBranch()) { | 1266 if (cont->IsBranch()) { |
1267 selector->Emit(opcode, g.NoOutput(), temp_operand, result_operand, shift_31, | 1267 selector->Emit(opcode, g.NoOutput(), temp_operand, result_operand, shift_31, |
1268 g.Label(cont->true_block()), g.Label(cont->false_block())); | 1268 g.Label(cont->true_block()), g.Label(cont->false_block())); |
1269 } else if (cont->IsDeoptimize()) { | 1269 } else if (cont->IsDeoptimize()) { |
1270 InstructionOperand in[] = {temp_operand, result_operand, shift_31}; | 1270 InstructionOperand in[] = {temp_operand, result_operand, shift_31}; |
1271 selector->EmitDeoptimize(opcode, 0, nullptr, 3, in, cont->kind(), | 1271 selector->EmitDeoptimize(opcode, 0, nullptr, 3, in, cont->reason(), |
1272 cont->reason(), cont->frame_state()); | 1272 cont->frame_state()); |
1273 } else if (cont->IsSet()) { | 1273 } else if (cont->IsSet()) { |
1274 selector->Emit(opcode, g.DefineAsRegister(cont->result()), temp_operand, | 1274 selector->Emit(opcode, g.DefineAsRegister(cont->result()), temp_operand, |
1275 result_operand, shift_31); | 1275 result_operand, shift_31); |
1276 } else { | 1276 } else { |
1277 DCHECK(cont->IsTrap()); | 1277 DCHECK(cont->IsTrap()); |
1278 InstructionOperand in[] = {temp_operand, result_operand, shift_31, | 1278 InstructionOperand in[] = {temp_operand, result_operand, shift_31, |
1279 g.UseImmediate(cont->trap_id())}; | 1279 g.UseImmediate(cont->trap_id())}; |
1280 selector->Emit(opcode, 0, nullptr, 4, in); | 1280 selector->Emit(opcode, 0, nullptr, 4, in); |
1281 } | 1281 } |
1282 } | 1282 } |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1533 // Shared routine for multiple compare operations. | 1533 // Shared routine for multiple compare operations. |
1534 void VisitCompare(InstructionSelector* selector, InstructionCode opcode, | 1534 void VisitCompare(InstructionSelector* selector, InstructionCode opcode, |
1535 InstructionOperand left, InstructionOperand right, | 1535 InstructionOperand left, InstructionOperand right, |
1536 FlagsContinuation* cont) { | 1536 FlagsContinuation* cont) { |
1537 ArmOperandGenerator g(selector); | 1537 ArmOperandGenerator g(selector); |
1538 opcode = cont->Encode(opcode); | 1538 opcode = cont->Encode(opcode); |
1539 if (cont->IsBranch()) { | 1539 if (cont->IsBranch()) { |
1540 selector->Emit(opcode, g.NoOutput(), left, right, | 1540 selector->Emit(opcode, g.NoOutput(), left, right, |
1541 g.Label(cont->true_block()), g.Label(cont->false_block())); | 1541 g.Label(cont->true_block()), g.Label(cont->false_block())); |
1542 } else if (cont->IsDeoptimize()) { | 1542 } else if (cont->IsDeoptimize()) { |
1543 selector->EmitDeoptimize(opcode, g.NoOutput(), left, right, cont->kind(), | 1543 selector->EmitDeoptimize(opcode, g.NoOutput(), left, right, cont->reason(), |
1544 cont->reason(), cont->frame_state()); | 1544 cont->frame_state()); |
1545 } else if (cont->IsSet()) { | 1545 } else if (cont->IsSet()) { |
1546 selector->Emit(opcode, g.DefineAsRegister(cont->result()), left, right); | 1546 selector->Emit(opcode, g.DefineAsRegister(cont->result()), left, right); |
1547 } else { | 1547 } else { |
1548 DCHECK(cont->IsTrap()); | 1548 DCHECK(cont->IsTrap()); |
1549 selector->Emit(opcode, g.NoOutput(), left, right, | 1549 selector->Emit(opcode, g.NoOutput(), left, right, |
1550 g.UseImmediate(cont->trap_id())); | 1550 g.UseImmediate(cont->trap_id())); |
1551 } | 1551 } |
1552 } | 1552 } |
1553 | 1553 |
1554 | 1554 |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1730 outputs[output_count++] = g.DefineAsRegister(cont->result()); | 1730 outputs[output_count++] = g.DefineAsRegister(cont->result()); |
1731 } | 1731 } |
1732 | 1732 |
1733 DCHECK_NE(0u, input_count); | 1733 DCHECK_NE(0u, input_count); |
1734 DCHECK_GE(arraysize(inputs), input_count); | 1734 DCHECK_GE(arraysize(inputs), input_count); |
1735 DCHECK_GE(arraysize(outputs), output_count); | 1735 DCHECK_GE(arraysize(outputs), output_count); |
1736 | 1736 |
1737 opcode = cont->Encode(opcode); | 1737 opcode = cont->Encode(opcode); |
1738 if (cont->IsDeoptimize()) { | 1738 if (cont->IsDeoptimize()) { |
1739 selector->EmitDeoptimize(opcode, output_count, outputs, input_count, inputs, | 1739 selector->EmitDeoptimize(opcode, output_count, outputs, input_count, inputs, |
1740 cont->kind(), cont->reason(), cont->frame_state()); | 1740 cont->reason(), cont->frame_state()); |
1741 } else if (cont->IsTrap()) { | 1741 } else if (cont->IsTrap()) { |
1742 inputs[input_count++] = g.UseImmediate(cont->trap_id()); | 1742 inputs[input_count++] = g.UseImmediate(cont->trap_id()); |
1743 selector->Emit(opcode, output_count, outputs, input_count, inputs); | 1743 selector->Emit(opcode, output_count, outputs, input_count, inputs); |
1744 } else { | 1744 } else { |
1745 selector->Emit(opcode, output_count, outputs, input_count, inputs); | 1745 selector->Emit(opcode, output_count, outputs, input_count, inputs); |
1746 } | 1746 } |
1747 } | 1747 } |
1748 | 1748 |
1749 | 1749 |
1750 void VisitWordCompare(InstructionSelector* selector, Node* node, | 1750 void VisitWordCompare(InstructionSelector* selector, Node* node, |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1889 // Continuation could not be combined with a compare, emit compare against 0. | 1889 // Continuation could not be combined with a compare, emit compare against 0. |
1890 ArmOperandGenerator g(selector); | 1890 ArmOperandGenerator g(selector); |
1891 InstructionCode const opcode = | 1891 InstructionCode const opcode = |
1892 cont->Encode(kArmTst) | AddressingModeField::encode(kMode_Operand2_R); | 1892 cont->Encode(kArmTst) | AddressingModeField::encode(kMode_Operand2_R); |
1893 InstructionOperand const value_operand = g.UseRegister(value); | 1893 InstructionOperand const value_operand = g.UseRegister(value); |
1894 if (cont->IsBranch()) { | 1894 if (cont->IsBranch()) { |
1895 selector->Emit(opcode, g.NoOutput(), value_operand, value_operand, | 1895 selector->Emit(opcode, g.NoOutput(), value_operand, value_operand, |
1896 g.Label(cont->true_block()), g.Label(cont->false_block())); | 1896 g.Label(cont->true_block()), g.Label(cont->false_block())); |
1897 } else if (cont->IsDeoptimize()) { | 1897 } else if (cont->IsDeoptimize()) { |
1898 selector->EmitDeoptimize(opcode, g.NoOutput(), value_operand, value_operand, | 1898 selector->EmitDeoptimize(opcode, g.NoOutput(), value_operand, value_operand, |
1899 cont->kind(), cont->reason(), cont->frame_state()); | 1899 cont->reason(), cont->frame_state()); |
1900 } else if (cont->IsSet()) { | 1900 } else if (cont->IsSet()) { |
1901 selector->Emit(opcode, g.DefineAsRegister(cont->result()), value_operand, | 1901 selector->Emit(opcode, g.DefineAsRegister(cont->result()), value_operand, |
1902 value_operand); | 1902 value_operand); |
1903 } else { | 1903 } else { |
1904 DCHECK(cont->IsTrap()); | 1904 DCHECK(cont->IsTrap()); |
1905 selector->Emit(opcode, g.NoOutput(), value_operand, value_operand, | 1905 selector->Emit(opcode, g.NoOutput(), value_operand, value_operand, |
1906 g.UseImmediate(cont->trap_id())); | 1906 g.UseImmediate(cont->trap_id())); |
1907 } | 1907 } |
1908 } | 1908 } |
1909 | 1909 |
1910 } // namespace | 1910 } // namespace |
1911 | 1911 |
1912 void InstructionSelector::VisitBranch(Node* branch, BasicBlock* tbranch, | 1912 void InstructionSelector::VisitBranch(Node* branch, BasicBlock* tbranch, |
1913 BasicBlock* fbranch) { | 1913 BasicBlock* fbranch) { |
1914 FlagsContinuation cont(kNotEqual, tbranch, fbranch); | 1914 FlagsContinuation cont(kNotEqual, tbranch, fbranch); |
1915 VisitWordCompareZero(this, branch, branch->InputAt(0), &cont); | 1915 VisitWordCompareZero(this, branch, branch->InputAt(0), &cont); |
1916 } | 1916 } |
1917 | 1917 |
1918 void InstructionSelector::VisitDeoptimizeIf(Node* node) { | 1918 void InstructionSelector::VisitDeoptimizeIf(Node* node) { |
1919 DeoptimizeParameters p = DeoptimizeParametersOf(node->op()); | |
1920 FlagsContinuation cont = FlagsContinuation::ForDeoptimize( | 1919 FlagsContinuation cont = FlagsContinuation::ForDeoptimize( |
1921 kNotEqual, p.kind(), p.reason(), node->InputAt(1)); | 1920 kNotEqual, DeoptimizeReasonOf(node->op()), node->InputAt(1)); |
1922 VisitWordCompareZero(this, node, node->InputAt(0), &cont); | 1921 VisitWordCompareZero(this, node, node->InputAt(0), &cont); |
1923 } | 1922 } |
1924 | 1923 |
1925 void InstructionSelector::VisitDeoptimizeUnless(Node* node) { | 1924 void InstructionSelector::VisitDeoptimizeUnless(Node* node) { |
1926 DeoptimizeParameters p = DeoptimizeParametersOf(node->op()); | |
1927 FlagsContinuation cont = FlagsContinuation::ForDeoptimize( | 1925 FlagsContinuation cont = FlagsContinuation::ForDeoptimize( |
1928 kEqual, p.kind(), p.reason(), node->InputAt(1)); | 1926 kEqual, DeoptimizeReasonOf(node->op()), node->InputAt(1)); |
1929 VisitWordCompareZero(this, node, node->InputAt(0), &cont); | 1927 VisitWordCompareZero(this, node, node->InputAt(0), &cont); |
1930 } | 1928 } |
1931 | 1929 |
1932 void InstructionSelector::VisitTrapIf(Node* node, Runtime::FunctionId func_id) { | 1930 void InstructionSelector::VisitTrapIf(Node* node, Runtime::FunctionId func_id) { |
1933 FlagsContinuation cont = | 1931 FlagsContinuation cont = |
1934 FlagsContinuation::ForTrap(kNotEqual, func_id, node->InputAt(1)); | 1932 FlagsContinuation::ForTrap(kNotEqual, func_id, node->InputAt(1)); |
1935 VisitWordCompareZero(this, node, node->InputAt(0), &cont); | 1933 VisitWordCompareZero(this, node, node->InputAt(0), &cont); |
1936 } | 1934 } |
1937 | 1935 |
1938 void InstructionSelector::VisitTrapUnless(Node* node, | 1936 void InstructionSelector::VisitTrapUnless(Node* node, |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2324 Vector<MachineType> req_aligned = Vector<MachineType>::New(2); | 2322 Vector<MachineType> req_aligned = Vector<MachineType>::New(2); |
2325 req_aligned[0] = MachineType::Float32(); | 2323 req_aligned[0] = MachineType::Float32(); |
2326 req_aligned[1] = MachineType::Float64(); | 2324 req_aligned[1] = MachineType::Float64(); |
2327 return MachineOperatorBuilder::AlignmentRequirements:: | 2325 return MachineOperatorBuilder::AlignmentRequirements:: |
2328 SomeUnalignedAccessUnsupported(req_aligned, req_aligned); | 2326 SomeUnalignedAccessUnsupported(req_aligned, req_aligned); |
2329 } | 2327 } |
2330 | 2328 |
2331 } // namespace compiler | 2329 } // namespace compiler |
2332 } // namespace internal | 2330 } // namespace internal |
2333 } // namespace v8 | 2331 } // namespace v8 |
OLD | NEW |