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

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

Issue 22876009: Improve and simplify removal of unreachable code (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix ia32 Created 7 years, 4 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 973 matching lines...) Expand 10 before | Expand all | Expand 10 after
984 984
985 985
986 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { 986 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) {
987 return new(zone()) LGoto(instr->FirstSuccessor()->block_id()); 987 return new(zone()) LGoto(instr->FirstSuccessor()->block_id());
988 } 988 }
989 989
990 990
991 LInstruction* LChunkBuilder::DoBranch(HBranch* instr) { 991 LInstruction* LChunkBuilder::DoBranch(HBranch* instr) {
992 HValue* value = instr->value(); 992 HValue* value = instr->value();
993 if (value->EmitAtUses()) { 993 if (value->EmitAtUses()) {
994 HBasicBlock* successor = HConstant::cast(value)->BooleanValue() 994 ASSERT(value->IsConstant());
995 ? instr->FirstSuccessor() 995 ASSERT(!value->representation().IsDouble());
996 : instr->SecondSuccessor(); 996 return ElideControlInstruction(instr,
997 return new(zone()) LGoto(successor->block_id()); 997 HConstant::cast(value)->BooleanValue());
998 } 998 }
999 999
1000 LBranch* result = new(zone()) LBranch(UseRegister(value)); 1000 LBranch* result = new(zone()) LBranch(UseRegister(value));
1001 // Tagged values that are not known smis or booleans require a 1001 // Tagged values that are not known smis or booleans require a
1002 // deoptimization environment. If the instruction is generic no 1002 // deoptimization environment. If the instruction is generic no
1003 // environment is needed since all cases are handled. 1003 // environment is needed since all cases are handled.
1004 Representation rep = value->representation(); 1004 Representation rep = value->representation();
1005 HType type = value->type(); 1005 HType type = value->type();
1006 ToBooleanStub::Types expected = instr->expected_input_types(); 1006 ToBooleanStub::Types expected = instr->expected_input_types();
1007 if (rep.IsTagged() && !type.IsSmi() && !type.IsBoolean() && 1007 if (rep.IsTagged() && !type.IsSmi() && !type.IsBoolean() &&
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after
1720 ASSERT(instr->right()->representation().IsDouble()); 1720 ASSERT(instr->right()->representation().IsDouble());
1721 LOperand* left = UseRegisterAtStart(instr->left()); 1721 LOperand* left = UseRegisterAtStart(instr->left());
1722 LOperand* right = UseRegisterAtStart(instr->right()); 1722 LOperand* right = UseRegisterAtStart(instr->right());
1723 return new(zone()) LCompareNumericAndBranch(left, right); 1723 return new(zone()) LCompareNumericAndBranch(left, right);
1724 } 1724 }
1725 } 1725 }
1726 1726
1727 1727
1728 LInstruction* LChunkBuilder::DoCompareObjectEqAndBranch( 1728 LInstruction* LChunkBuilder::DoCompareObjectEqAndBranch(
1729 HCompareObjectEqAndBranch* instr) { 1729 HCompareObjectEqAndBranch* instr) {
1730 if (instr->left()->IsConstant() && instr->right()->IsConstant()) {
1731 bool comparison_result =
1732 HConstant::cast(instr->left())->SameConstantObject(
1733 HConstant::cast(instr->right()));
1734 return ElideControlInstruction(instr, comparison_result);
1735 }
1736
1730 LOperand* left = UseRegisterAtStart(instr->left()); 1737 LOperand* left = UseRegisterAtStart(instr->left());
1731 LOperand* right = UseRegisterAtStart(instr->right()); 1738 LOperand* right = UseRegisterAtStart(instr->right());
1732 return new(zone()) LCmpObjectEqAndBranch(left, right); 1739 return new(zone()) LCmpObjectEqAndBranch(left, right);
1733 } 1740 }
1734 1741
1735 1742
1736 LInstruction* LChunkBuilder::DoCompareHoleAndBranch( 1743 LInstruction* LChunkBuilder::DoCompareHoleAndBranch(
1737 HCompareHoleAndBranch* instr) { 1744 HCompareHoleAndBranch* instr) {
1738 LOperand* object = UseRegisterAtStart(instr->object()); 1745 LOperand* object = UseRegisterAtStart(instr->object());
1739 return new(zone()) LCmpHoleAndBranch(object); 1746 return new(zone()) LCmpHoleAndBranch(object);
(...skipping 859 matching lines...) Expand 10 before | Expand all | Expand 10 after
2599 2606
2600 2607
2601 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { 2608 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2602 LOperand* object = UseRegister(instr->object()); 2609 LOperand* object = UseRegister(instr->object());
2603 LOperand* index = UseRegister(instr->index()); 2610 LOperand* index = UseRegister(instr->index());
2604 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); 2611 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index));
2605 } 2612 }
2606 2613
2607 2614
2608 } } // namespace v8::internal 2615 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/lithium-arm.h ('k') | src/arm/lithium-codegen-arm.cc » ('j') | src/hydrogen.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698