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/instruction-selector.h" | 5 #include "src/compiler/instruction-selector.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "src/base/adapters.h" | 9 #include "src/base/adapters.h" |
10 #include "src/compiler/instruction-selector-impl.h" | 10 #include "src/compiler/instruction-selector-impl.h" |
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 } | 571 } |
572 DCHECK_EQ(1u, buffer->instruction_args.size()); | 572 DCHECK_EQ(1u, buffer->instruction_args.size()); |
573 | 573 |
574 // If the call needs a frame state, we insert the state information as | 574 // If the call needs a frame state, we insert the state information as |
575 // follows (n is the number of value inputs to the frame state): | 575 // follows (n is the number of value inputs to the frame state): |
576 // arg 1 : deoptimization id. | 576 // arg 1 : deoptimization id. |
577 // arg 2 - arg (n + 1) : value inputs to the frame state. | 577 // arg 2 - arg (n + 1) : value inputs to the frame state. |
578 size_t frame_state_entries = 0; | 578 size_t frame_state_entries = 0; |
579 USE(frame_state_entries); // frame_state_entries is only used for debug. | 579 USE(frame_state_entries); // frame_state_entries is only used for debug. |
580 if (buffer->frame_state_descriptor != nullptr) { | 580 if (buffer->frame_state_descriptor != nullptr) { |
| 581 Node* frame_state = |
| 582 call->InputAt(static_cast<int>(buffer->descriptor->InputCount())); |
| 583 |
| 584 // If it was a syntactic tail call we need to drop the current frame and |
| 585 // an arguments adaptor frame on top of it (if the latter is present). |
| 586 if (buffer->descriptor->SupportsTailCalls()) { |
| 587 frame_state = NodeProperties::GetFrameStateInput(frame_state, 0); |
| 588 buffer->frame_state_descriptor = |
| 589 buffer->frame_state_descriptor->outer_state(); |
| 590 |
| 591 if (buffer->frame_state_descriptor != nullptr && |
| 592 buffer->frame_state_descriptor->type() == |
| 593 FrameStateType::kArgumentsAdaptor) { |
| 594 frame_state = NodeProperties::GetFrameStateInput(frame_state, 0); |
| 595 buffer->frame_state_descriptor = |
| 596 buffer->frame_state_descriptor->outer_state(); |
| 597 } |
| 598 } |
| 599 |
581 InstructionSequence::StateId state_id = | 600 InstructionSequence::StateId state_id = |
582 sequence()->AddFrameStateDescriptor(buffer->frame_state_descriptor); | 601 sequence()->AddFrameStateDescriptor(buffer->frame_state_descriptor); |
583 buffer->instruction_args.push_back(g.TempImmediate(state_id.ToInt())); | 602 buffer->instruction_args.push_back(g.TempImmediate(state_id.ToInt())); |
584 | 603 |
585 Node* frame_state = | |
586 call->InputAt(static_cast<int>(buffer->descriptor->InputCount())); | |
587 | |
588 StateObjectDeduplicator deduplicator(instruction_zone()); | 604 StateObjectDeduplicator deduplicator(instruction_zone()); |
589 | 605 |
590 frame_state_entries = | 606 frame_state_entries = |
591 1 + AddInputsToFrameStateDescriptor( | 607 1 + AddInputsToFrameStateDescriptor( |
592 buffer->frame_state_descriptor, frame_state, &g, &deduplicator, | 608 buffer->frame_state_descriptor, frame_state, &g, &deduplicator, |
593 &buffer->instruction_args, FrameStateInputKind::kStackSlot, | 609 &buffer->instruction_args, FrameStateInputKind::kStackSlot, |
594 instruction_zone()); | 610 instruction_zone()); |
595 | 611 |
596 DCHECK_EQ(1 + frame_state_entries, buffer->instruction_args.size()); | 612 DCHECK_EQ(1 + frame_state_entries, buffer->instruction_args.size()); |
597 } | 613 } |
(...skipping 1051 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1649 return new (instruction_zone()) FrameStateDescriptor( | 1665 return new (instruction_zone()) FrameStateDescriptor( |
1650 instruction_zone(), state_info.type(), state_info.bailout_id(), | 1666 instruction_zone(), state_info.type(), state_info.bailout_id(), |
1651 state_info.state_combine(), parameters, locals, stack, | 1667 state_info.state_combine(), parameters, locals, stack, |
1652 state_info.shared_info(), outer_state); | 1668 state_info.shared_info(), outer_state); |
1653 } | 1669 } |
1654 | 1670 |
1655 | 1671 |
1656 } // namespace compiler | 1672 } // namespace compiler |
1657 } // namespace internal | 1673 } // namespace internal |
1658 } // namespace v8 | 1674 } // namespace v8 |
OLD | NEW |