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 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 } | 300 } |
301 | 301 |
302 DCHECK_NE(0u, input_count); | 302 DCHECK_NE(0u, input_count); |
303 DCHECK_NE(0u, output_count); | 303 DCHECK_NE(0u, output_count); |
304 DCHECK_GE(arraysize(inputs), input_count); | 304 DCHECK_GE(arraysize(inputs), input_count); |
305 DCHECK_GE(arraysize(outputs), output_count); | 305 DCHECK_GE(arraysize(outputs), output_count); |
306 | 306 |
307 opcode = cont->Encode(opcode); | 307 opcode = cont->Encode(opcode); |
308 if (cont->IsDeoptimize()) { | 308 if (cont->IsDeoptimize()) { |
309 selector->EmitDeoptimize(opcode, output_count, outputs, input_count, inputs, | 309 selector->EmitDeoptimize(opcode, output_count, outputs, input_count, inputs, |
310 cont->kind(), cont->reason(), cont->frame_state()); | 310 cont->reason(), cont->frame_state()); |
311 } else { | 311 } else { |
312 selector->Emit(opcode, output_count, outputs, input_count, inputs); | 312 selector->Emit(opcode, output_count, outputs, input_count, inputs); |
313 } | 313 } |
314 } | 314 } |
315 | 315 |
316 static void VisitBinop(InstructionSelector* selector, Node* node, | 316 static void VisitBinop(InstructionSelector* selector, Node* node, |
317 InstructionCode opcode, bool has_reverse_opcode, | 317 InstructionCode opcode, bool has_reverse_opcode, |
318 InstructionCode reverse_opcode) { | 318 InstructionCode reverse_opcode) { |
319 FlagsContinuation cont; | 319 FlagsContinuation cont; |
320 VisitBinop(selector, node, opcode, has_reverse_opcode, reverse_opcode, &cont); | 320 VisitBinop(selector, node, opcode, has_reverse_opcode, reverse_opcode, &cont); |
(...skipping 1613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1934 // Shared routine for multiple compare operations. | 1934 // Shared routine for multiple compare operations. |
1935 static void VisitCompare(InstructionSelector* selector, InstructionCode opcode, | 1935 static void VisitCompare(InstructionSelector* selector, InstructionCode opcode, |
1936 InstructionOperand left, InstructionOperand right, | 1936 InstructionOperand left, InstructionOperand right, |
1937 FlagsContinuation* cont) { | 1937 FlagsContinuation* cont) { |
1938 Mips64OperandGenerator g(selector); | 1938 Mips64OperandGenerator g(selector); |
1939 opcode = cont->Encode(opcode); | 1939 opcode = cont->Encode(opcode); |
1940 if (cont->IsBranch()) { | 1940 if (cont->IsBranch()) { |
1941 selector->Emit(opcode, g.NoOutput(), left, right, | 1941 selector->Emit(opcode, g.NoOutput(), left, right, |
1942 g.Label(cont->true_block()), g.Label(cont->false_block())); | 1942 g.Label(cont->true_block()), g.Label(cont->false_block())); |
1943 } else if (cont->IsDeoptimize()) { | 1943 } else if (cont->IsDeoptimize()) { |
1944 selector->EmitDeoptimize(opcode, g.NoOutput(), left, right, cont->kind(), | 1944 selector->EmitDeoptimize(opcode, g.NoOutput(), left, right, cont->reason(), |
1945 cont->reason(), cont->frame_state()); | 1945 cont->frame_state()); |
1946 } else if (cont->IsSet()) { | 1946 } else if (cont->IsSet()) { |
1947 selector->Emit(opcode, g.DefineAsRegister(cont->result()), left, right); | 1947 selector->Emit(opcode, g.DefineAsRegister(cont->result()), left, right); |
1948 } else { | 1948 } else { |
1949 DCHECK(cont->IsTrap()); | 1949 DCHECK(cont->IsTrap()); |
1950 selector->Emit(opcode, g.NoOutput(), left, right, | 1950 selector->Emit(opcode, g.NoOutput(), left, right, |
1951 g.TempImmediate(cont->trap_id())); | 1951 g.TempImmediate(cont->trap_id())); |
1952 } | 1952 } |
1953 } | 1953 } |
1954 | 1954 |
1955 | 1955 |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2151 void EmitWordCompareZero(InstructionSelector* selector, Node* value, | 2151 void EmitWordCompareZero(InstructionSelector* selector, Node* value, |
2152 FlagsContinuation* cont) { | 2152 FlagsContinuation* cont) { |
2153 Mips64OperandGenerator g(selector); | 2153 Mips64OperandGenerator g(selector); |
2154 InstructionCode opcode = cont->Encode(kMips64Cmp); | 2154 InstructionCode opcode = cont->Encode(kMips64Cmp); |
2155 InstructionOperand const value_operand = g.UseRegister(value); | 2155 InstructionOperand const value_operand = g.UseRegister(value); |
2156 if (cont->IsBranch()) { | 2156 if (cont->IsBranch()) { |
2157 selector->Emit(opcode, g.NoOutput(), value_operand, g.TempImmediate(0), | 2157 selector->Emit(opcode, g.NoOutput(), value_operand, g.TempImmediate(0), |
2158 g.Label(cont->true_block()), g.Label(cont->false_block())); | 2158 g.Label(cont->true_block()), g.Label(cont->false_block())); |
2159 } else if (cont->IsDeoptimize()) { | 2159 } else if (cont->IsDeoptimize()) { |
2160 selector->EmitDeoptimize(opcode, g.NoOutput(), value_operand, | 2160 selector->EmitDeoptimize(opcode, g.NoOutput(), value_operand, |
2161 g.TempImmediate(0), cont->kind(), cont->reason(), | 2161 g.TempImmediate(0), cont->reason(), |
2162 cont->frame_state()); | 2162 cont->frame_state()); |
2163 } else if (cont->IsTrap()) { | 2163 } else if (cont->IsTrap()) { |
2164 selector->Emit(opcode, g.NoOutput(), value_operand, g.TempImmediate(0), | 2164 selector->Emit(opcode, g.NoOutput(), value_operand, g.TempImmediate(0), |
2165 g.TempImmediate(cont->trap_id())); | 2165 g.TempImmediate(cont->trap_id())); |
2166 } else { | 2166 } else { |
2167 selector->Emit(opcode, g.DefineAsRegister(cont->result()), value_operand, | 2167 selector->Emit(opcode, g.DefineAsRegister(cont->result()), value_operand, |
2168 g.TempImmediate(0)); | 2168 g.TempImmediate(0)); |
2169 } | 2169 } |
2170 } | 2170 } |
2171 | 2171 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2290 | 2290 |
2291 } // namespace | 2291 } // namespace |
2292 | 2292 |
2293 void InstructionSelector::VisitBranch(Node* branch, BasicBlock* tbranch, | 2293 void InstructionSelector::VisitBranch(Node* branch, BasicBlock* tbranch, |
2294 BasicBlock* fbranch) { | 2294 BasicBlock* fbranch) { |
2295 FlagsContinuation cont(kNotEqual, tbranch, fbranch); | 2295 FlagsContinuation cont(kNotEqual, tbranch, fbranch); |
2296 VisitWordCompareZero(this, branch, branch->InputAt(0), &cont); | 2296 VisitWordCompareZero(this, branch, branch->InputAt(0), &cont); |
2297 } | 2297 } |
2298 | 2298 |
2299 void InstructionSelector::VisitDeoptimizeIf(Node* node) { | 2299 void InstructionSelector::VisitDeoptimizeIf(Node* node) { |
2300 DeoptimizeParameters p = DeoptimizeParametersOf(node->op()); | |
2301 FlagsContinuation cont = FlagsContinuation::ForDeoptimize( | 2300 FlagsContinuation cont = FlagsContinuation::ForDeoptimize( |
2302 kNotEqual, p.kind(), p.reason(), node->InputAt(1)); | 2301 kNotEqual, DeoptimizeReasonOf(node->op()), node->InputAt(1)); |
2303 VisitWordCompareZero(this, node, node->InputAt(0), &cont); | 2302 VisitWordCompareZero(this, node, node->InputAt(0), &cont); |
2304 } | 2303 } |
2305 | 2304 |
2306 void InstructionSelector::VisitDeoptimizeUnless(Node* node) { | 2305 void InstructionSelector::VisitDeoptimizeUnless(Node* node) { |
2307 DeoptimizeParameters p = DeoptimizeParametersOf(node->op()); | |
2308 FlagsContinuation cont = FlagsContinuation::ForDeoptimize( | 2306 FlagsContinuation cont = FlagsContinuation::ForDeoptimize( |
2309 kEqual, p.kind(), p.reason(), node->InputAt(1)); | 2307 kEqual, DeoptimizeReasonOf(node->op()), node->InputAt(1)); |
2310 VisitWordCompareZero(this, node, node->InputAt(0), &cont); | 2308 VisitWordCompareZero(this, node, node->InputAt(0), &cont); |
2311 } | 2309 } |
2312 | 2310 |
2313 void InstructionSelector::VisitTrapIf(Node* node, Runtime::FunctionId func_id) { | 2311 void InstructionSelector::VisitTrapIf(Node* node, Runtime::FunctionId func_id) { |
2314 FlagsContinuation cont = | 2312 FlagsContinuation cont = |
2315 FlagsContinuation::ForTrap(kNotEqual, func_id, node->InputAt(1)); | 2313 FlagsContinuation::ForTrap(kNotEqual, func_id, node->InputAt(1)); |
2316 VisitWordCompareZero(this, node, node->InputAt(0), &cont); | 2314 VisitWordCompareZero(this, node, node->InputAt(0), &cont); |
2317 } | 2315 } |
2318 | 2316 |
2319 void InstructionSelector::VisitTrapUnless(Node* node, | 2317 void InstructionSelector::VisitTrapUnless(Node* node, |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2642 } else { | 2640 } else { |
2643 DCHECK(kArchVariant == kMips64r2); | 2641 DCHECK(kArchVariant == kMips64r2); |
2644 return MachineOperatorBuilder::AlignmentRequirements:: | 2642 return MachineOperatorBuilder::AlignmentRequirements:: |
2645 NoUnalignedAccessSupport(); | 2643 NoUnalignedAccessSupport(); |
2646 } | 2644 } |
2647 } | 2645 } |
2648 | 2646 |
2649 } // namespace compiler | 2647 } // namespace compiler |
2650 } // namespace internal | 2648 } // namespace internal |
2651 } // namespace v8 | 2649 } // namespace v8 |
OLD | NEW |