| 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 #if V8_TARGET_ARCH_X64 | 7 #if V8_TARGET_ARCH_X64 |
| 8 | 8 |
| 9 #include "lithium-allocator-inl.h" | 9 #include "lithium-allocator-inl.h" |
| 10 #include "x64/lithium-x64.h" | 10 #include "x64/lithium-x64.h" |
| (...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 848 dummy->set_hydrogen_value(current); | 848 dummy->set_hydrogen_value(current); |
| 849 chunk_->AddInstruction(dummy, current_block_); | 849 chunk_->AddInstruction(dummy, current_block_); |
| 850 } | 850 } |
| 851 } else { | 851 } else { |
| 852 instr = current->CompileToLithium(this); | 852 instr = current->CompileToLithium(this); |
| 853 } | 853 } |
| 854 | 854 |
| 855 argument_count_ += current->argument_delta(); | 855 argument_count_ += current->argument_delta(); |
| 856 ASSERT(argument_count_ >= 0); | 856 ASSERT(argument_count_ >= 0); |
| 857 | 857 |
| 858 CheckAndAddInstruction(instr, current); |
| 859 |
| 860 current_instruction_ = old_current; |
| 861 } |
| 862 |
| 863 |
| 864 void LChunkBuilder::CheckAndAddInstruction(LInstruction* instr, |
| 865 HInstruction* hydrogen_val) { |
| 858 if (instr != NULL) { | 866 if (instr != NULL) { |
| 859 // Associate the hydrogen instruction first, since we may need it for | 867 // Associate the hydrogen instruction first, since we may need it for |
| 860 // the ClobbersRegisters() or ClobbersDoubleRegisters() calls below. | 868 // the ClobbersRegisters() or ClobbersDoubleRegisters() calls below. |
| 861 instr->set_hydrogen_value(current); | 869 instr->set_hydrogen_value(hydrogen_val); |
| 862 | 870 |
| 863 #if DEBUG | 871 #if DEBUG |
| 864 // Make sure that the lithium instruction has either no fixed register | 872 // Make sure that the lithium instruction has either no fixed register |
| 865 // constraints in temps or the result OR no uses that are only used at | 873 // constraints in temps or the result OR no uses that are only used at |
| 866 // start. If this invariant doesn't hold, the register allocator can decide | 874 // start. If this invariant doesn't hold, the register allocator can decide |
| 867 // to insert a split of a range immediately before the instruction due to an | 875 // to insert a split of a range immediately before the instruction due to an |
| 868 // already allocated register needing to be used for the instruction's fixed | 876 // already allocated register needing to be used for the instruction's fixed |
| 869 // register constraint. In this case, The register allocator won't see an | 877 // register constraint. In this case, The register allocator won't see an |
| 870 // interference between the split child and the use-at-start (it would if | 878 // interference between the split child and the use-at-start (it would if |
| 871 // the it was just a plain use), so it is free to move the split child into | 879 // the it was just a plain use), so it is free to move the split child into |
| (...skipping 20 matching lines...) Expand all Loading... |
| 892 | 900 |
| 893 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { | 901 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { |
| 894 instr = AssignPointerMap(instr); | 902 instr = AssignPointerMap(instr); |
| 895 } | 903 } |
| 896 if (FLAG_stress_environments && !instr->HasEnvironment()) { | 904 if (FLAG_stress_environments && !instr->HasEnvironment()) { |
| 897 instr = AssignEnvironment(instr); | 905 instr = AssignEnvironment(instr); |
| 898 } | 906 } |
| 899 chunk_->AddInstruction(instr, current_block_); | 907 chunk_->AddInstruction(instr, current_block_); |
| 900 | 908 |
| 901 if (instr->IsCall()) { | 909 if (instr->IsCall()) { |
| 902 HValue* hydrogen_value_for_lazy_bailout = current; | 910 HValue* hydrogen_value_for_lazy_bailout = hydrogen_val; |
| 903 LInstruction* instruction_needing_environment = NULL; | 911 LInstruction* instruction_needing_environment = NULL; |
| 904 if (current->HasObservableSideEffects()) { | 912 if (hydrogen_val->HasObservableSideEffects()) { |
| 905 HSimulate* sim = HSimulate::cast(current->next()); | 913 HSimulate* sim = HSimulate::cast(hydrogen_val->next()); |
| 906 instruction_needing_environment = instr; | 914 instruction_needing_environment = instr; |
| 907 sim->ReplayEnvironment(current_block_->last_environment()); | 915 sim->ReplayEnvironment(current_block_->last_environment()); |
| 908 hydrogen_value_for_lazy_bailout = sim; | 916 hydrogen_value_for_lazy_bailout = sim; |
| 909 } | 917 } |
| 910 LInstruction* bailout = AssignEnvironment(new(zone()) LLazyBailout()); | 918 LInstruction* bailout = AssignEnvironment(new(zone()) LLazyBailout()); |
| 911 bailout->set_hydrogen_value(hydrogen_value_for_lazy_bailout); | 919 bailout->set_hydrogen_value(hydrogen_value_for_lazy_bailout); |
| 912 chunk_->AddInstruction(bailout, current_block_); | 920 chunk_->AddInstruction(bailout, current_block_); |
| 913 if (instruction_needing_environment != NULL) { | 921 if (instruction_needing_environment != NULL) { |
| 914 // Store the lazy deopt environment with the instruction if needed. | 922 // Store the lazy deopt environment with the instruction if needed. |
| 915 // Right now it is only used for LInstanceOfKnownGlobal. | 923 // Right now it is only used for LInstanceOfKnownGlobal. |
| 916 instruction_needing_environment-> | 924 instruction_needing_environment-> |
| 917 SetDeferredLazyDeoptimizationEnvironment(bailout->environment()); | 925 SetDeferredLazyDeoptimizationEnvironment(bailout->environment()); |
| 918 } | 926 } |
| 919 } | 927 } |
| 920 } | 928 } |
| 921 current_instruction_ = old_current; | |
| 922 } | 929 } |
| 923 | 930 |
| 924 | 931 |
| 925 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { | 932 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { |
| 926 return new(zone()) LGoto(instr->FirstSuccessor()); | 933 return new(zone()) LGoto(instr->FirstSuccessor()); |
| 927 } | 934 } |
| 928 | 935 |
| 929 | 936 |
| 930 LInstruction* LChunkBuilder::DoDebugBreak(HDebugBreak* instr) { | 937 LInstruction* LChunkBuilder::DoDebugBreak(HDebugBreak* instr) { |
| 931 return new(zone()) LDebugBreak(); | 938 return new(zone()) LDebugBreak(); |
| (...skipping 1661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2593 LOperand* index = UseTempRegister(instr->index()); | 2600 LOperand* index = UseTempRegister(instr->index()); |
| 2594 LLoadFieldByIndex* load = new(zone()) LLoadFieldByIndex(object, index); | 2601 LLoadFieldByIndex* load = new(zone()) LLoadFieldByIndex(object, index); |
| 2595 LInstruction* result = DefineSameAsFirst(load); | 2602 LInstruction* result = DefineSameAsFirst(load); |
| 2596 return AssignPointerMap(result); | 2603 return AssignPointerMap(result); |
| 2597 } | 2604 } |
| 2598 | 2605 |
| 2599 | 2606 |
| 2600 } } // namespace v8::internal | 2607 } } // namespace v8::internal |
| 2601 | 2608 |
| 2602 #endif // V8_TARGET_ARCH_X64 | 2609 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |