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

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

Issue 22876009: Improve and simplify removal of unreachable code (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add missing file Created 7 years, 2 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 891 matching lines...) Expand 10 before | Expand all | Expand 10 after
902 block->set_argument_count(argument_count_); 902 block->set_argument_count(argument_count_);
903 next_block_ = NULL; 903 next_block_ = NULL;
904 current_block_ = NULL; 904 current_block_ = NULL;
905 } 905 }
906 906
907 907
908 void LChunkBuilder::VisitInstruction(HInstruction* current) { 908 void LChunkBuilder::VisitInstruction(HInstruction* current) {
909 HInstruction* old_current = current_instruction_; 909 HInstruction* old_current = current_instruction_;
910 current_instruction_ = current; 910 current_instruction_ = current;
911 if (current->has_position()) position_ = current->position(); 911 if (current->has_position()) position_ = current->position();
912 LInstruction* instr = current->CompileToLithium(this); 912
913 LInstruction* instr = NULL;
914 if (current->CanReplaceWithDummyUses()) {
915 HValue* first_operand = current->OperandCount() == 0
916 ? graph()->GetConstant1() :
Jakob Kummerow 2013/10/01 11:59:20 nit: please put the ':' in the next line, under th
danno 2013/10/23 11:46:51 Done.
917 current->OperandAt(0);
918 instr = DefineAsRegister(new(zone()) LDummyUse(UseAny(first_operand)));
919 for (int i = 1; i < current->OperandCount(); ++i) {
920 LInstruction* dummy =
921 new(zone()) LDummyUse(UseAny(current->OperandAt(1)));
Jakob Kummerow 2013/10/01 11:59:20 bug: OperandAt(i)!
danno 2013/10/23 11:46:51 Done.
922 dummy->set_hydrogen_value(current);
923 chunk_->AddInstruction(dummy, current_block_);
924 }
925 } else {
926 instr = current->CompileToLithium(this);
927 }
913 928
914 if (instr != NULL) { 929 if (instr != NULL) {
915 #if DEBUG 930 #if DEBUG
916 // Make sure that the lithium instruction has either no fixed register 931 // Make sure that the lithium instruction has either no fixed register
917 // constraints in temps or the result OR no uses that are only used at 932 // constraints in temps or the result OR no uses that are only used at
918 // start. If this invariant doesn't hold, the register allocator can decide 933 // start. If this invariant doesn't hold, the register allocator can decide
919 // to insert a split of a range immediately before the instruction due to an 934 // to insert a split of a range immediately before the instruction due to an
920 // already allocated register needing to be used for the instruction's fixed 935 // already allocated register needing to be used for the instruction's fixed
921 // register constraint. In this case, The register allocator won't see an 936 // register constraint. In this case, The register allocator won't see an
922 // interference between the split child and the use-at-start (it would if 937 // interference between the split child and the use-at-start (it would if
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
1048 return result; 1063 return result;
1049 } 1064 }
1050 1065
1051 1066
1052 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { 1067 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) {
1053 return new(zone()) LGoto(instr->FirstSuccessor()); 1068 return new(zone()) LGoto(instr->FirstSuccessor());
1054 } 1069 }
1055 1070
1056 1071
1057 LInstruction* LChunkBuilder::DoBranch(HBranch* instr) { 1072 LInstruction* LChunkBuilder::DoBranch(HBranch* instr) {
1058 HValue* value = instr->value(); 1073 LInstruction* goto_instr = CheckElideControlInstruction(instr);
1059 if (value->EmitAtUses()) { 1074 if (goto_instr != NULL) return goto_instr;
1060 ASSERT(value->IsConstant());
1061 ASSERT(!value->representation().IsDouble());
1062 HBasicBlock* successor = HConstant::cast(value)->BooleanValue()
1063 ? instr->FirstSuccessor()
1064 : instr->SecondSuccessor();
1065 return new(zone()) LGoto(successor);
1066 }
1067 1075
1068 ToBooleanStub::Types expected = instr->expected_input_types(); 1076 ToBooleanStub::Types expected = instr->expected_input_types();
1069 1077
1070 // Tagged values that are not known smis or booleans require a 1078 // Tagged values that are not known smis or booleans require a
1071 // deoptimization environment. If the instruction is generic no 1079 // deoptimization environment. If the instruction is generic no
1072 // environment is needed since all cases are handled. 1080 // environment is needed since all cases are handled.
1081 HValue* value = instr->value();
1073 Representation rep = value->representation(); 1082 Representation rep = value->representation();
1074 HType type = value->type(); 1083 HType type = value->type();
1075 if (!rep.IsTagged() || type.IsSmi() || type.IsBoolean()) { 1084 if (!rep.IsTagged() || type.IsSmi() || type.IsBoolean()) {
1076 return new(zone()) LBranch(UseRegister(value), NULL); 1085 return new(zone()) LBranch(UseRegister(value), NULL);
1077 } 1086 }
1078 1087
1079 bool needs_temp = expected.NeedsMap() || expected.IsEmpty(); 1088 bool needs_temp = expected.NeedsMap() || expected.IsEmpty();
1080 LOperand* temp = needs_temp ? TempRegister() : NULL; 1089 LOperand* temp = needs_temp ? TempRegister() : NULL;
1081 1090
1082 // The Generic stub does not have a deopt, so we need no environment. 1091 // The Generic stub does not have a deopt, so we need no environment.
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after
1734 left = UseRegisterAtStart(instr->left()); 1743 left = UseRegisterAtStart(instr->left());
1735 right = UseRegisterAtStart(instr->right()); 1744 right = UseRegisterAtStart(instr->right());
1736 } 1745 }
1737 return new(zone()) LCompareNumericAndBranch(left, right); 1746 return new(zone()) LCompareNumericAndBranch(left, right);
1738 } 1747 }
1739 } 1748 }
1740 1749
1741 1750
1742 LInstruction* LChunkBuilder::DoCompareObjectEqAndBranch( 1751 LInstruction* LChunkBuilder::DoCompareObjectEqAndBranch(
1743 HCompareObjectEqAndBranch* instr) { 1752 HCompareObjectEqAndBranch* instr) {
1753 LInstruction* goto_instr = CheckElideControlInstruction(instr);
1754 if (goto_instr != NULL) return goto_instr;
1744 LOperand* left = UseRegisterAtStart(instr->left()); 1755 LOperand* left = UseRegisterAtStart(instr->left());
1745 LOperand* right = UseOrConstantAtStart(instr->right()); 1756 LOperand* right = UseOrConstantAtStart(instr->right());
1746 return new(zone()) LCmpObjectEqAndBranch(left, right); 1757 return new(zone()) LCmpObjectEqAndBranch(left, right);
1747 } 1758 }
1748 1759
1749 1760
1750 LInstruction* LChunkBuilder::DoCompareHoleAndBranch( 1761 LInstruction* LChunkBuilder::DoCompareHoleAndBranch(
1751 HCompareHoleAndBranch* instr) { 1762 HCompareHoleAndBranch* instr) {
1752 LOperand* value = UseRegisterAtStart(instr->value()); 1763 LOperand* value = UseRegisterAtStart(instr->value());
1753 return new(zone()) LCmpHoleAndBranch(value); 1764 return new(zone()) LCmpHoleAndBranch(value);
(...skipping 973 matching lines...) Expand 10 before | Expand all | Expand 10 after
2727 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { 2738 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2728 LOperand* object = UseRegister(instr->object()); 2739 LOperand* object = UseRegister(instr->object());
2729 LOperand* index = UseTempRegister(instr->index()); 2740 LOperand* index = UseTempRegister(instr->index());
2730 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); 2741 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index));
2731 } 2742 }
2732 2743
2733 2744
2734 } } // namespace v8::internal 2745 } } // namespace v8::internal
2735 2746
2736 #endif // V8_TARGET_ARCH_IA32 2747 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698