| OLD | NEW |
| 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 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1041 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { | 1041 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { |
| 1042 return new(zone()) LGoto(instr->FirstSuccessor()->block_id()); | 1042 return new(zone()) LGoto(instr->FirstSuccessor()->block_id()); |
| 1043 } | 1043 } |
| 1044 | 1044 |
| 1045 | 1045 |
| 1046 LInstruction* LChunkBuilder::DoBranch(HBranch* instr) { | 1046 LInstruction* LChunkBuilder::DoBranch(HBranch* instr) { |
| 1047 HValue* value = instr->value(); | 1047 HValue* value = instr->value(); |
| 1048 if (value->EmitAtUses()) { | 1048 if (value->EmitAtUses()) { |
| 1049 ASSERT(value->IsConstant()); | 1049 ASSERT(value->IsConstant()); |
| 1050 ASSERT(!value->representation().IsDouble()); | 1050 ASSERT(!value->representation().IsDouble()); |
| 1051 HBasicBlock* successor = HConstant::cast(value)->BooleanValue() | 1051 return ElideControlInstruction(instr, |
| 1052 ? instr->FirstSuccessor() | 1052 HConstant::cast(value)->BooleanValue()); |
| 1053 : instr->SecondSuccessor(); | |
| 1054 return new(zone()) LGoto(successor->block_id()); | |
| 1055 } | 1053 } |
| 1056 | 1054 |
| 1057 ToBooleanStub::Types expected = instr->expected_input_types(); | 1055 ToBooleanStub::Types expected = instr->expected_input_types(); |
| 1058 | 1056 |
| 1059 // Tagged values that are not known smis or booleans require a | 1057 // Tagged values that are not known smis or booleans require a |
| 1060 // deoptimization environment. If the instruction is generic no | 1058 // deoptimization environment. If the instruction is generic no |
| 1061 // environment is needed since all cases are handled. | 1059 // environment is needed since all cases are handled. |
| 1062 Representation rep = value->representation(); | 1060 Representation rep = value->representation(); |
| 1063 HType type = value->type(); | 1061 HType type = value->type(); |
| 1064 if (!rep.IsTagged() || type.IsSmi() || type.IsBoolean()) { | 1062 if (!rep.IsTagged() || type.IsSmi() || type.IsBoolean()) { |
| (...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1730 left = UseRegisterAtStart(instr->left()); | 1728 left = UseRegisterAtStart(instr->left()); |
| 1731 right = UseRegisterAtStart(instr->right()); | 1729 right = UseRegisterAtStart(instr->right()); |
| 1732 } | 1730 } |
| 1733 return new(zone()) LCompareNumericAndBranch(left, right); | 1731 return new(zone()) LCompareNumericAndBranch(left, right); |
| 1734 } | 1732 } |
| 1735 } | 1733 } |
| 1736 | 1734 |
| 1737 | 1735 |
| 1738 LInstruction* LChunkBuilder::DoCompareObjectEqAndBranch( | 1736 LInstruction* LChunkBuilder::DoCompareObjectEqAndBranch( |
| 1739 HCompareObjectEqAndBranch* instr) { | 1737 HCompareObjectEqAndBranch* instr) { |
| 1738 if (instr->left()->IsConstant() && instr->right()->IsConstant()) { |
| 1739 bool comparison_result = |
| 1740 HConstant::cast(instr->left())->SameConstantObject( |
| 1741 HConstant::cast(instr->right())); |
| 1742 return ElideControlInstruction(instr, comparison_result); |
| 1743 } |
| 1744 |
| 1740 LOperand* left = UseRegisterAtStart(instr->left()); | 1745 LOperand* left = UseRegisterAtStart(instr->left()); |
| 1741 LOperand* right = UseOrConstantAtStart(instr->right()); | 1746 LOperand* right = UseOrConstantAtStart(instr->right()); |
| 1742 return new(zone()) LCmpObjectEqAndBranch(left, right); | 1747 return new(zone()) LCmpObjectEqAndBranch(left, right); |
| 1743 } | 1748 } |
| 1744 | 1749 |
| 1745 | 1750 |
| 1746 LInstruction* LChunkBuilder::DoCompareHoleAndBranch( | 1751 LInstruction* LChunkBuilder::DoCompareHoleAndBranch( |
| 1747 HCompareHoleAndBranch* instr) { | 1752 HCompareHoleAndBranch* instr) { |
| 1748 LOperand* object = UseRegisterAtStart(instr->object()); | 1753 LOperand* object = UseRegisterAtStart(instr->object()); |
| 1749 return new(zone()) LCmpHoleAndBranch(object); | 1754 return new(zone()) LCmpHoleAndBranch(object); |
| (...skipping 983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2733 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2738 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
| 2734 LOperand* object = UseRegister(instr->object()); | 2739 LOperand* object = UseRegister(instr->object()); |
| 2735 LOperand* index = UseTempRegister(instr->index()); | 2740 LOperand* index = UseTempRegister(instr->index()); |
| 2736 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 2741 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |
| 2737 } | 2742 } |
| 2738 | 2743 |
| 2739 | 2744 |
| 2740 } } // namespace v8::internal | 2745 } } // namespace v8::internal |
| 2741 | 2746 |
| 2742 #endif // V8_TARGET_ARCH_IA32 | 2747 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |