Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Side by Side Diff: src/arm/lithium-arm.cc

Issue 296993002: Provide a helper to generate multiple Lithium instructions for one Hydrogen instruction. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address review comments from Ulan Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/arm/lithium-arm.h ('k') | src/arm64/lithium-arm64.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 817 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 if (instr != NULL) { 837 if (instr != NULL) {
838 // Associate the hydrogen instruction first, since we may need it for 838 AddInstruction(instr, current);
839 // the ClobbersRegisters() or ClobbersDoubleRegisters() calls below. 839 }
840 instr->set_hydrogen_value(current);
841 840
842 #if DEBUG
843 // 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
845 // 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
847 // 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
849 // 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
851 // the same register that is used for the use-at-start.
852 // See https://code.google.com/p/chromium/issues/detail?id=201590
853 if (!(instr->ClobbersRegisters() &&
854 instr->ClobbersDoubleRegisters(isolate()))) {
855 int fixed = 0;
856 int used_at_start = 0;
857 for (UseIterator it(instr); !it.Done(); it.Advance()) {
858 LUnallocated* operand = LUnallocated::cast(it.Current());
859 if (operand->IsUsedAtStart()) ++used_at_start;
860 }
861 if (instr->Output() != NULL) {
862 if (LUnallocated::cast(instr->Output())->HasFixedPolicy()) ++fixed;
863 }
864 for (TempIterator it(instr); !it.Done(); it.Advance()) {
865 LUnallocated* operand = LUnallocated::cast(it.Current());
866 if (operand->HasFixedPolicy()) ++fixed;
867 }
868 ASSERT(fixed == 0 || used_at_start == 0);
869 }
870 #endif
871
872 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) {
873 instr = AssignPointerMap(instr);
874 }
875 if (FLAG_stress_environments && !instr->HasEnvironment()) {
876 instr = AssignEnvironment(instr);
877 }
878 chunk_->AddInstruction(instr, current_block_);
879
880 if (instr->IsCall()) {
881 HValue* hydrogen_value_for_lazy_bailout = current;
882 LInstruction* instruction_needing_environment = NULL;
883 if (current->HasObservableSideEffects()) {
884 HSimulate* sim = HSimulate::cast(current->next());
885 instruction_needing_environment = instr;
886 sim->ReplayEnvironment(current_block_->last_environment());
887 hydrogen_value_for_lazy_bailout = sim;
888 }
889 LInstruction* bailout = AssignEnvironment(new(zone()) LLazyBailout());
890 bailout->set_hydrogen_value(hydrogen_value_for_lazy_bailout);
891 chunk_->AddInstruction(bailout, current_block_);
892 if (instruction_needing_environment != NULL) {
893 // Store the lazy deopt environment with the instruction if needed.
894 // Right now it is only used for LInstanceOfKnownGlobal.
895 instruction_needing_environment->
896 SetDeferredLazyDeoptimizationEnvironment(bailout->environment());
897 }
898 }
899 }
900 current_instruction_ = old_current; 841 current_instruction_ = old_current;
901 } 842 }
902 843
903 844
845 void LChunkBuilder::AddInstruction(LInstruction* instr,
846 HInstruction* hydrogen_val) {
847 // Associate the hydrogen instruction first, since we may need it for
848 // the ClobbersRegisters() or ClobbersDoubleRegisters() calls below.
849 instr->set_hydrogen_value(hydrogen_val);
850
851 #if DEBUG
852 // Make sure that the lithium instruction has either no fixed register
853 // constraints in temps or the result OR no uses that are only used at
854 // start. If this invariant doesn't hold, the register allocator can decide
855 // to insert a split of a range immediately before the instruction due to an
856 // already allocated register needing to be used for the instruction's fixed
857 // register constraint. In this case, The register allocator won't see an
858 // interference between the split child and the use-at-start (it would if
859 // the it was just a plain use), so it is free to move the split child into
860 // the same register that is used for the use-at-start.
861 // See https://code.google.com/p/chromium/issues/detail?id=201590
862 if (!(instr->ClobbersRegisters() &&
863 instr->ClobbersDoubleRegisters(isolate()))) {
864 int fixed = 0;
865 int used_at_start = 0;
866 for (UseIterator it(instr); !it.Done(); it.Advance()) {
867 LUnallocated* operand = LUnallocated::cast(it.Current());
868 if (operand->IsUsedAtStart()) ++used_at_start;
869 }
870 if (instr->Output() != NULL) {
871 if (LUnallocated::cast(instr->Output())->HasFixedPolicy()) ++fixed;
872 }
873 for (TempIterator it(instr); !it.Done(); it.Advance()) {
874 LUnallocated* operand = LUnallocated::cast(it.Current());
875 if (operand->HasFixedPolicy()) ++fixed;
876 }
877 ASSERT(fixed == 0 || used_at_start == 0);
878 }
879 #endif
880
881 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) {
882 instr = AssignPointerMap(instr);
883 }
884 if (FLAG_stress_environments && !instr->HasEnvironment()) {
885 instr = AssignEnvironment(instr);
886 }
887 chunk_->AddInstruction(instr, current_block_);
888
889 if (instr->IsCall()) {
890 HValue* hydrogen_value_for_lazy_bailout = hydrogen_val;
891 LInstruction* instruction_needing_environment = NULL;
892 if (hydrogen_val->HasObservableSideEffects()) {
893 HSimulate* sim = HSimulate::cast(hydrogen_val->next());
894 instruction_needing_environment = instr;
895 sim->ReplayEnvironment(current_block_->last_environment());
896 hydrogen_value_for_lazy_bailout = sim;
897 }
898 LInstruction* bailout = AssignEnvironment(new(zone()) LLazyBailout());
899 bailout->set_hydrogen_value(hydrogen_value_for_lazy_bailout);
900 chunk_->AddInstruction(bailout, current_block_);
901 if (instruction_needing_environment != NULL) {
902 // Store the lazy deopt environment with the instruction if needed.
903 // Right now it is only used for LInstanceOfKnownGlobal.
904 instruction_needing_environment->
905 SetDeferredLazyDeoptimizationEnvironment(bailout->environment());
906 }
907 }
908 }
909
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);
911 if (goto_instr != NULL) return goto_instr; 918 if (goto_instr != NULL) return goto_instr;
912 919
913 HValue* value = instr->value(); 920 HValue* value = instr->value();
(...skipping 1650 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « src/arm/lithium-arm.h ('k') | src/arm64/lithium-arm64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698