| 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 "v8.h" | 5 #include "v8.h" |
| 6 | 6 |
| 7 #include "lithium-allocator-inl.h" | 7 #include "lithium-allocator-inl.h" |
| 8 #include "arm64/lithium-arm64.h" | 8 #include "arm64/lithium-arm64.h" |
| 9 #include "arm64/lithium-codegen-arm64.h" | 9 #include "arm64/lithium-codegen-arm64.h" |
| 10 #include "hydrogen-osr.h" | 10 #include "hydrogen-osr.h" |
| (...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 671 dummy->set_hydrogen_value(current); | 671 dummy->set_hydrogen_value(current); |
| 672 chunk_->AddInstruction(dummy, current_block_); | 672 chunk_->AddInstruction(dummy, current_block_); |
| 673 } | 673 } |
| 674 } else { | 674 } else { |
| 675 instr = current->CompileToLithium(this); | 675 instr = current->CompileToLithium(this); |
| 676 } | 676 } |
| 677 | 677 |
| 678 argument_count_ += current->argument_delta(); | 678 argument_count_ += current->argument_delta(); |
| 679 ASSERT(argument_count_ >= 0); | 679 ASSERT(argument_count_ >= 0); |
| 680 | 680 |
| 681 CheckAndAddInstruction(instr, current); |
| 682 |
| 683 current_instruction_ = old_current; |
| 684 } |
| 685 |
| 686 |
| 687 void LChunkBuilder::CheckAndAddInstruction(LInstruction* instr, |
| 688 HInstruction* hydrogen_val) { |
| 681 if (instr != NULL) { | 689 if (instr != NULL) { |
| 682 // Associate the hydrogen instruction first, since we may need it for | 690 // Associate the hydrogen instruction first, since we may need it for |
| 683 // the ClobbersRegisters() or ClobbersDoubleRegisters() calls below. | 691 // the ClobbersRegisters() or ClobbersDoubleRegisters() calls below. |
| 684 instr->set_hydrogen_value(current); | 692 instr->set_hydrogen_value(hydrogen_val); |
| 685 | 693 |
| 686 #if DEBUG | 694 #if DEBUG |
| 687 // Make sure that the lithium instruction has either no fixed register | 695 // Make sure that the lithium instruction has either no fixed register |
| 688 // constraints in temps or the result OR no uses that are only used at | 696 // constraints in temps or the result OR no uses that are only used at |
| 689 // start. If this invariant doesn't hold, the register allocator can decide | 697 // start. If this invariant doesn't hold, the register allocator can decide |
| 690 // to insert a split of a range immediately before the instruction due to an | 698 // to insert a split of a range immediately before the instruction due to an |
| 691 // already allocated register needing to be used for the instruction's fixed | 699 // already allocated register needing to be used for the instruction's fixed |
| 692 // register constraint. In this case, the register allocator won't see an | 700 // register constraint. In this case, the register allocator won't see an |
| 693 // interference between the split child and the use-at-start (it would if | 701 // interference between the split child and the use-at-start (it would if |
| 694 // the it was just a plain use), so it is free to move the split child into | 702 // the it was just a plain use), so it is free to move the split child into |
| (...skipping 20 matching lines...) Expand all Loading... |
| 715 | 723 |
| 716 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { | 724 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { |
| 717 instr = AssignPointerMap(instr); | 725 instr = AssignPointerMap(instr); |
| 718 } | 726 } |
| 719 if (FLAG_stress_environments && !instr->HasEnvironment()) { | 727 if (FLAG_stress_environments && !instr->HasEnvironment()) { |
| 720 instr = AssignEnvironment(instr); | 728 instr = AssignEnvironment(instr); |
| 721 } | 729 } |
| 722 chunk_->AddInstruction(instr, current_block_); | 730 chunk_->AddInstruction(instr, current_block_); |
| 723 | 731 |
| 724 if (instr->IsCall()) { | 732 if (instr->IsCall()) { |
| 725 HValue* hydrogen_value_for_lazy_bailout = current; | 733 HValue* hydrogen_value_for_lazy_bailout = hydrogen_val; |
| 726 LInstruction* instruction_needing_environment = NULL; | 734 LInstruction* instruction_needing_environment = NULL; |
| 727 if (current->HasObservableSideEffects()) { | 735 if (hydrogen_val->HasObservableSideEffects()) { |
| 728 HSimulate* sim = HSimulate::cast(current->next()); | 736 HSimulate* sim = HSimulate::cast(hydrogen_val->next()); |
| 729 instruction_needing_environment = instr; | 737 instruction_needing_environment = instr; |
| 730 sim->ReplayEnvironment(current_block_->last_environment()); | 738 sim->ReplayEnvironment(current_block_->last_environment()); |
| 731 hydrogen_value_for_lazy_bailout = sim; | 739 hydrogen_value_for_lazy_bailout = sim; |
| 732 } | 740 } |
| 733 LInstruction* bailout = AssignEnvironment(new(zone()) LLazyBailout()); | 741 LInstruction* bailout = AssignEnvironment(new(zone()) LLazyBailout()); |
| 734 bailout->set_hydrogen_value(hydrogen_value_for_lazy_bailout); | 742 bailout->set_hydrogen_value(hydrogen_value_for_lazy_bailout); |
| 735 chunk_->AddInstruction(bailout, current_block_); | 743 chunk_->AddInstruction(bailout, current_block_); |
| 736 if (instruction_needing_environment != NULL) { | 744 if (instruction_needing_environment != NULL) { |
| 737 // Store the lazy deopt environment with the instruction if needed. | 745 // Store the lazy deopt environment with the instruction if needed. |
| 738 // Right now it is only used for LInstanceOfKnownGlobal. | 746 // Right now it is only used for LInstanceOfKnownGlobal. |
| 739 instruction_needing_environment-> | 747 instruction_needing_environment-> |
| 740 SetDeferredLazyDeoptimizationEnvironment(bailout->environment()); | 748 SetDeferredLazyDeoptimizationEnvironment(bailout->environment()); |
| 741 } | 749 } |
| 742 } | 750 } |
| 743 } | 751 } |
| 744 current_instruction_ = old_current; | |
| 745 } | 752 } |
| 746 | 753 |
| 747 | 754 |
| 748 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) { | 755 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) { |
| 749 HEnvironment* hydrogen_env = current_block_->last_environment(); | 756 HEnvironment* hydrogen_env = current_block_->last_environment(); |
| 750 int argument_index_accumulator = 0; | 757 int argument_index_accumulator = 0; |
| 751 ZoneList<HValue*> objects_to_materialize(0, zone()); | 758 ZoneList<HValue*> objects_to_materialize(0, zone()); |
| 752 instr->set_environment(CreateEnvironment(hydrogen_env, | 759 instr->set_environment(CreateEnvironment(hydrogen_env, |
| 753 &argument_index_accumulator, | 760 &argument_index_accumulator, |
| 754 &objects_to_materialize)); | 761 &objects_to_materialize)); |
| (...skipping 1947 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2702 | 2709 |
| 2703 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) { | 2710 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) { |
| 2704 LOperand* receiver = UseRegister(instr->receiver()); | 2711 LOperand* receiver = UseRegister(instr->receiver()); |
| 2705 LOperand* function = UseRegister(instr->function()); | 2712 LOperand* function = UseRegister(instr->function()); |
| 2706 LWrapReceiver* result = new(zone()) LWrapReceiver(receiver, function); | 2713 LWrapReceiver* result = new(zone()) LWrapReceiver(receiver, function); |
| 2707 return AssignEnvironment(DefineAsRegister(result)); | 2714 return AssignEnvironment(DefineAsRegister(result)); |
| 2708 } | 2715 } |
| 2709 | 2716 |
| 2710 | 2717 |
| 2711 } } // namespace v8::internal | 2718 } } // namespace v8::internal |
| OLD | NEW |