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

Side by Side Diff: src/mips/lithium-mips.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/mips/lithium-mips.h ('k') | src/x64/lithium-x64.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 "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 825 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 if (instr != NULL) { 845 if (instr != NULL) {
846 // Associate the hydrogen instruction first, since we may need it for 846 AddInstruction(instr, current);
847 // the ClobbersRegisters() or ClobbersDoubleRegisters() calls below. 847 }
848 instr->set_hydrogen_value(current);
849 848
850 #if DEBUG
851 // 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
853 // 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
855 // 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
857 // 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
859 // the same register that is used for the use-at-start.
860 // See https://code.google.com/p/chromium/issues/detail?id=201590
861 if (!(instr->ClobbersRegisters() &&
862 instr->ClobbersDoubleRegisters(isolate()))) {
863 int fixed = 0;
864 int used_at_start = 0;
865 for (UseIterator it(instr); !it.Done(); it.Advance()) {
866 LUnallocated* operand = LUnallocated::cast(it.Current());
867 if (operand->IsUsedAtStart()) ++used_at_start;
868 }
869 if (instr->Output() != NULL) {
870 if (LUnallocated::cast(instr->Output())->HasFixedPolicy()) ++fixed;
871 }
872 for (TempIterator it(instr); !it.Done(); it.Advance()) {
873 LUnallocated* operand = LUnallocated::cast(it.Current());
874 if (operand->HasFixedPolicy()) ++fixed;
875 }
876 ASSERT(fixed == 0 || used_at_start == 0);
877 }
878 #endif
879
880 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) {
881 instr = AssignPointerMap(instr);
882 }
883 if (FLAG_stress_environments && !instr->HasEnvironment()) {
884 instr = AssignEnvironment(instr);
885 }
886 chunk_->AddInstruction(instr, current_block_);
887
888 if (instr->IsCall()) {
889 HValue* hydrogen_value_for_lazy_bailout = current;
890 LInstruction* instruction_needing_environment = NULL;
891 if (current->HasObservableSideEffects()) {
892 HSimulate* sim = HSimulate::cast(current->next());
893 instruction_needing_environment = instr;
894 sim->ReplayEnvironment(current_block_->last_environment());
895 hydrogen_value_for_lazy_bailout = sim;
896 }
897 LInstruction* bailout = AssignEnvironment(new(zone()) LLazyBailout());
898 bailout->set_hydrogen_value(hydrogen_value_for_lazy_bailout);
899 chunk_->AddInstruction(bailout, current_block_);
900 if (instruction_needing_environment != NULL) {
901 // Store the lazy deopt environment with the instruction if needed.
902 // Right now it is only used for LInstanceOfKnownGlobal.
903 instruction_needing_environment->
904 SetDeferredLazyDeoptimizationEnvironment(bailout->environment());
905 }
906 }
907 }
908 current_instruction_ = old_current; 849 current_instruction_ = old_current;
909 } 850 }
910 851
911 852
853 void LChunkBuilder::AddInstruction(LInstruction* instr,
854 HInstruction* hydrogen_val) {
855 // Associate the hydrogen instruction first, since we may need it for
856 // the ClobbersRegisters() or ClobbersDoubleRegisters() calls below.
857 instr->set_hydrogen_value(hydrogen_val);
858
859 #if DEBUG
860 // Make sure that the lithium instruction has either no fixed register
861 // constraints in temps or the result OR no uses that are only used at
862 // start. If this invariant doesn't hold, the register allocator can decide
863 // to insert a split of a range immediately before the instruction due to an
864 // already allocated register needing to be used for the instruction's fixed
865 // register constraint. In this case, The register allocator won't see an
866 // interference between the split child and the use-at-start (it would if
867 // the it was just a plain use), so it is free to move the split child into
868 // the same register that is used for the use-at-start.
869 // See https://code.google.com/p/chromium/issues/detail?id=201590
870 if (!(instr->ClobbersRegisters() &&
871 instr->ClobbersDoubleRegisters(isolate()))) {
872 int fixed = 0;
873 int used_at_start = 0;
874 for (UseIterator it(instr); !it.Done(); it.Advance()) {
875 LUnallocated* operand = LUnallocated::cast(it.Current());
876 if (operand->IsUsedAtStart()) ++used_at_start;
877 }
878 if (instr->Output() != NULL) {
879 if (LUnallocated::cast(instr->Output())->HasFixedPolicy()) ++fixed;
880 }
881 for (TempIterator it(instr); !it.Done(); it.Advance()) {
882 LUnallocated* operand = LUnallocated::cast(it.Current());
883 if (operand->HasFixedPolicy()) ++fixed;
884 }
885 ASSERT(fixed == 0 || used_at_start == 0);
886 }
887 #endif
888
889 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) {
890 instr = AssignPointerMap(instr);
891 }
892 if (FLAG_stress_environments && !instr->HasEnvironment()) {
893 instr = AssignEnvironment(instr);
894 }
895 chunk_->AddInstruction(instr, current_block_);
896
897 if (instr->IsCall()) {
898 HValue* hydrogen_value_for_lazy_bailout = hydrogen_val;
899 LInstruction* instruction_needing_environment = NULL;
900 if (hydrogen_val->HasObservableSideEffects()) {
901 HSimulate* sim = HSimulate::cast(hydrogen_val->next());
902 instruction_needing_environment = instr;
903 sim->ReplayEnvironment(current_block_->last_environment());
904 hydrogen_value_for_lazy_bailout = sim;
905 }
906 LInstruction* bailout = AssignEnvironment(new(zone()) LLazyBailout());
907 bailout->set_hydrogen_value(hydrogen_value_for_lazy_bailout);
908 chunk_->AddInstruction(bailout, current_block_);
909 if (instruction_needing_environment != NULL) {
910 // Store the lazy deopt environment with the instruction if needed.
911 // Right now it is only used for LInstanceOfKnownGlobal.
912 instruction_needing_environment->
913 SetDeferredLazyDeoptimizationEnvironment(bailout->environment());
914 }
915 }
916 }
917
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);
919 if (goto_instr != NULL) return goto_instr; 926 if (goto_instr != NULL) return goto_instr;
920 927
921 HValue* value = instr->value(); 928 HValue* value = instr->value();
(...skipping 1594 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « src/mips/lithium-mips.h ('k') | src/x64/lithium-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698