| 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/code-factory.h" | 9 #include "src/code-factory.h" |
| 10 #include "src/compiler/access-builder.h" | 10 #include "src/compiler/access-builder.h" |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 case Runtime::kInlineToPrimitive: | 104 case Runtime::kInlineToPrimitive: |
| 105 return ReduceToPrimitive(node); | 105 return ReduceToPrimitive(node); |
| 106 case Runtime::kInlineToString: | 106 case Runtime::kInlineToString: |
| 107 return ReduceToString(node); | 107 return ReduceToString(node); |
| 108 case Runtime::kInlineThrowNotDateError: | 108 case Runtime::kInlineThrowNotDateError: |
| 109 return ReduceThrowNotDateError(node); | 109 return ReduceThrowNotDateError(node); |
| 110 case Runtime::kInlineCall: | 110 case Runtime::kInlineCall: |
| 111 return ReduceCall(node); | 111 return ReduceCall(node); |
| 112 case Runtime::kInlineTailCall: | 112 case Runtime::kInlineTailCall: |
| 113 return ReduceTailCall(node); | 113 return ReduceTailCall(node); |
| 114 case Runtime::kInlineGetSuperConstructor: |
| 115 return ReduceGetSuperConstructor(node); |
| 114 default: | 116 default: |
| 115 break; | 117 break; |
| 116 } | 118 } |
| 117 return NoChange(); | 119 return NoChange(); |
| 118 } | 120 } |
| 119 | 121 |
| 120 | 122 |
| 121 Reduction JSIntrinsicLowering::ReduceConstructDouble(Node* node) { | 123 Reduction JSIntrinsicLowering::ReduceConstructDouble(Node* node) { |
| 122 Node* high = NodeProperties::GetValueInput(node, 0); | 124 Node* high = NodeProperties::GetValueInput(node, 0); |
| 123 Node* low = NodeProperties::GetValueInput(node, 1); | 125 Node* low = NodeProperties::GetValueInput(node, 1); |
| (...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 Reduction JSIntrinsicLowering::ReduceTailCall(Node* node) { | 609 Reduction JSIntrinsicLowering::ReduceTailCall(Node* node) { |
| 608 size_t const arity = CallRuntimeParametersOf(node->op()).arity(); | 610 size_t const arity = CallRuntimeParametersOf(node->op()).arity(); |
| 609 NodeProperties::ChangeOp( | 611 NodeProperties::ChangeOp( |
| 610 node, javascript()->CallFunction(arity, STRICT, VectorSlotPair(), | 612 node, javascript()->CallFunction(arity, STRICT, VectorSlotPair(), |
| 611 ConvertReceiverMode::kAny, | 613 ConvertReceiverMode::kAny, |
| 612 TailCallMode::kAllow)); | 614 TailCallMode::kAllow)); |
| 613 return Changed(node); | 615 return Changed(node); |
| 614 } | 616 } |
| 615 | 617 |
| 616 | 618 |
| 619 Reduction JSIntrinsicLowering::ReduceGetSuperConstructor(Node* node) { |
| 620 Node* active_function = NodeProperties::GetValueInput(node, 0); |
| 621 Node* effect = NodeProperties::GetEffectInput(node); |
| 622 Node* control = NodeProperties::GetControlInput(node); |
| 623 Node* active_function_map = effect = |
| 624 graph()->NewNode(simplified()->LoadField(AccessBuilder::ForMap()), |
| 625 active_function, effect, control); |
| 626 return Change(node, simplified()->LoadField(AccessBuilder::ForMapPrototype()), |
| 627 active_function_map, effect, control); |
| 628 } |
| 629 |
| 630 |
| 617 Reduction JSIntrinsicLowering::Change(Node* node, const Operator* op, Node* a, | 631 Reduction JSIntrinsicLowering::Change(Node* node, const Operator* op, Node* a, |
| 618 Node* b) { | 632 Node* b) { |
| 619 RelaxControls(node); | 633 RelaxControls(node); |
| 620 node->ReplaceInput(0, a); | 634 node->ReplaceInput(0, a); |
| 621 node->ReplaceInput(1, b); | 635 node->ReplaceInput(1, b); |
| 622 node->TrimInputCount(2); | 636 node->TrimInputCount(2); |
| 623 NodeProperties::ChangeOp(node, op); | 637 NodeProperties::ChangeOp(node, op); |
| 624 return Changed(node); | 638 return Changed(node); |
| 625 } | 639 } |
| 626 | 640 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 688 } | 702 } |
| 689 | 703 |
| 690 | 704 |
| 691 SimplifiedOperatorBuilder* JSIntrinsicLowering::simplified() const { | 705 SimplifiedOperatorBuilder* JSIntrinsicLowering::simplified() const { |
| 692 return jsgraph()->simplified(); | 706 return jsgraph()->simplified(); |
| 693 } | 707 } |
| 694 | 708 |
| 695 } // namespace compiler | 709 } // namespace compiler |
| 696 } // namespace internal | 710 } // namespace internal |
| 697 } // namespace v8 | 711 } // namespace v8 |
| OLD | NEW |