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

Unified Diff: src/x64/lithium-x64.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/x64/lithium-x64.cc
diff --git a/src/x64/lithium-x64.cc b/src/x64/lithium-x64.cc
index c058b0df44a44d3cbdf465f76752e4b76f53b7fb..c1f3d7566704f4ed19d1c89cc8dbca8551a5701a 100644
--- a/src/x64/lithium-x64.cc
+++ b/src/x64/lithium-x64.cc
@@ -997,10 +997,8 @@ LInstruction* LChunkBuilder::DoBranch(HBranch* instr) {
if (value->EmitAtUses()) {
ASSERT(value->IsConstant());
ASSERT(!value->representation().IsDouble());
- HBasicBlock* successor = HConstant::cast(value)->BooleanValue()
- ? instr->FirstSuccessor()
- : instr->SecondSuccessor();
- return new(zone()) LGoto(successor->block_id());
+ return ElideControlInstruction(instr,
+ HConstant::cast(value)->BooleanValue());
}
LBranch* result = new(zone()) LBranch(UseRegister(value));
@@ -1637,6 +1635,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 = UseRegisterOrConstantAtStart(instr->right());
return new(zone()) LCmpObjectEqAndBranch(left, right);

Powered by Google App Engine
This is Rietveld 408576698