| 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 } else if (arity == 3) { | 117 } else if (arity == 3) { |
| 118 // The argArray was not provided, just remove the {target}. | 118 // The argArray was not provided, just remove the {target}. |
| 119 node->RemoveInput(0); | 119 node->RemoveInput(0); |
| 120 --arity; | 120 --arity; |
| 121 } else if (arity == 4) { | 121 } else if (arity == 4) { |
| 122 // Check if argArray is an arguments object, and {node} is the only value | 122 // Check if argArray is an arguments object, and {node} is the only value |
| 123 // user of argArray (except for value uses in frame states). | 123 // user of argArray (except for value uses in frame states). |
| 124 Node* arg_array = NodeProperties::GetValueInput(node, 3); | 124 Node* arg_array = NodeProperties::GetValueInput(node, 3); |
| 125 if (arg_array->opcode() != IrOpcode::kJSCreateArguments) return NoChange(); | 125 if (arg_array->opcode() != IrOpcode::kJSCreateArguments) return NoChange(); |
| 126 for (Edge edge : arg_array->use_edges()) { | 126 for (Edge edge : arg_array->use_edges()) { |
| 127 if (edge.from()->opcode() == IrOpcode::kStateValues) continue; | 127 Node* user = edge.from(); |
| 128 // Ignore uses as frame state's locals or parameters. |
| 129 if (user->opcode() == IrOpcode::kStateValues) continue; |
| 130 // Ignore uses as frame state's accumulator. |
| 131 if (user->opcode() == IrOpcode::kFrameState && |
| 132 user->InputAt(2) == arg_array) { |
| 133 continue; |
| 134 } |
| 128 if (!NodeProperties::IsValueEdge(edge)) continue; | 135 if (!NodeProperties::IsValueEdge(edge)) continue; |
| 129 if (edge.from() == node) continue; | 136 if (edge.from() == node) continue; |
| 130 return NoChange(); | 137 return NoChange(); |
| 131 } | 138 } |
| 132 // Check if the arguments can be handled in the fast case (i.e. we don't | 139 // Check if the arguments can be handled in the fast case (i.e. we don't |
| 133 // have aliased sloppy arguments), and compute the {start_index} for | 140 // have aliased sloppy arguments), and compute the {start_index} for |
| 134 // rest parameters. | 141 // rest parameters. |
| 135 CreateArgumentsType const type = CreateArgumentsTypeOf(arg_array->op()); | 142 CreateArgumentsType const type = CreateArgumentsTypeOf(arg_array->op()); |
| 136 Node* frame_state = NodeProperties::GetFrameStateInput(arg_array); | 143 Node* frame_state = NodeProperties::GetFrameStateInput(arg_array); |
| 137 FrameStateInfo state_info = OpParameter<FrameStateInfo>(frame_state); | 144 FrameStateInfo state_info = OpParameter<FrameStateInfo>(frame_state); |
| (...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 851 return jsgraph()->javascript(); | 858 return jsgraph()->javascript(); |
| 852 } | 859 } |
| 853 | 860 |
| 854 SimplifiedOperatorBuilder* JSCallReducer::simplified() const { | 861 SimplifiedOperatorBuilder* JSCallReducer::simplified() const { |
| 855 return jsgraph()->simplified(); | 862 return jsgraph()->simplified(); |
| 856 } | 863 } |
| 857 | 864 |
| 858 } // namespace compiler | 865 } // namespace compiler |
| 859 } // namespace internal | 866 } // namespace internal |
| 860 } // namespace v8 | 867 } // namespace v8 |
| OLD | NEW |