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-inlining-heuristic.h" | 5 #include "src/compiler/js-inlining-heuristic.h" |
6 | 6 |
7 #include "src/compilation-info.h" | 7 #include "src/compilation-info.h" |
8 #include "src/compiler/common-operator.h" | 8 #include "src/compiler/common-operator.h" |
9 #include "src/compiler/node-matchers.h" | 9 #include "src/compiler/node-matchers.h" |
10 #include "src/compiler/simplified-operator.h" | 10 #include "src/compiler/simplified-operator.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 "Not considering call site #%d:%s, because inlining depth " | 110 "Not considering call site #%d:%s, because inlining depth " |
111 "%d exceeds maximum allowed level %d\n", | 111 "%d exceeds maximum allowed level %d\n", |
112 node->id(), node->op()->mnemonic(), level, | 112 node->id(), node->op()->mnemonic(), level, |
113 FLAG_max_inlining_levels); | 113 FLAG_max_inlining_levels); |
114 return NoChange(); | 114 return NoChange(); |
115 } | 115 } |
116 } | 116 } |
117 } | 117 } |
118 | 118 |
119 // Gather feedback on how often this call site has been hit before. | 119 // Gather feedback on how often this call site has been hit before. |
120 if (node->opcode() == IrOpcode::kJSCallFunction) { | 120 if (node->opcode() == IrOpcode::kJSCall) { |
121 CallFunctionParameters const p = CallFunctionParametersOf(node->op()); | 121 CallParameters const p = CallParametersOf(node->op()); |
122 candidate.frequency = p.frequency(); | 122 candidate.frequency = p.frequency(); |
123 } else { | 123 } else { |
124 ConstructParameters const p = ConstructParametersOf(node->op()); | 124 ConstructParameters const p = ConstructParametersOf(node->op()); |
125 candidate.frequency = p.frequency(); | 125 candidate.frequency = p.frequency(); |
126 } | 126 } |
127 | 127 |
128 // Handling of special inlining modes right away: | 128 // Handling of special inlining modes right away: |
129 // - For restricted inlining: stop all handling at this point. | 129 // - For restricted inlining: stop all handling at this point. |
130 // - For stressing inlining: immediately handle all functions. | 130 // - For stressing inlining: immediately handle all functions. |
131 switch (mode_) { | 131 switch (mode_) { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 Node* const node = candidate.node; | 168 Node* const node = candidate.node; |
169 if (num_calls == 1) { | 169 if (num_calls == 1) { |
170 Handle<JSFunction> function = candidate.functions[0]; | 170 Handle<JSFunction> function = candidate.functions[0]; |
171 Reduction const reduction = inliner_.ReduceJSCall(node, function); | 171 Reduction const reduction = inliner_.ReduceJSCall(node, function); |
172 if (reduction.Changed()) { | 172 if (reduction.Changed()) { |
173 cumulative_count_ += function->shared()->ast_node_count(); | 173 cumulative_count_ += function->shared()->ast_node_count(); |
174 } | 174 } |
175 return reduction; | 175 return reduction; |
176 } | 176 } |
177 | 177 |
178 // Expand the JSCallFunction/JSConstruct node to a subgraph first if | 178 // Expand the JSCall/JSConstruct node to a subgraph first if |
179 // we have multiple known target functions. | 179 // we have multiple known target functions. |
180 DCHECK_LT(1, num_calls); | 180 DCHECK_LT(1, num_calls); |
181 Node* calls[kMaxCallPolymorphism + 1]; | 181 Node* calls[kMaxCallPolymorphism + 1]; |
182 Node* if_successes[kMaxCallPolymorphism]; | 182 Node* if_successes[kMaxCallPolymorphism]; |
183 Node* callee = NodeProperties::GetValueInput(node, 0); | 183 Node* callee = NodeProperties::GetValueInput(node, 0); |
184 Node* fallthrough_control = NodeProperties::GetControlInput(node); | 184 Node* fallthrough_control = NodeProperties::GetControlInput(node); |
185 | 185 |
186 // Setup the inputs for the cloned call nodes. | 186 // Setup the inputs for the cloned call nodes. |
187 int const input_count = node->InputCount(); | 187 int const input_count = node->InputCount(); |
188 Node** inputs = graph()->zone()->NewArray<Node*>(input_count); | 188 Node** inputs = graph()->zone()->NewArray<Node*>(input_count); |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 return jsgraph()->common(); | 294 return jsgraph()->common(); |
295 } | 295 } |
296 | 296 |
297 SimplifiedOperatorBuilder* JSInliningHeuristic::simplified() const { | 297 SimplifiedOperatorBuilder* JSInliningHeuristic::simplified() const { |
298 return jsgraph()->simplified(); | 298 return jsgraph()->simplified(); |
299 } | 299 } |
300 | 300 |
301 } // namespace compiler | 301 } // namespace compiler |
302 } // namespace internal | 302 } // namespace internal |
303 } // namespace v8 | 303 } // namespace v8 |
OLD | NEW |