| 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/code-factory.h" | 5 #include "src/code-factory.h" |
| 6 #include "src/code-stubs.h" | 6 #include "src/code-stubs.h" |
| 7 #include "src/compiler/common-operator.h" | 7 #include "src/compiler/common-operator.h" |
| 8 #include "src/compiler/js-generic-lowering.h" | 8 #include "src/compiler/js-generic-lowering.h" |
| 9 #include "src/compiler/js-graph.h" | 9 #include "src/compiler/js-graph.h" |
| 10 #include "src/compiler/machine-operator.h" | 10 #include "src/compiler/machine-operator.h" |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 op = machine()->IntLessThan(); | 189 op = machine()->IntLessThan(); |
| 190 std::swap(true_value, false_value); | 190 std::swap(true_value, false_value); |
| 191 break; | 191 break; |
| 192 default: | 192 default: |
| 193 UNREACHABLE(); | 193 UNREACHABLE(); |
| 194 } | 194 } |
| 195 Node* booleanize = graph()->NewNode(op, compare, jsgraph()->ZeroConstant()); | 195 Node* booleanize = graph()->NewNode(op, compare, jsgraph()->ZeroConstant()); |
| 196 | 196 |
| 197 // Finally patch the original node to select a boolean. | 197 // Finally patch the original node to select a boolean. |
| 198 NodeProperties::ReplaceUses(node, node, compare, compare, compare); | 198 NodeProperties::ReplaceUses(node, node, compare, compare, compare); |
| 199 // TODO(mstarzinger): Just a work-around because SelectLowering might | |
| 200 // otherwise introduce a Phi without any uses, making Scheduler unhappy. | |
| 201 if (node->UseCount() == 0) return; | |
| 202 node->TrimInputCount(3); | 199 node->TrimInputCount(3); |
| 203 node->ReplaceInput(0, booleanize); | 200 node->ReplaceInput(0, booleanize); |
| 204 node->ReplaceInput(1, true_value); | 201 node->ReplaceInput(1, true_value); |
| 205 node->ReplaceInput(2, false_value); | 202 node->ReplaceInput(2, false_value); |
| 206 node->set_op(common()->Select(kMachAnyTagged)); | 203 node->set_op(common()->Select(kMachAnyTagged)); |
| 207 } | 204 } |
| 208 | 205 |
| 209 | 206 |
| 210 void JSGenericLowering::ReplaceWithStubCall(Node* node, Callable callable, | 207 void JSGenericLowering::ReplaceWithStubCall(Node* node, Callable callable, |
| 211 CallDescriptor::Flags flags) { | 208 CallDescriptor::Flags flags) { |
| (...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 774 } | 771 } |
| 775 | 772 |
| 776 | 773 |
| 777 MachineOperatorBuilder* JSGenericLowering::machine() const { | 774 MachineOperatorBuilder* JSGenericLowering::machine() const { |
| 778 return jsgraph()->machine(); | 775 return jsgraph()->machine(); |
| 779 } | 776 } |
| 780 | 777 |
| 781 } // namespace compiler | 778 } // namespace compiler |
| 782 } // namespace internal | 779 } // namespace internal |
| 783 } // namespace v8 | 780 } // namespace v8 |
| OLD | NEW |