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

Side by Side Diff: src/compiler/arm/instruction-selector-arm.cc

Issue 2161543002: [turbofan] Add support for eager/soft deoptimization reasons. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Do the ports properly Created 4 years, 5 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 | « src/compiler/arm/code-generator-arm.cc ('k') | src/compiler/arm64/code-generator-arm64.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 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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 266
267 DCHECK_NE(0u, input_count); 267 DCHECK_NE(0u, input_count);
268 DCHECK_NE(0u, output_count); 268 DCHECK_NE(0u, output_count);
269 DCHECK_GE(arraysize(inputs), input_count); 269 DCHECK_GE(arraysize(inputs), input_count);
270 DCHECK_GE(arraysize(outputs), output_count); 270 DCHECK_GE(arraysize(outputs), output_count);
271 DCHECK_NE(kMode_None, AddressingModeField::decode(opcode)); 271 DCHECK_NE(kMode_None, AddressingModeField::decode(opcode));
272 272
273 opcode = cont->Encode(opcode); 273 opcode = cont->Encode(opcode);
274 if (cont->IsDeoptimize()) { 274 if (cont->IsDeoptimize()) {
275 selector->EmitDeoptimize(opcode, output_count, outputs, input_count, inputs, 275 selector->EmitDeoptimize(opcode, output_count, outputs, input_count, inputs,
276 cont->frame_state()); 276 cont->reason(), cont->frame_state());
277 } else { 277 } else {
278 selector->Emit(opcode, output_count, outputs, input_count, inputs); 278 selector->Emit(opcode, output_count, outputs, input_count, inputs);
279 } 279 }
280 } 280 }
281 281
282 282
283 void VisitBinop(InstructionSelector* selector, Node* node, 283 void VisitBinop(InstructionSelector* selector, Node* node,
284 InstructionCode opcode, InstructionCode reverse_opcode) { 284 InstructionCode opcode, InstructionCode reverse_opcode) {
285 FlagsContinuation cont; 285 FlagsContinuation cont;
286 VisitBinop(selector, node, opcode, reverse_opcode, &cont); 286 VisitBinop(selector, node, opcode, reverse_opcode, &cont);
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
751 751
752 DCHECK_NE(0u, input_count); 752 DCHECK_NE(0u, input_count);
753 DCHECK_NE(0u, output_count); 753 DCHECK_NE(0u, output_count);
754 DCHECK_GE(arraysize(inputs), input_count); 754 DCHECK_GE(arraysize(inputs), input_count);
755 DCHECK_GE(arraysize(outputs), output_count); 755 DCHECK_GE(arraysize(outputs), output_count);
756 DCHECK_NE(kMode_None, AddressingModeField::decode(opcode)); 756 DCHECK_NE(kMode_None, AddressingModeField::decode(opcode));
757 757
758 opcode = cont->Encode(opcode); 758 opcode = cont->Encode(opcode);
759 if (cont->IsDeoptimize()) { 759 if (cont->IsDeoptimize()) {
760 selector->EmitDeoptimize(opcode, output_count, outputs, input_count, inputs, 760 selector->EmitDeoptimize(opcode, output_count, outputs, input_count, inputs,
761 cont->frame_state()); 761 cont->reason(), cont->frame_state());
762 } else { 762 } else {
763 selector->Emit(opcode, output_count, outputs, input_count, inputs); 763 selector->Emit(opcode, output_count, outputs, input_count, inputs);
764 } 764 }
765 } 765 }
766 766
767 767
768 template <typename TryMatchShift> 768 template <typename TryMatchShift>
769 void VisitShift(InstructionSelector* selector, Node* node, 769 void VisitShift(InstructionSelector* selector, Node* node,
770 TryMatchShift try_match_shift) { 770 TryMatchShift try_match_shift) {
771 FlagsContinuation cont; 771 FlagsContinuation cont;
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
1108 1108
1109 // result operand needs shift operator. 1109 // result operand needs shift operator.
1110 InstructionOperand shift_31 = g.UseImmediate(31); 1110 InstructionOperand shift_31 = g.UseImmediate(31);
1111 InstructionCode opcode = cont->Encode(kArmCmp) | 1111 InstructionCode opcode = cont->Encode(kArmCmp) |
1112 AddressingModeField::encode(kMode_Operand2_R_ASR_I); 1112 AddressingModeField::encode(kMode_Operand2_R_ASR_I);
1113 if (cont->IsBranch()) { 1113 if (cont->IsBranch()) {
1114 selector->Emit(opcode, g.NoOutput(), temp_operand, result_operand, shift_31, 1114 selector->Emit(opcode, g.NoOutput(), temp_operand, result_operand, shift_31,
1115 g.Label(cont->true_block()), g.Label(cont->false_block())); 1115 g.Label(cont->true_block()), g.Label(cont->false_block()));
1116 } else if (cont->IsDeoptimize()) { 1116 } else if (cont->IsDeoptimize()) {
1117 InstructionOperand in[] = {temp_operand, result_operand, shift_31}; 1117 InstructionOperand in[] = {temp_operand, result_operand, shift_31};
1118 selector->EmitDeoptimize(opcode, 0, nullptr, 3, in, cont->frame_state()); 1118 selector->EmitDeoptimize(opcode, 0, nullptr, 3, in, cont->reason(),
1119 cont->frame_state());
1119 } else { 1120 } else {
1120 DCHECK(cont->IsSet()); 1121 DCHECK(cont->IsSet());
1121 selector->Emit(opcode, g.DefineAsRegister(cont->result()), temp_operand, 1122 selector->Emit(opcode, g.DefineAsRegister(cont->result()), temp_operand,
1122 result_operand, shift_31); 1123 result_operand, shift_31);
1123 } 1124 }
1124 } 1125 }
1125 1126
1126 } // namespace 1127 } // namespace
1127 1128
1128 void InstructionSelector::VisitInt32Mul(Node* node) { 1129 void InstructionSelector::VisitInt32Mul(Node* node) {
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
1539 // Shared routine for multiple compare operations. 1540 // Shared routine for multiple compare operations.
1540 void VisitCompare(InstructionSelector* selector, InstructionCode opcode, 1541 void VisitCompare(InstructionSelector* selector, InstructionCode opcode,
1541 InstructionOperand left, InstructionOperand right, 1542 InstructionOperand left, InstructionOperand right,
1542 FlagsContinuation* cont) { 1543 FlagsContinuation* cont) {
1543 ArmOperandGenerator g(selector); 1544 ArmOperandGenerator g(selector);
1544 opcode = cont->Encode(opcode); 1545 opcode = cont->Encode(opcode);
1545 if (cont->IsBranch()) { 1546 if (cont->IsBranch()) {
1546 selector->Emit(opcode, g.NoOutput(), left, right, 1547 selector->Emit(opcode, g.NoOutput(), left, right,
1547 g.Label(cont->true_block()), g.Label(cont->false_block())); 1548 g.Label(cont->true_block()), g.Label(cont->false_block()));
1548 } else if (cont->IsDeoptimize()) { 1549 } else if (cont->IsDeoptimize()) {
1549 selector->EmitDeoptimize(opcode, g.NoOutput(), left, right, 1550 selector->EmitDeoptimize(opcode, g.NoOutput(), left, right, cont->reason(),
1550 cont->frame_state()); 1551 cont->frame_state());
1551 } else { 1552 } else {
1552 DCHECK(cont->IsSet()); 1553 DCHECK(cont->IsSet());
1553 selector->Emit(opcode, g.DefineAsRegister(cont->result()), left, right); 1554 selector->Emit(opcode, g.DefineAsRegister(cont->result()), left, right);
1554 } 1555 }
1555 } 1556 }
1556 1557
1557 1558
1558 // Shared routine for multiple float32 compare operations. 1559 // Shared routine for multiple float32 compare operations.
1559 void VisitFloat32Compare(InstructionSelector* selector, Node* node, 1560 void VisitFloat32Compare(InstructionSelector* selector, Node* node,
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
1625 outputs[output_count++] = g.DefineAsRegister(cont->result()); 1626 outputs[output_count++] = g.DefineAsRegister(cont->result());
1626 } 1627 }
1627 1628
1628 DCHECK_NE(0u, input_count); 1629 DCHECK_NE(0u, input_count);
1629 DCHECK_GE(arraysize(inputs), input_count); 1630 DCHECK_GE(arraysize(inputs), input_count);
1630 DCHECK_GE(arraysize(outputs), output_count); 1631 DCHECK_GE(arraysize(outputs), output_count);
1631 1632
1632 opcode = cont->Encode(opcode); 1633 opcode = cont->Encode(opcode);
1633 if (cont->IsDeoptimize()) { 1634 if (cont->IsDeoptimize()) {
1634 selector->EmitDeoptimize(opcode, output_count, outputs, input_count, inputs, 1635 selector->EmitDeoptimize(opcode, output_count, outputs, input_count, inputs,
1635 cont->frame_state()); 1636 cont->reason(), cont->frame_state());
1636 } else { 1637 } else {
1637 selector->Emit(opcode, output_count, outputs, input_count, inputs); 1638 selector->Emit(opcode, output_count, outputs, input_count, inputs);
1638 } 1639 }
1639 } 1640 }
1640 1641
1641 1642
1642 void VisitWordCompare(InstructionSelector* selector, Node* node, 1643 void VisitWordCompare(InstructionSelector* selector, Node* node,
1643 FlagsContinuation* cont) { 1644 FlagsContinuation* cont) {
1644 VisitWordCompare(selector, node, kArmCmp, cont); 1645 VisitWordCompare(selector, node, kArmCmp, cont);
1645 } 1646 }
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
1752 // Continuation could not be combined with a compare, emit compare against 0. 1753 // Continuation could not be combined with a compare, emit compare against 0.
1753 ArmOperandGenerator g(selector); 1754 ArmOperandGenerator g(selector);
1754 InstructionCode const opcode = 1755 InstructionCode const opcode =
1755 cont->Encode(kArmTst) | AddressingModeField::encode(kMode_Operand2_R); 1756 cont->Encode(kArmTst) | AddressingModeField::encode(kMode_Operand2_R);
1756 InstructionOperand const value_operand = g.UseRegister(value); 1757 InstructionOperand const value_operand = g.UseRegister(value);
1757 if (cont->IsBranch()) { 1758 if (cont->IsBranch()) {
1758 selector->Emit(opcode, g.NoOutput(), value_operand, value_operand, 1759 selector->Emit(opcode, g.NoOutput(), value_operand, value_operand,
1759 g.Label(cont->true_block()), g.Label(cont->false_block())); 1760 g.Label(cont->true_block()), g.Label(cont->false_block()));
1760 } else if (cont->IsDeoptimize()) { 1761 } else if (cont->IsDeoptimize()) {
1761 selector->EmitDeoptimize(opcode, g.NoOutput(), value_operand, value_operand, 1762 selector->EmitDeoptimize(opcode, g.NoOutput(), value_operand, value_operand,
1762 cont->frame_state()); 1763 cont->reason(), cont->frame_state());
1763 } else { 1764 } else {
1764 DCHECK(cont->IsSet()); 1765 DCHECK(cont->IsSet());
1765 selector->Emit(opcode, g.DefineAsRegister(cont->result()), value_operand, 1766 selector->Emit(opcode, g.DefineAsRegister(cont->result()), value_operand,
1766 value_operand); 1767 value_operand);
1767 } 1768 }
1768 } 1769 }
1769 1770
1770 } // namespace 1771 } // namespace
1771 1772
1772 void InstructionSelector::VisitBranch(Node* branch, BasicBlock* tbranch, 1773 void InstructionSelector::VisitBranch(Node* branch, BasicBlock* tbranch,
1773 BasicBlock* fbranch) { 1774 BasicBlock* fbranch) {
1774 FlagsContinuation cont(kNotEqual, tbranch, fbranch); 1775 FlagsContinuation cont(kNotEqual, tbranch, fbranch);
1775 VisitWordCompareZero(this, branch, branch->InputAt(0), &cont); 1776 VisitWordCompareZero(this, branch, branch->InputAt(0), &cont);
1776 } 1777 }
1777 1778
1778 void InstructionSelector::VisitDeoptimizeIf(Node* node) { 1779 void InstructionSelector::VisitDeoptimizeIf(Node* node) {
1779 FlagsContinuation cont = 1780 FlagsContinuation cont = FlagsContinuation::ForDeoptimize(
1780 FlagsContinuation::ForDeoptimize(kNotEqual, node->InputAt(1)); 1781 kNotEqual, DeoptimizeReasonOf(node->op()), node->InputAt(1));
1781 VisitWordCompareZero(this, node, node->InputAt(0), &cont); 1782 VisitWordCompareZero(this, node, node->InputAt(0), &cont);
1782 } 1783 }
1783 1784
1784 void InstructionSelector::VisitDeoptimizeUnless(Node* node) { 1785 void InstructionSelector::VisitDeoptimizeUnless(Node* node) {
1785 FlagsContinuation cont = 1786 FlagsContinuation cont = FlagsContinuation::ForDeoptimize(
1786 FlagsContinuation::ForDeoptimize(kEqual, node->InputAt(1)); 1787 kEqual, DeoptimizeReasonOf(node->op()), node->InputAt(1));
1787 VisitWordCompareZero(this, node, node->InputAt(0), &cont); 1788 VisitWordCompareZero(this, node, node->InputAt(0), &cont);
1788 } 1789 }
1789 1790
1790 void InstructionSelector::VisitSwitch(Node* node, const SwitchInfo& sw) { 1791 void InstructionSelector::VisitSwitch(Node* node, const SwitchInfo& sw) {
1791 ArmOperandGenerator g(this); 1792 ArmOperandGenerator g(this);
1792 InstructionOperand value_operand = g.UseRegister(node->InputAt(0)); 1793 InstructionOperand value_operand = g.UseRegister(node->InputAt(0));
1793 1794
1794 // Emit either ArchTableSwitch or ArchLookupSwitch. 1795 // Emit either ArchTableSwitch or ArchLookupSwitch.
1795 size_t table_space_cost = 4 + sw.value_range; 1796 size_t table_space_cost = 4 + sw.value_range;
1796 size_t table_time_cost = 3; 1797 size_t table_time_cost = 3;
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
2053 // static 2054 // static
2054 MachineOperatorBuilder::AlignmentRequirements 2055 MachineOperatorBuilder::AlignmentRequirements
2055 InstructionSelector::AlignmentRequirements() { 2056 InstructionSelector::AlignmentRequirements() {
2056 return MachineOperatorBuilder::AlignmentRequirements:: 2057 return MachineOperatorBuilder::AlignmentRequirements::
2057 FullUnalignedAccessSupport(); 2058 FullUnalignedAccessSupport();
2058 } 2059 }
2059 2060
2060 } // namespace compiler 2061 } // namespace compiler
2061 } // namespace internal 2062 } // namespace internal
2062 } // namespace v8 2063 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/arm/code-generator-arm.cc ('k') | src/compiler/arm64/code-generator-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698