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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: src/arm/lithium-arm.cc
diff --git a/src/arm/lithium-arm.cc b/src/arm/lithium-arm.cc
index 998b73b62e9242a6dd2393a919f199f2af5c1859..0c83ac63b533f0eaf1ba4a3a8294eceaf6906b0e 100644
--- a/src/arm/lithium-arm.cc
+++ b/src/arm/lithium-arm.cc
@@ -991,10 +991,10 @@ LInstruction* LChunkBuilder::DoGoto(HGoto* instr) {
LInstruction* LChunkBuilder::DoBranch(HBranch* instr) {
HValue* value = instr->value();
if (value->EmitAtUses()) {
- HBasicBlock* successor = HConstant::cast(value)->BooleanValue()
- ? instr->FirstSuccessor()
- : instr->SecondSuccessor();
- return new(zone()) LGoto(successor->block_id());
+ ASSERT(value->IsConstant());
+ ASSERT(!value->representation().IsDouble());
+ return ElideControlInstruction(instr,
+ HConstant::cast(value)->BooleanValue());
}
LBranch* result = new(zone()) LBranch(UseRegister(value));
@@ -1727,6 +1727,13 @@ LInstruction* LChunkBuilder::DoCompareNumericAndBranch(
LInstruction* LChunkBuilder::DoCompareObjectEqAndBranch(
HCompareObjectEqAndBranch* instr) {
+ if (instr->left()->IsConstant() && instr->right()->IsConstant()) {
+ bool comparison_result =
+ HConstant::cast(instr->left())->SameConstantObject(
+ HConstant::cast(instr->right()));
+ return ElideControlInstruction(instr, comparison_result);
+ }
+
LOperand* left = UseRegisterAtStart(instr->left());
LOperand* right = UseRegisterAtStart(instr->right());
return new(zone()) LCmpObjectEqAndBranch(left, right);
« 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