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 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 if (call.formal_arguments() != inlinee.formal_parameters()) { | 344 if (call.formal_arguments() != inlinee.formal_parameters()) { |
345 // In strong mode, in case of too few arguments we need to throw a | 345 // In strong mode, in case of too few arguments we need to throw a |
346 // TypeError so we must not inline this call. | 346 // TypeError so we must not inline this call. |
347 if (is_strong(info.language_mode()) && | 347 if (is_strong(info.language_mode()) && |
348 call.formal_arguments() < inlinee.formal_parameters()) { | 348 call.formal_arguments() < inlinee.formal_parameters()) { |
349 return NoChange(); | 349 return NoChange(); |
350 } | 350 } |
351 outer_frame_state = CreateArgumentsAdaptorFrameState(&call, info.zone()); | 351 outer_frame_state = CreateArgumentsAdaptorFrameState(&call, info.zone()); |
352 } | 352 } |
353 | 353 |
354 for (Node* node : visitor.copies()) { | 354 // Fix up all outer frame states from the inlinee. |
355 if (node && node->opcode() == IrOpcode::kFrameState) { | 355 for (Node* const node : visitor.copies()) { |
| 356 if (node->opcode() == IrOpcode::kFrameState) { |
356 DCHECK_EQ(1, OperatorProperties::GetFrameStateInputCount(node->op())); | 357 DCHECK_EQ(1, OperatorProperties::GetFrameStateInputCount(node->op())); |
357 NodeProperties::ReplaceFrameStateInput(node, 0, outer_frame_state); | 358 // Don't touch this frame state, if it already has an "outer frame state". |
| 359 if (NodeProperties::GetFrameStateInput(node, 0)->opcode() != |
| 360 IrOpcode::kFrameState) { |
| 361 NodeProperties::ReplaceFrameStateInput(node, 0, outer_frame_state); |
| 362 } |
358 } | 363 } |
359 } | 364 } |
360 | 365 |
361 return InlineCall(node, inlinee); | 366 return InlineCall(node, inlinee); |
362 } | 367 } |
363 | 368 |
364 } // namespace compiler | 369 } // namespace compiler |
365 } // namespace internal | 370 } // namespace internal |
366 } // namespace v8 | 371 } // namespace v8 |
OLD | NEW |