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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 Strength str) { | 142 Strength str) { |
143 Callable callable = CodeFactory::CompareIC(isolate(), token, str); | 143 Callable callable = CodeFactory::CompareIC(isolate(), token, str); |
144 | 144 |
145 // Create a new call node asking a CompareIC for help. | 145 // Create a new call node asking a CompareIC for help. |
146 NodeVector inputs(zone()); | 146 NodeVector inputs(zone()); |
147 inputs.reserve(node->InputCount() + 1); | 147 inputs.reserve(node->InputCount() + 1); |
148 inputs.push_back(jsgraph()->HeapConstant(callable.code())); | 148 inputs.push_back(jsgraph()->HeapConstant(callable.code())); |
149 inputs.push_back(NodeProperties::GetValueInput(node, 0)); | 149 inputs.push_back(NodeProperties::GetValueInput(node, 0)); |
150 inputs.push_back(NodeProperties::GetValueInput(node, 1)); | 150 inputs.push_back(NodeProperties::GetValueInput(node, 1)); |
151 inputs.push_back(NodeProperties::GetContextInput(node)); | 151 inputs.push_back(NodeProperties::GetContextInput(node)); |
152 if (node->op()->HasProperty(Operator::kPure)) { | 152 // Some comparisons (StrictEqual) don't have an effect, control or frame |
153 // A pure (strict) comparison doesn't have an effect, control or frame | 153 // state inputs, so handle those cases here. |
154 // state. But for the graph, we need to add control and effect inputs. | 154 if (OperatorProperties::GetFrameStateInputCount(node->op()) > 0) { |
155 DCHECK(OperatorProperties::GetFrameStateInputCount(node->op()) == 0); | |
156 inputs.push_back(graph()->start()); | |
157 inputs.push_back(graph()->start()); | |
158 } else { | |
159 inputs.push_back(NodeProperties::GetFrameStateInput(node, 0)); | 155 inputs.push_back(NodeProperties::GetFrameStateInput(node, 0)); |
160 inputs.push_back(NodeProperties::GetEffectInput(node)); | |
161 inputs.push_back(NodeProperties::GetControlInput(node)); | |
162 } | 156 } |
| 157 Node* effect = (node->op()->EffectInputCount() > 0) |
| 158 ? NodeProperties::GetEffectInput(node) |
| 159 : graph()->start(); |
| 160 inputs.push_back(effect); |
| 161 Node* control = (node->op()->ControlInputCount() > 0) |
| 162 ? NodeProperties::GetControlInput(node) |
| 163 : graph()->start(); |
| 164 inputs.push_back(control); |
163 CallDescriptor* desc_compare = Linkage::GetStubCallDescriptor( | 165 CallDescriptor* desc_compare = Linkage::GetStubCallDescriptor( |
164 isolate(), zone(), callable.descriptor(), 0, | 166 isolate(), zone(), callable.descriptor(), 0, |
165 CallDescriptor::kPatchableCallSiteWithNop | FlagsForNode(node), | 167 CallDescriptor::kPatchableCallSiteWithNop | FlagsForNode(node), |
166 Operator::kNoProperties, kMachIntPtr); | 168 Operator::kNoProperties, kMachIntPtr); |
167 Node* compare = | 169 Node* compare = |
168 graph()->NewNode(common()->Call(desc_compare), | 170 graph()->NewNode(common()->Call(desc_compare), |
169 static_cast<int>(inputs.size()), &inputs.front()); | 171 static_cast<int>(inputs.size()), &inputs.front()); |
170 | 172 |
171 // Decide how the return value from the above CompareIC can be converted into | 173 // Decide how the return value from the above CompareIC can be converted into |
172 // a JavaScript boolean oddball depending on the given token. | 174 // a JavaScript boolean oddball depending on the given token. |
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
841 } | 843 } |
842 | 844 |
843 | 845 |
844 MachineOperatorBuilder* JSGenericLowering::machine() const { | 846 MachineOperatorBuilder* JSGenericLowering::machine() const { |
845 return jsgraph()->machine(); | 847 return jsgraph()->machine(); |
846 } | 848 } |
847 | 849 |
848 } // namespace compiler | 850 } // namespace compiler |
849 } // namespace internal | 851 } // namespace internal |
850 } // namespace v8 | 852 } // namespace v8 |
OLD | NEW |