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

Unified 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: 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/ia32/lithium-ia32.cc
diff --git a/src/ia32/lithium-ia32.cc b/src/ia32/lithium-ia32.cc
index b3158685fcf40e3e60d7088b8af06e9e39fa0775..ac693121fa0393bc67529f4ea29fe1b02d54bae1 100644
--- a/src/ia32/lithium-ia32.cc
+++ b/src/ia32/lithium-ia32.cc
@@ -1048,10 +1048,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());
}
ToBooleanStub::Types expected = instr->expected_input_types();
@@ -1737,6 +1735,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 = UseOrConstantAtStart(instr->right());
return new(zone()) LCmpObjectEqAndBranch(left, right);

Powered by Google App Engine
This is Rietveld 408576698