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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 } | 117 } |
118 | 118 |
119 DCHECK_NE(0u, input_count); | 119 DCHECK_NE(0u, input_count); |
120 DCHECK_NE(0u, output_count); | 120 DCHECK_NE(0u, output_count); |
121 DCHECK_GE(arraysize(inputs), input_count); | 121 DCHECK_GE(arraysize(inputs), input_count); |
122 DCHECK_GE(arraysize(outputs), output_count); | 122 DCHECK_GE(arraysize(outputs), output_count); |
123 | 123 |
124 opcode = cont->Encode(opcode); | 124 opcode = cont->Encode(opcode); |
125 if (cont->IsDeoptimize()) { | 125 if (cont->IsDeoptimize()) { |
126 selector->EmitDeoptimize(opcode, output_count, outputs, input_count, inputs, | 126 selector->EmitDeoptimize(opcode, output_count, outputs, input_count, inputs, |
127 cont->frame_state()); | 127 cont->reason(), cont->frame_state()); |
128 } else { | 128 } else { |
129 selector->Emit(opcode, output_count, outputs, input_count, inputs); | 129 selector->Emit(opcode, output_count, outputs, input_count, inputs); |
130 } | 130 } |
131 } | 131 } |
132 | 132 |
133 | 133 |
134 static void VisitBinop(InstructionSelector* selector, Node* node, | 134 static void VisitBinop(InstructionSelector* selector, Node* node, |
135 InstructionCode opcode) { | 135 InstructionCode opcode) { |
136 FlagsContinuation cont; | 136 FlagsContinuation cont; |
137 VisitBinop(selector, node, opcode, &cont); | 137 VisitBinop(selector, node, opcode, &cont); |
(...skipping 955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1093 // Shared routine for multiple compare operations. | 1093 // Shared routine for multiple compare operations. |
1094 static void VisitCompare(InstructionSelector* selector, InstructionCode opcode, | 1094 static void VisitCompare(InstructionSelector* selector, InstructionCode opcode, |
1095 InstructionOperand left, InstructionOperand right, | 1095 InstructionOperand left, InstructionOperand right, |
1096 FlagsContinuation* cont) { | 1096 FlagsContinuation* cont) { |
1097 MipsOperandGenerator g(selector); | 1097 MipsOperandGenerator g(selector); |
1098 opcode = cont->Encode(opcode); | 1098 opcode = cont->Encode(opcode); |
1099 if (cont->IsBranch()) { | 1099 if (cont->IsBranch()) { |
1100 selector->Emit(opcode, g.NoOutput(), left, right, | 1100 selector->Emit(opcode, g.NoOutput(), left, right, |
1101 g.Label(cont->true_block()), g.Label(cont->false_block())); | 1101 g.Label(cont->true_block()), g.Label(cont->false_block())); |
1102 } else if (cont->IsDeoptimize()) { | 1102 } else if (cont->IsDeoptimize()) { |
1103 selector->EmitDeoptimize(opcode, g.NoOutput(), left, right, | 1103 selector->EmitDeoptimize(opcode, g.NoOutput(), left, right, cont->reason(), |
1104 cont->frame_state()); | 1104 cont->frame_state()); |
1105 } else { | 1105 } else { |
1106 DCHECK(cont->IsSet()); | 1106 DCHECK(cont->IsSet()); |
1107 selector->Emit(opcode, g.DefineAsRegister(cont->result()), left, right); | 1107 selector->Emit(opcode, g.DefineAsRegister(cont->result()), left, right); |
1108 } | 1108 } |
1109 } | 1109 } |
1110 | 1110 |
1111 | 1111 |
1112 // Shared routine for multiple float32 compare operations. | 1112 // Shared routine for multiple float32 compare operations. |
1113 void VisitFloat32Compare(InstructionSelector* selector, Node* node, | 1113 void VisitFloat32Compare(InstructionSelector* selector, Node* node, |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1293 | 1293 |
1294 // Continuation could not be combined with a compare, emit compare against 0. | 1294 // Continuation could not be combined with a compare, emit compare against 0. |
1295 MipsOperandGenerator g(selector); | 1295 MipsOperandGenerator g(selector); |
1296 InstructionCode const opcode = cont->Encode(kMipsCmp); | 1296 InstructionCode const opcode = cont->Encode(kMipsCmp); |
1297 InstructionOperand const value_operand = g.UseRegister(value); | 1297 InstructionOperand const value_operand = g.UseRegister(value); |
1298 if (cont->IsBranch()) { | 1298 if (cont->IsBranch()) { |
1299 selector->Emit(opcode, g.NoOutput(), value_operand, g.TempImmediate(0), | 1299 selector->Emit(opcode, g.NoOutput(), value_operand, g.TempImmediate(0), |
1300 g.Label(cont->true_block()), g.Label(cont->false_block())); | 1300 g.Label(cont->true_block()), g.Label(cont->false_block())); |
1301 } else if (cont->IsDeoptimize()) { | 1301 } else if (cont->IsDeoptimize()) { |
1302 selector->EmitDeoptimize(opcode, g.NoOutput(), value_operand, | 1302 selector->EmitDeoptimize(opcode, g.NoOutput(), value_operand, |
1303 g.TempImmediate(0), cont->frame_state()); | 1303 g.TempImmediate(0), cont->reason(), |
| 1304 cont->frame_state()); |
1304 } else { | 1305 } else { |
1305 DCHECK(cont->IsSet()); | 1306 DCHECK(cont->IsSet()); |
1306 selector->Emit(opcode, g.DefineAsRegister(cont->result()), value_operand, | 1307 selector->Emit(opcode, g.DefineAsRegister(cont->result()), value_operand, |
1307 g.TempImmediate(0)); | 1308 g.TempImmediate(0)); |
1308 } | 1309 } |
1309 } | 1310 } |
1310 | 1311 |
1311 } // namespace | 1312 } // namespace |
1312 | 1313 |
1313 void InstructionSelector::VisitBranch(Node* branch, BasicBlock* tbranch, | 1314 void InstructionSelector::VisitBranch(Node* branch, BasicBlock* tbranch, |
1314 BasicBlock* fbranch) { | 1315 BasicBlock* fbranch) { |
1315 FlagsContinuation cont(kNotEqual, tbranch, fbranch); | 1316 FlagsContinuation cont(kNotEqual, tbranch, fbranch); |
1316 VisitWordCompareZero(this, branch, branch->InputAt(0), &cont); | 1317 VisitWordCompareZero(this, branch, branch->InputAt(0), &cont); |
1317 } | 1318 } |
1318 | 1319 |
1319 void InstructionSelector::VisitDeoptimizeIf(Node* node) { | 1320 void InstructionSelector::VisitDeoptimizeIf(Node* node) { |
1320 FlagsContinuation cont = | 1321 FlagsContinuation cont = FlagsContinuation::ForDeoptimize( |
1321 FlagsContinuation::ForDeoptimize(kNotEqual, node->InputAt(1)); | 1322 kNotEqual, DeoptimizeReasonOf(node->op()), node->InputAt(1)); |
1322 VisitWordCompareZero(this, node, node->InputAt(0), &cont); | 1323 VisitWordCompareZero(this, node, node->InputAt(0), &cont); |
1323 } | 1324 } |
1324 | 1325 |
1325 void InstructionSelector::VisitDeoptimizeUnless(Node* node) { | 1326 void InstructionSelector::VisitDeoptimizeUnless(Node* node) { |
1326 FlagsContinuation cont = | 1327 FlagsContinuation cont = FlagsContinuation::ForDeoptimize( |
1327 FlagsContinuation::ForDeoptimize(kEqual, node->InputAt(1)); | 1328 kEqual, DeoptimizeReasonOf(node->op()), node->InputAt(1)); |
1328 VisitWordCompareZero(this, node, node->InputAt(0), &cont); | 1329 VisitWordCompareZero(this, node, node->InputAt(0), &cont); |
1329 } | 1330 } |
1330 | 1331 |
1331 void InstructionSelector::VisitSwitch(Node* node, const SwitchInfo& sw) { | 1332 void InstructionSelector::VisitSwitch(Node* node, const SwitchInfo& sw) { |
1332 MipsOperandGenerator g(this); | 1333 MipsOperandGenerator g(this); |
1333 InstructionOperand value_operand = g.UseRegister(node->InputAt(0)); | 1334 InstructionOperand value_operand = g.UseRegister(node->InputAt(0)); |
1334 | 1335 |
1335 // Emit either ArchTableSwitch or ArchLookupSwitch. | 1336 // Emit either ArchTableSwitch or ArchLookupSwitch. |
1336 size_t table_space_cost = 9 + sw.value_range; | 1337 size_t table_space_cost = 9 + sw.value_range; |
1337 size_t table_time_cost = 3; | 1338 size_t table_time_cost = 3; |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1601 DCHECK(IsMipsArchVariant(kLoongson) || IsMipsArchVariant(kMips32r1) || | 1602 DCHECK(IsMipsArchVariant(kLoongson) || IsMipsArchVariant(kMips32r1) || |
1602 IsMipsArchVariant(kMips32r2)); | 1603 IsMipsArchVariant(kMips32r2)); |
1603 return MachineOperatorBuilder::AlignmentRequirements:: | 1604 return MachineOperatorBuilder::AlignmentRequirements:: |
1604 NoUnalignedAccessSupport(); | 1605 NoUnalignedAccessSupport(); |
1605 } | 1606 } |
1606 } | 1607 } |
1607 | 1608 |
1608 } // namespace compiler | 1609 } // namespace compiler |
1609 } // namespace internal | 1610 } // namespace internal |
1610 } // namespace v8 | 1611 } // namespace v8 |
OLD | NEW |