OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 "mips/lithium-mips.h" | 8 #include "mips/lithium-mips.h" |
9 #include "mips/lithium-codegen-mips.h" | 9 #include "mips/lithium-codegen-mips.h" |
10 #include "hydrogen-osr.h" | 10 #include "hydrogen-osr.h" |
(...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
835 dummy->set_hydrogen_value(current); | 835 dummy->set_hydrogen_value(current); |
836 chunk_->AddInstruction(dummy, current_block_); | 836 chunk_->AddInstruction(dummy, current_block_); |
837 } | 837 } |
838 } else { | 838 } else { |
839 instr = current->CompileToLithium(this); | 839 instr = current->CompileToLithium(this); |
840 } | 840 } |
841 | 841 |
842 argument_count_ += current->argument_delta(); | 842 argument_count_ += current->argument_delta(); |
843 ASSERT(argument_count_ >= 0); | 843 ASSERT(argument_count_ >= 0); |
844 | 844 |
| 845 CheckAndAddInstruction(instr, current); |
| 846 |
| 847 current_instruction_ = old_current; |
| 848 } |
| 849 |
| 850 |
| 851 void LChunkBuilder::CheckAndAddInstruction(LInstruction* instr, |
| 852 HInstruction* hydrogen_val) { |
845 if (instr != NULL) { | 853 if (instr != NULL) { |
846 // Associate the hydrogen instruction first, since we may need it for | 854 // Associate the hydrogen instruction first, since we may need it for |
847 // the ClobbersRegisters() or ClobbersDoubleRegisters() calls below. | 855 // the ClobbersRegisters() or ClobbersDoubleRegisters() calls below. |
848 instr->set_hydrogen_value(current); | 856 instr->set_hydrogen_value(hydrogen_val); |
849 | 857 |
850 #if DEBUG | 858 #if DEBUG |
851 // Make sure that the lithium instruction has either no fixed register | 859 // Make sure that the lithium instruction has either no fixed register |
852 // constraints in temps or the result OR no uses that are only used at | 860 // constraints in temps or the result OR no uses that are only used at |
853 // start. If this invariant doesn't hold, the register allocator can decide | 861 // start. If this invariant doesn't hold, the register allocator can decide |
854 // to insert a split of a range immediately before the instruction due to an | 862 // to insert a split of a range immediately before the instruction due to an |
855 // already allocated register needing to be used for the instruction's fixed | 863 // already allocated register needing to be used for the instruction's fixed |
856 // register constraint. In this case, The register allocator won't see an | 864 // register constraint. In this case, The register allocator won't see an |
857 // interference between the split child and the use-at-start (it would if | 865 // interference between the split child and the use-at-start (it would if |
858 // the it was just a plain use), so it is free to move the split child into | 866 // the it was just a plain use), so it is free to move the split child into |
(...skipping 20 matching lines...) Expand all Loading... |
879 | 887 |
880 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { | 888 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { |
881 instr = AssignPointerMap(instr); | 889 instr = AssignPointerMap(instr); |
882 } | 890 } |
883 if (FLAG_stress_environments && !instr->HasEnvironment()) { | 891 if (FLAG_stress_environments && !instr->HasEnvironment()) { |
884 instr = AssignEnvironment(instr); | 892 instr = AssignEnvironment(instr); |
885 } | 893 } |
886 chunk_->AddInstruction(instr, current_block_); | 894 chunk_->AddInstruction(instr, current_block_); |
887 | 895 |
888 if (instr->IsCall()) { | 896 if (instr->IsCall()) { |
889 HValue* hydrogen_value_for_lazy_bailout = current; | 897 HValue* hydrogen_value_for_lazy_bailout = hydrogen_val; |
890 LInstruction* instruction_needing_environment = NULL; | 898 LInstruction* instruction_needing_environment = NULL; |
891 if (current->HasObservableSideEffects()) { | 899 if (hydrogen_val->HasObservableSideEffects()) { |
892 HSimulate* sim = HSimulate::cast(current->next()); | 900 HSimulate* sim = HSimulate::cast(hydrogen_val->next()); |
893 instruction_needing_environment = instr; | 901 instruction_needing_environment = instr; |
894 sim->ReplayEnvironment(current_block_->last_environment()); | 902 sim->ReplayEnvironment(current_block_->last_environment()); |
895 hydrogen_value_for_lazy_bailout = sim; | 903 hydrogen_value_for_lazy_bailout = sim; |
896 } | 904 } |
897 LInstruction* bailout = AssignEnvironment(new(zone()) LLazyBailout()); | 905 LInstruction* bailout = AssignEnvironment(new(zone()) LLazyBailout()); |
898 bailout->set_hydrogen_value(hydrogen_value_for_lazy_bailout); | 906 bailout->set_hydrogen_value(hydrogen_value_for_lazy_bailout); |
899 chunk_->AddInstruction(bailout, current_block_); | 907 chunk_->AddInstruction(bailout, current_block_); |
900 if (instruction_needing_environment != NULL) { | 908 if (instruction_needing_environment != NULL) { |
901 // Store the lazy deopt environment with the instruction if needed. | 909 // Store the lazy deopt environment with the instruction if needed. |
902 // Right now it is only used for LInstanceOfKnownGlobal. | 910 // Right now it is only used for LInstanceOfKnownGlobal. |
903 instruction_needing_environment-> | 911 instruction_needing_environment-> |
904 SetDeferredLazyDeoptimizationEnvironment(bailout->environment()); | 912 SetDeferredLazyDeoptimizationEnvironment(bailout->environment()); |
905 } | 913 } |
906 } | 914 } |
907 } | 915 } |
908 current_instruction_ = old_current; | |
909 } | 916 } |
910 | 917 |
911 | 918 |
912 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { | 919 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { |
913 return new(zone()) LGoto(instr->FirstSuccessor()); | 920 return new(zone()) LGoto(instr->FirstSuccessor()); |
914 } | 921 } |
915 | 922 |
916 | 923 |
917 LInstruction* LChunkBuilder::DoBranch(HBranch* instr) { | 924 LInstruction* LChunkBuilder::DoBranch(HBranch* instr) { |
918 LInstruction* goto_instr = CheckElideControlInstruction(instr); | 925 LInstruction* goto_instr = CheckElideControlInstruction(instr); |
(...skipping 1597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2516 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2523 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2517 LOperand* object = UseRegister(instr->object()); | 2524 LOperand* object = UseRegister(instr->object()); |
2518 LOperand* index = UseTempRegister(instr->index()); | 2525 LOperand* index = UseTempRegister(instr->index()); |
2519 LLoadFieldByIndex* load = new(zone()) LLoadFieldByIndex(object, index); | 2526 LLoadFieldByIndex* load = new(zone()) LLoadFieldByIndex(object, index); |
2520 LInstruction* result = DefineSameAsFirst(load); | 2527 LInstruction* result = DefineSameAsFirst(load); |
2521 return AssignPointerMap(result); | 2528 return AssignPointerMap(result); |
2522 } | 2529 } |
2523 | 2530 |
2524 | 2531 |
2525 } } // namespace v8::internal | 2532 } } // namespace v8::internal |
OLD | NEW |