| 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/access-builder.h" | 10 #include "src/compiler/access-builder.h" |
| (...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 738 case Builtins::kNumberConstructor: | 738 case Builtins::kNumberConstructor: |
| 739 return ReduceNumberConstructor(node); | 739 return ReduceNumberConstructor(node); |
| 740 case Builtins::kObjectGetPrototypeOf: | 740 case Builtins::kObjectGetPrototypeOf: |
| 741 return ReduceObjectGetPrototypeOf(node); | 741 return ReduceObjectGetPrototypeOf(node); |
| 742 case Builtins::kObjectPrototypeGetProto: | 742 case Builtins::kObjectPrototypeGetProto: |
| 743 return ReduceObjectPrototypeGetProto(node); | 743 return ReduceObjectPrototypeGetProto(node); |
| 744 case Builtins::kReflectGetPrototypeOf: | 744 case Builtins::kReflectGetPrototypeOf: |
| 745 return ReduceReflectGetPrototypeOf(node); | 745 return ReduceReflectGetPrototypeOf(node); |
| 746 case Builtins::kArrayForEach: | 746 case Builtins::kArrayForEach: |
| 747 return ReduceArrayForEach(function, node); | 747 return ReduceArrayForEach(function, node); |
| 748 case Builtins::kReturnReceiver: |
| 749 return ReduceReturnReceiver(node); |
| 748 default: | 750 default: |
| 749 break; | 751 break; |
| 750 } | 752 } |
| 751 | 753 |
| 752 // Check for the Array constructor. | 754 // Check for the Array constructor. |
| 753 if (*function == function->native_context()->array_function()) { | 755 if (*function == function->native_context()->array_function()) { |
| 754 return ReduceArrayConstructor(node); | 756 return ReduceArrayConstructor(node); |
| 755 } | 757 } |
| 756 | 758 |
| 757 if (!FLAG_runtime_stats && shared->IsApiFunction()) { | 759 if (!FLAG_runtime_stats && shared->IsApiFunction()) { |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 995 | 997 |
| 996 Reduction JSCallReducer::ReduceJSConstructWithSpread(Node* node) { | 998 Reduction JSCallReducer::ReduceJSConstructWithSpread(Node* node) { |
| 997 DCHECK_EQ(IrOpcode::kJSConstructWithSpread, node->opcode()); | 999 DCHECK_EQ(IrOpcode::kJSConstructWithSpread, node->opcode()); |
| 998 SpreadWithArityParameter const& p = SpreadWithArityParameterOf(node->op()); | 1000 SpreadWithArityParameter const& p = SpreadWithArityParameterOf(node->op()); |
| 999 DCHECK_LE(3u, p.arity()); | 1001 DCHECK_LE(3u, p.arity()); |
| 1000 int arity = static_cast<int>(p.arity() - 2); | 1002 int arity = static_cast<int>(p.arity() - 2); |
| 1001 | 1003 |
| 1002 return ReduceSpreadCall(node, arity); | 1004 return ReduceSpreadCall(node, arity); |
| 1003 } | 1005 } |
| 1004 | 1006 |
| 1007 Reduction JSCallReducer::ReduceReturnReceiver(Node* node) { |
| 1008 DCHECK_EQ(IrOpcode::kJSCall, node->opcode()); |
| 1009 Node* receiver = NodeProperties::GetValueInput(node, 1); |
| 1010 ReplaceWithValue(node, receiver); |
| 1011 return Replace(receiver); |
| 1012 } |
| 1013 |
| 1005 Graph* JSCallReducer::graph() const { return jsgraph()->graph(); } | 1014 Graph* JSCallReducer::graph() const { return jsgraph()->graph(); } |
| 1006 | 1015 |
| 1007 Isolate* JSCallReducer::isolate() const { return jsgraph()->isolate(); } | 1016 Isolate* JSCallReducer::isolate() const { return jsgraph()->isolate(); } |
| 1008 | 1017 |
| 1009 Factory* JSCallReducer::factory() const { return isolate()->factory(); } | 1018 Factory* JSCallReducer::factory() const { return isolate()->factory(); } |
| 1010 | 1019 |
| 1011 Handle<JSGlobalProxy> JSCallReducer::global_proxy() const { | 1020 Handle<JSGlobalProxy> JSCallReducer::global_proxy() const { |
| 1012 return handle(JSGlobalProxy::cast(native_context()->global_proxy()), | 1021 return handle(JSGlobalProxy::cast(native_context()->global_proxy()), |
| 1013 isolate()); | 1022 isolate()); |
| 1014 } | 1023 } |
| 1015 | 1024 |
| 1016 CommonOperatorBuilder* JSCallReducer::common() const { | 1025 CommonOperatorBuilder* JSCallReducer::common() const { |
| 1017 return jsgraph()->common(); | 1026 return jsgraph()->common(); |
| 1018 } | 1027 } |
| 1019 | 1028 |
| 1020 JSOperatorBuilder* JSCallReducer::javascript() const { | 1029 JSOperatorBuilder* JSCallReducer::javascript() const { |
| 1021 return jsgraph()->javascript(); | 1030 return jsgraph()->javascript(); |
| 1022 } | 1031 } |
| 1023 | 1032 |
| 1024 SimplifiedOperatorBuilder* JSCallReducer::simplified() const { | 1033 SimplifiedOperatorBuilder* JSCallReducer::simplified() const { |
| 1025 return jsgraph()->simplified(); | 1034 return jsgraph()->simplified(); |
| 1026 } | 1035 } |
| 1027 | 1036 |
| 1028 } // namespace compiler | 1037 } // namespace compiler |
| 1029 } // namespace internal | 1038 } // namespace internal |
| 1030 } // namespace v8 | 1039 } // namespace v8 |
| OLD | NEW |