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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 node->TrimInputCount(3); | 202 node->TrimInputCount(3); |
203 node->ReplaceInput(0, booleanize); | 203 node->ReplaceInput(0, booleanize); |
204 node->ReplaceInput(1, true_value); | 204 node->ReplaceInput(1, true_value); |
205 node->ReplaceInput(2, false_value); | 205 node->ReplaceInput(2, false_value); |
206 node->set_op(common()->Select(kMachAnyTagged)); | 206 node->set_op(common()->Select(kMachAnyTagged)); |
207 } | 207 } |
208 | 208 |
209 | 209 |
210 void JSGenericLowering::ReplaceWithStubCall(Node* node, Callable callable, | 210 void JSGenericLowering::ReplaceWithStubCall(Node* node, Callable callable, |
211 CallDescriptor::Flags flags) { | 211 CallDescriptor::Flags flags) { |
212 const Operator* old_op = node->op(); | 212 Operator::Properties properties = node->op()->properties(); |
213 Operator::Properties properties = old_op->properties(); | |
214 CallDescriptor* desc = Linkage::GetStubCallDescriptor( | 213 CallDescriptor* desc = Linkage::GetStubCallDescriptor( |
215 isolate(), zone(), callable.descriptor(), 0, flags, properties); | 214 isolate(), zone(), callable.descriptor(), 0, flags, properties); |
216 const Operator* new_op = common()->Call(desc); | |
217 | |
218 Node* stub_code = jsgraph()->HeapConstant(callable.code()); | 215 Node* stub_code = jsgraph()->HeapConstant(callable.code()); |
219 node->InsertInput(zone(), 0, stub_code); | 216 node->InsertInput(zone(), 0, stub_code); |
220 node->set_op(new_op); | 217 node->set_op(common()->Call(desc)); |
221 | |
222 #if 0 && DEBUG | |
223 // Check for at most one framestate and that it's at the right position. | |
224 int where = -1; | |
225 for (int index = 0; index < node->InputCount(); index++) { | |
226 if (node->InputAt(index)->opcode() == IrOpcode::kFrameState) { | |
227 if (where >= 0) { | |
228 V8_Fatal(__FILE__, __LINE__, | |
229 "node #%d:%s already has a framestate at index %d", | |
230 node->id(), node->op()->mnemonic(), where); | |
231 } | |
232 where = index; | |
233 DCHECK_EQ(NodeProperties::FirstFrameStateIndex(node), where); | |
234 DCHECK(flags & CallDescriptor::kNeedsFrameState); | |
235 } | |
236 } | |
237 if (flags & CallDescriptor::kNeedsFrameState) { | |
238 DCHECK_GE(where, 0); // should have found a frame state. | |
239 } | |
240 #endif | |
241 } | 218 } |
242 | 219 |
243 | 220 |
244 void JSGenericLowering::ReplaceWithBuiltinCall(Node* node, | 221 void JSGenericLowering::ReplaceWithBuiltinCall(Node* node, |
245 Builtins::JavaScript id, | 222 Builtins::JavaScript id, |
246 int nargs) { | 223 int nargs) { |
247 Node* context_input = NodeProperties::GetContextInput(node); | 224 Node* context_input = NodeProperties::GetContextInput(node); |
248 Node* effect_input = NodeProperties::GetEffectInput(node); | 225 Node* effect_input = NodeProperties::GetEffectInput(node); |
249 | 226 |
250 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); | 227 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); |
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
797 } | 774 } |
798 | 775 |
799 | 776 |
800 MachineOperatorBuilder* JSGenericLowering::machine() const { | 777 MachineOperatorBuilder* JSGenericLowering::machine() const { |
801 return jsgraph()->machine(); | 778 return jsgraph()->machine(); |
802 } | 779 } |
803 | 780 |
804 } // namespace compiler | 781 } // namespace compiler |
805 } // namespace internal | 782 } // namespace internal |
806 } // namespace v8 | 783 } // namespace v8 |
OLD | NEW |