| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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.h" | 5 #include "src/compiler/js-inlining.h" |
| 6 | 6 |
| 7 #include "src/ast.h" | 7 #include "src/ast.h" |
| 8 #include "src/ast-numbering.h" | 8 #include "src/ast-numbering.h" |
| 9 #include "src/compiler/all-nodes.h" | 9 #include "src/compiler/all-nodes.h" |
| 10 #include "src/compiler/ast-graph-builder.h" | 10 #include "src/compiler/ast-graph-builder.h" |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 Node* effect_output = jsgraph_->graph()->NewNode( | 204 Node* effect_output = jsgraph_->graph()->NewNode( |
| 205 jsgraph_->common()->EffectPhi(input_count), | 205 jsgraph_->common()->EffectPhi(input_count), |
| 206 static_cast<int>(effects.size()), &effects.front()); | 206 static_cast<int>(effects.size()), &effects.front()); |
| 207 | 207 |
| 208 ReplaceWithValue(call, value_output, effect_output, control_output); | 208 ReplaceWithValue(call, value_output, effect_output, control_output); |
| 209 | 209 |
| 210 return Changed(value_output); | 210 return Changed(value_output); |
| 211 } | 211 } |
| 212 | 212 |
| 213 | 213 |
| 214 Node* JSInliner::CreateArgumentsAdaptorFrameState(JSCallFunctionAccessor* call, | 214 Node* JSInliner::CreateArgumentsAdaptorFrameState( |
| 215 Zone* temp_zone) { | 215 JSCallFunctionAccessor* call, Handle<SharedFunctionInfo> shared_info, |
| 216 Zone* temp_zone) { |
| 216 const Operator* op = jsgraph_->common()->FrameState( | 217 const Operator* op = jsgraph_->common()->FrameState( |
| 217 FrameStateType::ARGUMENTS_ADAPTOR, BailoutId(-1), | 218 FrameStateType::ARGUMENTS_ADAPTOR, BailoutId(-1), |
| 218 OutputFrameStateCombine::Ignore()); | 219 OutputFrameStateCombine::Ignore(), shared_info); |
| 219 const Operator* op0 = jsgraph_->common()->StateValues(0); | 220 const Operator* op0 = jsgraph_->common()->StateValues(0); |
| 220 Node* node0 = jsgraph_->graph()->NewNode(op0); | 221 Node* node0 = jsgraph_->graph()->NewNode(op0); |
| 221 NodeVector params(temp_zone); | 222 NodeVector params(temp_zone); |
| 222 params.push_back(call->receiver()); | 223 params.push_back(call->receiver()); |
| 223 for (size_t argument = 0; argument != call->formal_arguments(); ++argument) { | 224 for (size_t argument = 0; argument != call->formal_arguments(); ++argument) { |
| 224 params.push_back(call->formal_argument(argument)); | 225 params.push_back(call->formal_argument(argument)); |
| 225 } | 226 } |
| 226 const Operator* op_param = | 227 const Operator* op_param = |
| 227 jsgraph_->common()->StateValues(static_cast<int>(params.size())); | 228 jsgraph_->common()->StateValues(static_cast<int>(params.size())); |
| 228 Node* params_node = jsgraph_->graph()->NewNode( | 229 Node* params_node = jsgraph_->graph()->NewNode( |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 Node* frame_state = call.frame_state(); | 291 Node* frame_state = call.frame_state(); |
| 291 size_t const inlinee_formal_parameters = start->op()->ValueOutputCount() - 3; | 292 size_t const inlinee_formal_parameters = start->op()->ValueOutputCount() - 3; |
| 292 // Insert argument adaptor frame if required. | 293 // Insert argument adaptor frame if required. |
| 293 if (call.formal_arguments() != inlinee_formal_parameters) { | 294 if (call.formal_arguments() != inlinee_formal_parameters) { |
| 294 // In strong mode, in case of too few arguments we need to throw a | 295 // In strong mode, in case of too few arguments we need to throw a |
| 295 // TypeError so we must not inline this call. | 296 // TypeError so we must not inline this call. |
| 296 if (is_strong(info.language_mode()) && | 297 if (is_strong(info.language_mode()) && |
| 297 call.formal_arguments() < inlinee_formal_parameters) { | 298 call.formal_arguments() < inlinee_formal_parameters) { |
| 298 return NoChange(); | 299 return NoChange(); |
| 299 } | 300 } |
| 300 frame_state = CreateArgumentsAdaptorFrameState(&call, info.zone()); | 301 frame_state = CreateArgumentsAdaptorFrameState(&call, info.shared_info(), |
| 302 info.zone()); |
| 301 } | 303 } |
| 302 | 304 |
| 303 return InlineCall(node, frame_state, start, end); | 305 return InlineCall(node, frame_state, start, end); |
| 304 } | 306 } |
| 305 | 307 |
| 306 } // namespace compiler | 308 } // namespace compiler |
| 307 } // namespace internal | 309 } // namespace internal |
| 308 } // namespace v8 | 310 } // namespace v8 |
| OLD | NEW |