OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/crankshaft/arm64/lithium-arm64.h" | 5 #include "src/crankshaft/arm64/lithium-arm64.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "src/crankshaft/arm64/lithium-codegen-arm64.h" | 9 #include "src/crankshaft/arm64/lithium-codegen-arm64.h" |
10 #include "src/crankshaft/hydrogen-osr.h" | 10 #include "src/crankshaft/hydrogen-osr.h" |
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
707 #endif | 707 #endif |
708 | 708 |
709 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { | 709 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { |
710 instr = AssignPointerMap(instr); | 710 instr = AssignPointerMap(instr); |
711 } | 711 } |
712 if (FLAG_stress_environments && !instr->HasEnvironment()) { | 712 if (FLAG_stress_environments && !instr->HasEnvironment()) { |
713 instr = AssignEnvironment(instr); | 713 instr = AssignEnvironment(instr); |
714 } | 714 } |
715 chunk_->AddInstruction(instr, current_block_); | 715 chunk_->AddInstruction(instr, current_block_); |
716 | 716 |
717 if (instr->IsCall()) { | 717 CreateLazyBailoutForCall(current_block_, instr, hydrogen_val); |
718 HEnvironment* hydrogen_env = current_block_->last_environment(); | |
719 HValue* hydrogen_value_for_lazy_bailout = hydrogen_val; | |
720 DCHECK_NOT_NULL(hydrogen_env); | |
721 if (instr->IsSyntacticTailCall()) { | |
722 // If it was a syntactic tail call we need to drop the current frame and | |
723 // all the frames on top of it that are either an arguments adaptor frame | |
724 // or a tail caller frame. | |
725 hydrogen_env = hydrogen_env->outer(); | |
726 while (hydrogen_env != nullptr && | |
727 (hydrogen_env->frame_type() == ARGUMENTS_ADAPTOR || | |
728 hydrogen_env->frame_type() == TAIL_CALLER_FUNCTION)) { | |
729 hydrogen_env = hydrogen_env->outer(); | |
730 } | |
731 if (hydrogen_env != nullptr) { | |
732 // Push return value on top of outer environment. | |
733 hydrogen_env = hydrogen_env->Copy(); | |
734 hydrogen_env->Push(hydrogen_val); | |
735 } else { | |
736 // Although we don't need this lazy bailout for normal execution | |
737 // (because when we tail call from the outermost function we should pop | |
738 // its frame) we still need it when debugger is on. | |
739 hydrogen_env = current_block_->last_environment(); | |
740 } | |
741 } else { | |
742 if (hydrogen_val->HasObservableSideEffects()) { | |
743 HSimulate* sim = HSimulate::cast(hydrogen_val->next()); | |
744 sim->ReplayEnvironment(hydrogen_env); | |
745 hydrogen_value_for_lazy_bailout = sim; | |
746 } | |
747 } | |
748 LInstruction* bailout = LChunkBuilderBase::AssignEnvironment( | |
749 new (zone()) LLazyBailout(), hydrogen_env); | |
750 bailout->set_hydrogen_value(hydrogen_value_for_lazy_bailout); | |
751 chunk_->AddInstruction(bailout, current_block_); | |
752 } | |
753 } | 718 } |
754 | 719 |
755 | 720 |
756 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) { | 721 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) { |
757 HEnvironment* hydrogen_env = current_block_->last_environment(); | 722 HEnvironment* hydrogen_env = current_block_->last_environment(); |
758 return LChunkBuilderBase::AssignEnvironment(instr, hydrogen_env); | 723 return LChunkBuilderBase::AssignEnvironment(instr, hydrogen_env); |
759 } | 724 } |
760 | 725 |
761 | 726 |
762 LInstruction* LChunkBuilder::DoPrologue(HPrologue* instr) { | 727 LInstruction* LChunkBuilder::DoPrologue(HPrologue* instr) { |
(...skipping 1887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2650 | 2615 |
2651 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) { | 2616 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) { |
2652 LOperand* receiver = UseRegister(instr->receiver()); | 2617 LOperand* receiver = UseRegister(instr->receiver()); |
2653 LOperand* function = UseRegister(instr->function()); | 2618 LOperand* function = UseRegister(instr->function()); |
2654 LWrapReceiver* result = new(zone()) LWrapReceiver(receiver, function); | 2619 LWrapReceiver* result = new(zone()) LWrapReceiver(receiver, function); |
2655 return AssignEnvironment(DefineAsRegister(result)); | 2620 return AssignEnvironment(DefineAsRegister(result)); |
2656 } | 2621 } |
2657 | 2622 |
2658 } // namespace internal | 2623 } // namespace internal |
2659 } // namespace v8 | 2624 } // namespace v8 |
OLD | NEW |