| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/compiler/js-intrinsic-lowering.h" | 5 #include "src/compiler/js-intrinsic-lowering.h" |
| 6 | 6 |
| 7 #include <stack> | 7 #include <stack> |
| 8 | 8 |
| 9 #include "src/compiler/access-builder.h" | 9 #include "src/compiler/access-builder.h" |
| 10 #include "src/compiler/js-graph.h" | 10 #include "src/compiler/js-graph.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 case Runtime::kInlineIsMinusZero: | 87 case Runtime::kInlineIsMinusZero: |
| 88 return ReduceIsMinusZero(node); | 88 return ReduceIsMinusZero(node); |
| 89 case Runtime::kInlineFixedArraySet: | 89 case Runtime::kInlineFixedArraySet: |
| 90 return ReduceFixedArraySet(node); | 90 return ReduceFixedArraySet(node); |
| 91 case Runtime::kInlineGetTypeFeedbackVector: | 91 case Runtime::kInlineGetTypeFeedbackVector: |
| 92 return ReduceGetTypeFeedbackVector(node); | 92 return ReduceGetTypeFeedbackVector(node); |
| 93 case Runtime::kInlineGetCallerJSFunction: | 93 case Runtime::kInlineGetCallerJSFunction: |
| 94 return ReduceGetCallerJSFunction(node); | 94 return ReduceGetCallerJSFunction(node); |
| 95 case Runtime::kInlineThrowNotDateError: | 95 case Runtime::kInlineThrowNotDateError: |
| 96 return ReduceThrowNotDateError(node); | 96 return ReduceThrowNotDateError(node); |
| 97 case Runtime::kInlineCallFunction: |
| 98 return ReduceCallFunction(node); |
| 97 default: | 99 default: |
| 98 break; | 100 break; |
| 99 } | 101 } |
| 100 return NoChange(); | 102 return NoChange(); |
| 101 } | 103 } |
| 102 | 104 |
| 103 | 105 |
| 104 Reduction JSIntrinsicLowering::ReduceConstructDouble(Node* node) { | 106 Reduction JSIntrinsicLowering::ReduceConstructDouble(Node* node) { |
| 105 Node* high = NodeProperties::GetValueInput(node, 0); | 107 Node* high = NodeProperties::GetValueInput(node, 0); |
| 106 Node* low = NodeProperties::GetValueInput(node, 1); | 108 Node* low = NodeProperties::GetValueInput(node, 1); |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 Node* deoptimize = | 508 Node* deoptimize = |
| 507 graph()->NewNode(common()->Deoptimize(), frame_state, effect, control); | 509 graph()->NewNode(common()->Deoptimize(), frame_state, effect, control); |
| 508 NodeProperties::MergeControlToEnd(graph(), common(), deoptimize); | 510 NodeProperties::MergeControlToEnd(graph(), common(), deoptimize); |
| 509 | 511 |
| 510 node->set_op(common()->Dead()); | 512 node->set_op(common()->Dead()); |
| 511 node->TrimInputCount(0); | 513 node->TrimInputCount(0); |
| 512 return Changed(node); | 514 return Changed(node); |
| 513 } | 515 } |
| 514 | 516 |
| 515 | 517 |
| 518 Reduction JSIntrinsicLowering::ReduceCallFunction(Node* node) { |
| 519 CallRuntimeParameters params = OpParameter<CallRuntimeParameters>(node->op()); |
| 520 size_t arity = params.arity(); |
| 521 node->set_op(javascript()->CallFunction(arity, NO_CALL_FUNCTION_FLAGS, STRICT, |
| 522 VectorSlotPair(), ALLOW_TAIL_CALLS)); |
| 523 Node* function = node->InputAt(static_cast<int>(arity - 1)); |
| 524 while (--arity != 0) { |
| 525 node->ReplaceInput(static_cast<int>(arity), |
| 526 node->InputAt(static_cast<int>(arity - 1))); |
| 527 } |
| 528 node->ReplaceInput(0, function); |
| 529 return Changed(node); |
| 530 } |
| 531 |
| 532 |
| 516 Reduction JSIntrinsicLowering::Change(Node* node, const Operator* op, Node* a, | 533 Reduction JSIntrinsicLowering::Change(Node* node, const Operator* op, Node* a, |
| 517 Node* b) { | 534 Node* b) { |
| 518 node->set_op(op); | 535 node->set_op(op); |
| 519 node->ReplaceInput(0, a); | 536 node->ReplaceInput(0, a); |
| 520 node->ReplaceInput(1, b); | 537 node->ReplaceInput(1, b); |
| 521 node->TrimInputCount(2); | 538 node->TrimInputCount(2); |
| 522 RelaxControls(node); | 539 RelaxControls(node); |
| 523 return Changed(node); | 540 return Changed(node); |
| 524 } | 541 } |
| 525 | 542 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 542 } | 559 } |
| 543 | 560 |
| 544 | 561 |
| 545 Graph* JSIntrinsicLowering::graph() const { return jsgraph()->graph(); } | 562 Graph* JSIntrinsicLowering::graph() const { return jsgraph()->graph(); } |
| 546 | 563 |
| 547 | 564 |
| 548 CommonOperatorBuilder* JSIntrinsicLowering::common() const { | 565 CommonOperatorBuilder* JSIntrinsicLowering::common() const { |
| 549 return jsgraph()->common(); | 566 return jsgraph()->common(); |
| 550 } | 567 } |
| 551 | 568 |
| 569 JSOperatorBuilder* JSIntrinsicLowering::javascript() const { |
| 570 return jsgraph_->javascript(); |
| 571 } |
| 572 |
| 552 | 573 |
| 553 MachineOperatorBuilder* JSIntrinsicLowering::machine() const { | 574 MachineOperatorBuilder* JSIntrinsicLowering::machine() const { |
| 554 return jsgraph()->machine(); | 575 return jsgraph()->machine(); |
| 555 } | 576 } |
| 556 | 577 |
| 557 } // namespace compiler | 578 } // namespace compiler |
| 558 } // namespace internal | 579 } // namespace internal |
| 559 } // namespace v8 | 580 } // namespace v8 |
| OLD | NEW |