| 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_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
| 8 | 8 |
| 9 #include "lithium-allocator-inl.h" | 9 #include "lithium-allocator-inl.h" |
| 10 #include "ia32/lithium-ia32.h" | 10 #include "ia32/lithium-ia32.h" |
| (...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 881 dummy->set_hydrogen_value(current); | 881 dummy->set_hydrogen_value(current); |
| 882 chunk_->AddInstruction(dummy, current_block_); | 882 chunk_->AddInstruction(dummy, current_block_); |
| 883 } | 883 } |
| 884 } else { | 884 } else { |
| 885 instr = current->CompileToLithium(this); | 885 instr = current->CompileToLithium(this); |
| 886 } | 886 } |
| 887 | 887 |
| 888 argument_count_ += current->argument_delta(); | 888 argument_count_ += current->argument_delta(); |
| 889 ASSERT(argument_count_ >= 0); | 889 ASSERT(argument_count_ >= 0); |
| 890 | 890 |
| 891 CheckAndAddInstruction(instr, current); |
| 892 |
| 893 current_instruction_ = old_current; |
| 894 } |
| 895 |
| 896 |
| 897 void LChunkBuilder::CheckAndAddInstruction(LInstruction* instr, |
| 898 HInstruction* hydrogen_val) { |
| 891 if (instr != NULL) { | 899 if (instr != NULL) { |
| 892 // Associate the hydrogen instruction first, since we may need it for | 900 // Associate the hydrogen instruction first, since we may need it for |
| 893 // the ClobbersRegisters() or ClobbersDoubleRegisters() calls below. | 901 // the ClobbersRegisters() or ClobbersDoubleRegisters() calls below. |
| 894 instr->set_hydrogen_value(current); | 902 instr->set_hydrogen_value(hydrogen_val); |
| 895 | 903 |
| 896 #if DEBUG | 904 #if DEBUG |
| 897 // Make sure that the lithium instruction has either no fixed register | 905 // Make sure that the lithium instruction has either no fixed register |
| 898 // constraints in temps or the result OR no uses that are only used at | 906 // constraints in temps or the result OR no uses that are only used at |
| 899 // start. If this invariant doesn't hold, the register allocator can decide | 907 // start. If this invariant doesn't hold, the register allocator can decide |
| 900 // to insert a split of a range immediately before the instruction due to an | 908 // to insert a split of a range immediately before the instruction due to an |
| 901 // already allocated register needing to be used for the instruction's fixed | 909 // already allocated register needing to be used for the instruction's fixed |
| 902 // register constraint. In this case, The register allocator won't see an | 910 // register constraint. In this case, The register allocator won't see an |
| 903 // interference between the split child and the use-at-start (it would if | 911 // interference between the split child and the use-at-start (it would if |
| 904 // the it was just a plain use), so it is free to move the split child into | 912 // the it was just a plain use), so it is free to move the split child into |
| (...skipping 20 matching lines...) Expand all Loading... |
| 925 | 933 |
| 926 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { | 934 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { |
| 927 instr = AssignPointerMap(instr); | 935 instr = AssignPointerMap(instr); |
| 928 } | 936 } |
| 929 if (FLAG_stress_environments && !instr->HasEnvironment()) { | 937 if (FLAG_stress_environments && !instr->HasEnvironment()) { |
| 930 instr = AssignEnvironment(instr); | 938 instr = AssignEnvironment(instr); |
| 931 } | 939 } |
| 932 chunk_->AddInstruction(instr, current_block_); | 940 chunk_->AddInstruction(instr, current_block_); |
| 933 | 941 |
| 934 if (instr->IsCall()) { | 942 if (instr->IsCall()) { |
| 935 HValue* hydrogen_value_for_lazy_bailout = current; | 943 HValue* hydrogen_value_for_lazy_bailout = hydrogen_val; |
| 936 LInstruction* instruction_needing_environment = NULL; | 944 LInstruction* instruction_needing_environment = NULL; |
| 937 if (current->HasObservableSideEffects()) { | 945 if (hydrogen_val->HasObservableSideEffects()) { |
| 938 HSimulate* sim = HSimulate::cast(current->next()); | 946 HSimulate* sim = HSimulate::cast(hydrogen_val->next()); |
| 939 instruction_needing_environment = instr; | 947 instruction_needing_environment = instr; |
| 940 sim->ReplayEnvironment(current_block_->last_environment()); | 948 sim->ReplayEnvironment(current_block_->last_environment()); |
| 941 hydrogen_value_for_lazy_bailout = sim; | 949 hydrogen_value_for_lazy_bailout = sim; |
| 942 } | 950 } |
| 943 LInstruction* bailout = AssignEnvironment(new(zone()) LLazyBailout()); | 951 LInstruction* bailout = AssignEnvironment(new(zone()) LLazyBailout()); |
| 944 bailout->set_hydrogen_value(hydrogen_value_for_lazy_bailout); | 952 bailout->set_hydrogen_value(hydrogen_value_for_lazy_bailout); |
| 945 chunk_->AddInstruction(bailout, current_block_); | 953 chunk_->AddInstruction(bailout, current_block_); |
| 946 if (instruction_needing_environment != NULL) { | 954 if (instruction_needing_environment != NULL) { |
| 947 // Store the lazy deopt environment with the instruction if needed. | 955 // Store the lazy deopt environment with the instruction if needed. |
| 948 // Right now it is only used for LInstanceOfKnownGlobal. | 956 // Right now it is only used for LInstanceOfKnownGlobal. |
| 949 instruction_needing_environment-> | 957 instruction_needing_environment-> |
| 950 SetDeferredLazyDeoptimizationEnvironment(bailout->environment()); | 958 SetDeferredLazyDeoptimizationEnvironment(bailout->environment()); |
| 951 } | 959 } |
| 952 } | 960 } |
| 953 } | 961 } |
| 954 current_instruction_ = old_current; | |
| 955 } | 962 } |
| 956 | 963 |
| 957 | 964 |
| 958 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { | 965 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { |
| 959 return new(zone()) LGoto(instr->FirstSuccessor()); | 966 return new(zone()) LGoto(instr->FirstSuccessor()); |
| 960 } | 967 } |
| 961 | 968 |
| 962 | 969 |
| 963 LInstruction* LChunkBuilder::DoBranch(HBranch* instr) { | 970 LInstruction* LChunkBuilder::DoBranch(HBranch* instr) { |
| 964 LInstruction* goto_instr = CheckElideControlInstruction(instr); | 971 LInstruction* goto_instr = CheckElideControlInstruction(instr); |
| (...skipping 1702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2667 LOperand* index = UseTempRegister(instr->index()); | 2674 LOperand* index = UseTempRegister(instr->index()); |
| 2668 LLoadFieldByIndex* load = new(zone()) LLoadFieldByIndex(object, index); | 2675 LLoadFieldByIndex* load = new(zone()) LLoadFieldByIndex(object, index); |
| 2669 LInstruction* result = DefineSameAsFirst(load); | 2676 LInstruction* result = DefineSameAsFirst(load); |
| 2670 return AssignPointerMap(result); | 2677 return AssignPointerMap(result); |
| 2671 } | 2678 } |
| 2672 | 2679 |
| 2673 | 2680 |
| 2674 } } // namespace v8::internal | 2681 } } // namespace v8::internal |
| 2675 | 2682 |
| 2676 #endif // V8_TARGET_ARCH_IA32 | 2683 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |