| 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-call-reducer.h" | 5 #include "src/compiler/js-call-reducer.h" |
| 6 | 6 |
| 7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
| 8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
| 9 #include "src/compilation-dependencies.h" | 9 #include "src/compilation-dependencies.h" |
| 10 #include "src/compiler/js-graph.h" | 10 #include "src/compiler/js-graph.h" |
| (...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 657 // Try to further reduce the JSCall {node}. | 657 // Try to further reduce the JSCall {node}. |
| 658 Reduction const reduction = ReduceJSCall(node); | 658 Reduction const reduction = ReduceJSCall(node); |
| 659 return reduction.Changed() ? reduction : Changed(node); | 659 return reduction.Changed() ? reduction : Changed(node); |
| 660 } | 660 } |
| 661 } | 661 } |
| 662 return NoChange(); | 662 return NoChange(); |
| 663 } | 663 } |
| 664 | 664 |
| 665 Reduction JSCallReducer::ReduceJSCallWithSpread(Node* node) { | 665 Reduction JSCallReducer::ReduceJSCallWithSpread(Node* node) { |
| 666 DCHECK_EQ(IrOpcode::kJSCallWithSpread, node->opcode()); | 666 DCHECK_EQ(IrOpcode::kJSCallWithSpread, node->opcode()); |
| 667 CallWithSpreadParameters const& p = CallWithSpreadParametersOf(node->op()); | 667 SpreadWithArityParameters const& p = SpreadWithArityParametersOf(node->op()); |
| 668 DCHECK_LE(3u, p.arity()); | 668 DCHECK_LE(3u, p.arity()); |
| 669 int arity = static_cast<int>(p.arity() - 1); | 669 int arity = static_cast<int>(p.arity() - 1); |
| 670 | 670 |
| 671 return ReduceSpreadCall(node, arity); | 671 return ReduceSpreadCall(node, arity); |
| 672 } | 672 } |
| 673 | 673 |
| 674 Reduction JSCallReducer::ReduceJSConstruct(Node* node) { | 674 Reduction JSCallReducer::ReduceJSConstruct(Node* node) { |
| 675 DCHECK_EQ(IrOpcode::kJSConstruct, node->opcode()); | 675 DCHECK_EQ(IrOpcode::kJSConstruct, node->opcode()); |
| 676 ConstructParameters const& p = ConstructParametersOf(node->op()); | 676 ConstructParameters const& p = ConstructParametersOf(node->op()); |
| 677 DCHECK_LE(2u, p.arity()); | 677 DCHECK_LE(2u, p.arity()); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 784 Reduction const reduction = ReduceJSConstruct(node); | 784 Reduction const reduction = ReduceJSConstruct(node); |
| 785 return reduction.Changed() ? reduction : Changed(node); | 785 return reduction.Changed() ? reduction : Changed(node); |
| 786 } | 786 } |
| 787 } | 787 } |
| 788 | 788 |
| 789 return NoChange(); | 789 return NoChange(); |
| 790 } | 790 } |
| 791 | 791 |
| 792 Reduction JSCallReducer::ReduceJSConstructWithSpread(Node* node) { | 792 Reduction JSCallReducer::ReduceJSConstructWithSpread(Node* node) { |
| 793 DCHECK_EQ(IrOpcode::kJSConstructWithSpread, node->opcode()); | 793 DCHECK_EQ(IrOpcode::kJSConstructWithSpread, node->opcode()); |
| 794 ConstructWithSpreadParameters const& p = | 794 SpreadWithArityParameters const& p = SpreadWithArityParametersOf(node->op()); |
| 795 ConstructWithSpreadParametersOf(node->op()); | |
| 796 DCHECK_LE(3u, p.arity()); | 795 DCHECK_LE(3u, p.arity()); |
| 797 int arity = static_cast<int>(p.arity() - 2); | 796 int arity = static_cast<int>(p.arity() - 2); |
| 798 | 797 |
| 799 return ReduceSpreadCall(node, arity); | 798 return ReduceSpreadCall(node, arity); |
| 800 } | 799 } |
| 801 | 800 |
| 802 Graph* JSCallReducer::graph() const { return jsgraph()->graph(); } | 801 Graph* JSCallReducer::graph() const { return jsgraph()->graph(); } |
| 803 | 802 |
| 804 Isolate* JSCallReducer::isolate() const { return jsgraph()->isolate(); } | 803 Isolate* JSCallReducer::isolate() const { return jsgraph()->isolate(); } |
| 805 | 804 |
| 806 Factory* JSCallReducer::factory() const { return isolate()->factory(); } | 805 Factory* JSCallReducer::factory() const { return isolate()->factory(); } |
| 807 | 806 |
| 808 CommonOperatorBuilder* JSCallReducer::common() const { | 807 CommonOperatorBuilder* JSCallReducer::common() const { |
| 809 return jsgraph()->common(); | 808 return jsgraph()->common(); |
| 810 } | 809 } |
| 811 | 810 |
| 812 JSOperatorBuilder* JSCallReducer::javascript() const { | 811 JSOperatorBuilder* JSCallReducer::javascript() const { |
| 813 return jsgraph()->javascript(); | 812 return jsgraph()->javascript(); |
| 814 } | 813 } |
| 815 | 814 |
| 816 SimplifiedOperatorBuilder* JSCallReducer::simplified() const { | 815 SimplifiedOperatorBuilder* JSCallReducer::simplified() const { |
| 817 return jsgraph()->simplified(); | 816 return jsgraph()->simplified(); |
| 818 } | 817 } |
| 819 | 818 |
| 820 } // namespace compiler | 819 } // namespace compiler |
| 821 } // namespace internal | 820 } // namespace internal |
| 822 } // namespace v8 | 821 } // namespace v8 |
| OLD | NEW |