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

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: Address review feedback Created 7 years, 2 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
« no previous file with comments | « src/x64/lithium-x64.h ('k') | tools/gyp/v8.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 842 matching lines...) Expand 10 before | Expand all | Expand 10 after
853 block->set_argument_count(argument_count_); 853 block->set_argument_count(argument_count_);
854 next_block_ = NULL; 854 next_block_ = NULL;
855 current_block_ = NULL; 855 current_block_ = NULL;
856 } 856 }
857 857
858 858
859 void LChunkBuilder::VisitInstruction(HInstruction* current) { 859 void LChunkBuilder::VisitInstruction(HInstruction* current) {
860 HInstruction* old_current = current_instruction_; 860 HInstruction* old_current = current_instruction_;
861 current_instruction_ = current; 861 current_instruction_ = current;
862 if (current->has_position()) position_ = current->position(); 862 if (current->has_position()) position_ = current->position();
863 LInstruction* instr = current->CompileToLithium(this); 863
864 LInstruction* instr = NULL;
865 if (current->CanReplaceWithDummyUses()) {
866 HValue* first_operand = current->OperandCount() == 0
867 ? graph()->GetConstant1()
868 : current->OperandAt(0);
869 instr = DefineAsRegister(new(zone()) LDummyUse(UseAny(first_operand)));
870 for (int i = 1; i < current->OperandCount(); ++i) {
871 LInstruction* dummy =
872 new(zone()) LDummyUse(UseAny(current->OperandAt(i)));
873 dummy->set_hydrogen_value(current);
874 chunk_->AddInstruction(dummy, current_block_);
875 }
876 } else {
877 instr = current->CompileToLithium(this);
878 }
864 879
865 if (instr != NULL) { 880 if (instr != NULL) {
866 // Associate the hydrogen instruction first, since we may need it for 881 // Associate the hydrogen instruction first, since we may need it for
867 // the ClobbersRegisters() or ClobbersDoubleRegisters() calls below. 882 // the ClobbersRegisters() or ClobbersDoubleRegisters() calls below.
868 instr->set_hydrogen_value(current); 883 instr->set_hydrogen_value(current);
869 884
870 #if DEBUG 885 #if DEBUG
871 // Make sure that the lithium instruction has either no fixed register 886 // Make sure that the lithium instruction has either no fixed register
872 // constraints in temps or the result OR no uses that are only used at 887 // constraints in temps or the result OR no uses that are only used at
873 // start. If this invariant doesn't hold, the register allocator can decide 888 // start. If this invariant doesn't hold, the register allocator can decide
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
987 1002
988 if (hydrogen_env->frame_type() == JS_FUNCTION) { 1003 if (hydrogen_env->frame_type() == JS_FUNCTION) {
989 *argument_index_accumulator = argument_index; 1004 *argument_index_accumulator = argument_index;
990 } 1005 }
991 1006
992 return result; 1007 return result;
993 } 1008 }
994 1009
995 1010
996 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { 1011 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) {
997 return new(zone()) LGoto(instr->FirstSuccessor()->block_id()); 1012 return new(zone()) LGoto(instr->FirstSuccessor());
998 } 1013 }
999 1014
1000 1015
1001 LInstruction* LChunkBuilder::DoDebugBreak(HDebugBreak* instr) { 1016 LInstruction* LChunkBuilder::DoDebugBreak(HDebugBreak* instr) {
1002 return new(zone()) LDebugBreak(); 1017 return new(zone()) LDebugBreak();
1003 } 1018 }
1004 1019
1005 1020
1006 LInstruction* LChunkBuilder::DoBranch(HBranch* instr) { 1021 LInstruction* LChunkBuilder::DoBranch(HBranch* instr) {
1022 LInstruction* goto_instr = CheckElideControlInstruction(instr);
1023 if (goto_instr != NULL) return goto_instr;
1024
1007 HValue* value = instr->value(); 1025 HValue* value = instr->value();
1008 if (value->EmitAtUses()) {
1009 ASSERT(value->IsConstant());
1010 ASSERT(!value->representation().IsDouble());
1011 HBasicBlock* successor = HConstant::cast(value)->BooleanValue()
1012 ? instr->FirstSuccessor()
1013 : instr->SecondSuccessor();
1014 return new(zone()) LGoto(successor->block_id());
1015 }
1016
1017 LBranch* result = new(zone()) LBranch(UseRegister(value)); 1026 LBranch* result = new(zone()) LBranch(UseRegister(value));
1018 // Tagged values that are not known smis or booleans require a 1027 // Tagged values that are not known smis or booleans require a
1019 // deoptimization environment. If the instruction is generic no 1028 // deoptimization environment. If the instruction is generic no
1020 // environment is needed since all cases are handled. 1029 // environment is needed since all cases are handled.
1021 ToBooleanStub::Types expected = instr->expected_input_types(); 1030 ToBooleanStub::Types expected = instr->expected_input_types();
1022 Representation rep = value->representation(); 1031 Representation rep = value->representation();
1023 HType type = value->type(); 1032 HType type = value->type();
1024 if (rep.IsTagged() && !type.IsSmi() && !type.IsBoolean() && 1033 if (rep.IsTagged() && !type.IsSmi() && !type.IsBoolean() &&
1025 !expected.IsGeneric()) { 1034 !expected.IsGeneric()) {
1026 return AssignEnvironment(result); 1035 return AssignEnvironment(result);
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after
1636 left = UseRegisterAtStart(instr->left()); 1645 left = UseRegisterAtStart(instr->left());
1637 right = UseRegisterAtStart(instr->right()); 1646 right = UseRegisterAtStart(instr->right());
1638 } 1647 }
1639 return new(zone()) LCompareNumericAndBranch(left, right); 1648 return new(zone()) LCompareNumericAndBranch(left, right);
1640 } 1649 }
1641 } 1650 }
1642 1651
1643 1652
1644 LInstruction* LChunkBuilder::DoCompareObjectEqAndBranch( 1653 LInstruction* LChunkBuilder::DoCompareObjectEqAndBranch(
1645 HCompareObjectEqAndBranch* instr) { 1654 HCompareObjectEqAndBranch* instr) {
1655 LInstruction* goto_instr = CheckElideControlInstruction(instr);
1656 if (goto_instr != NULL) return goto_instr;
1646 LOperand* left = UseRegisterAtStart(instr->left()); 1657 LOperand* left = UseRegisterAtStart(instr->left());
1647 LOperand* right = UseRegisterOrConstantAtStart(instr->right()); 1658 LOperand* right = UseRegisterOrConstantAtStart(instr->right());
1648 return new(zone()) LCmpObjectEqAndBranch(left, right); 1659 return new(zone()) LCmpObjectEqAndBranch(left, right);
1649 } 1660 }
1650 1661
1651 1662
1652 LInstruction* LChunkBuilder::DoCompareHoleAndBranch( 1663 LInstruction* LChunkBuilder::DoCompareHoleAndBranch(
1653 HCompareHoleAndBranch* instr) { 1664 HCompareHoleAndBranch* instr) {
1654 LOperand* value = UseRegisterAtStart(instr->value()); 1665 LOperand* value = UseRegisterAtStart(instr->value());
1655 return new(zone()) LCmpHoleAndBranch(value); 1666 return new(zone()) LCmpHoleAndBranch(value);
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after
2535 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { 2546 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2536 LOperand* object = UseRegister(instr->object()); 2547 LOperand* object = UseRegister(instr->object());
2537 LOperand* index = UseTempRegister(instr->index()); 2548 LOperand* index = UseTempRegister(instr->index());
2538 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); 2549 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index));
2539 } 2550 }
2540 2551
2541 2552
2542 } } // namespace v8::internal 2553 } } // namespace v8::internal
2543 2554
2544 #endif // V8_TARGET_ARCH_X64 2555 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/lithium-x64.h ('k') | tools/gyp/v8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698