Chromium Code Reviews| 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 "arm/lithium-arm.h" | 8 #include "arm/lithium-arm.h" |
| 9 #include "arm/lithium-codegen-arm.h" | 9 #include "arm/lithium-codegen-arm.h" |
| 10 #include "hydrogen-osr.h" | 10 #include "hydrogen-osr.h" |
| (...skipping 816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 827 dummy->set_hydrogen_value(current); | 827 dummy->set_hydrogen_value(current); |
| 828 chunk_->AddInstruction(dummy, current_block_); | 828 chunk_->AddInstruction(dummy, current_block_); |
| 829 } | 829 } |
| 830 } else { | 830 } else { |
| 831 instr = current->CompileToLithium(this); | 831 instr = current->CompileToLithium(this); |
| 832 } | 832 } |
| 833 | 833 |
| 834 argument_count_ += current->argument_delta(); | 834 argument_count_ += current->argument_delta(); |
| 835 ASSERT(argument_count_ >= 0); | 835 ASSERT(argument_count_ >= 0); |
| 836 | 836 |
| 837 CheckAndAddInstruction(instr, current); | |
| 838 | |
| 839 current_instruction_ = old_current; | |
| 840 } | |
| 841 | |
| 842 | |
| 843 void LChunkBuilder::CheckAndAddInstruction(LInstruction* instr, | |
|
Jakob Kummerow
2014/05/22 12:59:46
I'd call this just AddInstruction...
Alexandre Rames
2014/05/22 13:15:43
Done.
| |
| 844 HInstruction* hydrogen_val) { | |
| 837 if (instr != NULL) { | 845 if (instr != NULL) { |
|
Jakob Kummerow
2014/05/22 12:59:46
...and move this check to the caller. I don't thin
Alexandre Rames
2014/05/22 13:15:43
Done.
| |
| 838 // Associate the hydrogen instruction first, since we may need it for | 846 // Associate the hydrogen instruction first, since we may need it for |
| 839 // the ClobbersRegisters() or ClobbersDoubleRegisters() calls below. | 847 // the ClobbersRegisters() or ClobbersDoubleRegisters() calls below. |
| 840 instr->set_hydrogen_value(current); | 848 instr->set_hydrogen_value(hydrogen_val); |
| 841 | 849 |
| 842 #if DEBUG | 850 #if DEBUG |
| 843 // Make sure that the lithium instruction has either no fixed register | 851 // Make sure that the lithium instruction has either no fixed register |
| 844 // constraints in temps or the result OR no uses that are only used at | 852 // constraints in temps or the result OR no uses that are only used at |
| 845 // start. If this invariant doesn't hold, the register allocator can decide | 853 // start. If this invariant doesn't hold, the register allocator can decide |
| 846 // to insert a split of a range immediately before the instruction due to an | 854 // to insert a split of a range immediately before the instruction due to an |
| 847 // already allocated register needing to be used for the instruction's fixed | 855 // already allocated register needing to be used for the instruction's fixed |
| 848 // register constraint. In this case, The register allocator won't see an | 856 // register constraint. In this case, The register allocator won't see an |
| 849 // interference between the split child and the use-at-start (it would if | 857 // interference between the split child and the use-at-start (it would if |
| 850 // the it was just a plain use), so it is free to move the split child into | 858 // the it was just a plain use), so it is free to move the split child into |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 871 | 879 |
| 872 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { | 880 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { |
| 873 instr = AssignPointerMap(instr); | 881 instr = AssignPointerMap(instr); |
| 874 } | 882 } |
| 875 if (FLAG_stress_environments && !instr->HasEnvironment()) { | 883 if (FLAG_stress_environments && !instr->HasEnvironment()) { |
| 876 instr = AssignEnvironment(instr); | 884 instr = AssignEnvironment(instr); |
| 877 } | 885 } |
| 878 chunk_->AddInstruction(instr, current_block_); | 886 chunk_->AddInstruction(instr, current_block_); |
| 879 | 887 |
| 880 if (instr->IsCall()) { | 888 if (instr->IsCall()) { |
| 881 HValue* hydrogen_value_for_lazy_bailout = current; | 889 HValue* hydrogen_value_for_lazy_bailout = hydrogen_val; |
| 882 LInstruction* instruction_needing_environment = NULL; | 890 LInstruction* instruction_needing_environment = NULL; |
| 883 if (current->HasObservableSideEffects()) { | 891 if (hydrogen_val->HasObservableSideEffects()) { |
| 884 HSimulate* sim = HSimulate::cast(current->next()); | 892 HSimulate* sim = HSimulate::cast(hydrogen_val->next()); |
| 885 instruction_needing_environment = instr; | 893 instruction_needing_environment = instr; |
| 886 sim->ReplayEnvironment(current_block_->last_environment()); | 894 sim->ReplayEnvironment(current_block_->last_environment()); |
| 887 hydrogen_value_for_lazy_bailout = sim; | 895 hydrogen_value_for_lazy_bailout = sim; |
| 888 } | 896 } |
| 889 LInstruction* bailout = AssignEnvironment(new(zone()) LLazyBailout()); | 897 LInstruction* bailout = AssignEnvironment(new(zone()) LLazyBailout()); |
| 890 bailout->set_hydrogen_value(hydrogen_value_for_lazy_bailout); | 898 bailout->set_hydrogen_value(hydrogen_value_for_lazy_bailout); |
| 891 chunk_->AddInstruction(bailout, current_block_); | 899 chunk_->AddInstruction(bailout, current_block_); |
| 892 if (instruction_needing_environment != NULL) { | 900 if (instruction_needing_environment != NULL) { |
| 893 // Store the lazy deopt environment with the instruction if needed. | 901 // Store the lazy deopt environment with the instruction if needed. |
| 894 // Right now it is only used for LInstanceOfKnownGlobal. | 902 // Right now it is only used for LInstanceOfKnownGlobal. |
| 895 instruction_needing_environment-> | 903 instruction_needing_environment-> |
| 896 SetDeferredLazyDeoptimizationEnvironment(bailout->environment()); | 904 SetDeferredLazyDeoptimizationEnvironment(bailout->environment()); |
| 897 } | 905 } |
| 898 } | 906 } |
| 899 } | 907 } |
| 900 current_instruction_ = old_current; | |
| 901 } | 908 } |
| 902 | 909 |
| 903 | 910 |
| 904 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { | 911 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { |
| 905 return new(zone()) LGoto(instr->FirstSuccessor()); | 912 return new(zone()) LGoto(instr->FirstSuccessor()); |
| 906 } | 913 } |
| 907 | 914 |
| 908 | 915 |
| 909 LInstruction* LChunkBuilder::DoBranch(HBranch* instr) { | 916 LInstruction* LChunkBuilder::DoBranch(HBranch* instr) { |
| 910 LInstruction* goto_instr = CheckElideControlInstruction(instr); | 917 LInstruction* goto_instr = CheckElideControlInstruction(instr); |
| (...skipping 1653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2564 | 2571 |
| 2565 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2572 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
| 2566 LOperand* object = UseRegister(instr->object()); | 2573 LOperand* object = UseRegister(instr->object()); |
| 2567 LOperand* index = UseTempRegister(instr->index()); | 2574 LOperand* index = UseTempRegister(instr->index()); |
| 2568 LLoadFieldByIndex* load = new(zone()) LLoadFieldByIndex(object, index); | 2575 LLoadFieldByIndex* load = new(zone()) LLoadFieldByIndex(object, index); |
| 2569 LInstruction* result = DefineSameAsFirst(load); | 2576 LInstruction* result = DefineSameAsFirst(load); |
| 2570 return AssignPointerMap(result); | 2577 return AssignPointerMap(result); |
| 2571 } | 2578 } |
| 2572 | 2579 |
| 2573 } } // namespace v8::internal | 2580 } } // namespace v8::internal |
| OLD | NEW |