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

Side by Side 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 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 979 matching lines...) Expand 10 before | Expand all | Expand 10 after
990 LInstruction* LChunkBuilder::DoDebugBreak(HDebugBreak* instr) { 990 LInstruction* LChunkBuilder::DoDebugBreak(HDebugBreak* instr) {
991 return new(zone()) LDebugBreak(); 991 return new(zone()) LDebugBreak();
992 } 992 }
993 993
994 994
995 LInstruction* LChunkBuilder::DoBranch(HBranch* instr) { 995 LInstruction* LChunkBuilder::DoBranch(HBranch* instr) {
996 HValue* value = instr->value(); 996 HValue* value = instr->value();
997 if (value->EmitAtUses()) { 997 if (value->EmitAtUses()) {
998 ASSERT(value->IsConstant()); 998 ASSERT(value->IsConstant());
999 ASSERT(!value->representation().IsDouble()); 999 ASSERT(!value->representation().IsDouble());
1000 HBasicBlock* successor = HConstant::cast(value)->BooleanValue() 1000 return ElideControlInstruction(instr,
1001 ? instr->FirstSuccessor() 1001 HConstant::cast(value)->BooleanValue());
1002 : instr->SecondSuccessor();
1003 return new(zone()) LGoto(successor->block_id());
1004 } 1002 }
1005 1003
1006 LBranch* result = new(zone()) LBranch(UseRegister(value)); 1004 LBranch* result = new(zone()) LBranch(UseRegister(value));
1007 // Tagged values that are not known smis or booleans require a 1005 // Tagged values that are not known smis or booleans require a
1008 // deoptimization environment. If the instruction is generic no 1006 // deoptimization environment. If the instruction is generic no
1009 // environment is needed since all cases are handled. 1007 // environment is needed since all cases are handled.
1010 ToBooleanStub::Types expected = instr->expected_input_types(); 1008 ToBooleanStub::Types expected = instr->expected_input_types();
1011 Representation rep = value->representation(); 1009 Representation rep = value->representation();
1012 HType type = value->type(); 1010 HType type = value->type();
1013 if (rep.IsTagged() && !type.IsSmi() && !type.IsBoolean() && 1011 if (rep.IsTagged() && !type.IsSmi() && !type.IsBoolean() &&
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after
1630 left = UseRegisterAtStart(instr->left()); 1628 left = UseRegisterAtStart(instr->left());
1631 right = UseRegisterAtStart(instr->right()); 1629 right = UseRegisterAtStart(instr->right());
1632 } 1630 }
1633 return new(zone()) LCompareNumericAndBranch(left, right); 1631 return new(zone()) LCompareNumericAndBranch(left, right);
1634 } 1632 }
1635 } 1633 }
1636 1634
1637 1635
1638 LInstruction* LChunkBuilder::DoCompareObjectEqAndBranch( 1636 LInstruction* LChunkBuilder::DoCompareObjectEqAndBranch(
1639 HCompareObjectEqAndBranch* instr) { 1637 HCompareObjectEqAndBranch* instr) {
1638 if (instr->left()->IsConstant() && instr->right()->IsConstant()) {
1639 bool comparison_result =
1640 HConstant::cast(instr->left())->SameConstantObject(
1641 HConstant::cast(instr->right()));
1642 return ElideControlInstruction(instr, comparison_result);
1643 }
1644
1640 LOperand* left = UseRegisterAtStart(instr->left()); 1645 LOperand* left = UseRegisterAtStart(instr->left());
1641 LOperand* right = UseRegisterOrConstantAtStart(instr->right()); 1646 LOperand* right = UseRegisterOrConstantAtStart(instr->right());
1642 return new(zone()) LCmpObjectEqAndBranch(left, right); 1647 return new(zone()) LCmpObjectEqAndBranch(left, right);
1643 } 1648 }
1644 1649
1645 1650
1646 LInstruction* LChunkBuilder::DoCompareHoleAndBranch( 1651 LInstruction* LChunkBuilder::DoCompareHoleAndBranch(
1647 HCompareHoleAndBranch* instr) { 1652 HCompareHoleAndBranch* instr) {
1648 LOperand* object = UseRegisterAtStart(instr->object()); 1653 LOperand* object = UseRegisterAtStart(instr->object());
1649 return new(zone()) LCmpHoleAndBranch(object); 1654 return new(zone()) LCmpHoleAndBranch(object);
(...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after
2532 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { 2537 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2533 LOperand* object = UseRegister(instr->object()); 2538 LOperand* object = UseRegister(instr->object());
2534 LOperand* index = UseTempRegister(instr->index()); 2539 LOperand* index = UseTempRegister(instr->index());
2535 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); 2540 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index));
2536 } 2541 }
2537 2542
2538 2543
2539 } } // namespace v8::internal 2544 } } // namespace v8::internal
2540 2545
2541 #endif // V8_TARGET_ARCH_X64 2546 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698