| 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 825 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 836 | 836 | 
| 837 void HNumericConstraint::PrintDataTo(StringStream* stream) { | 837 void HNumericConstraint::PrintDataTo(StringStream* stream) { | 
| 838   stream->Add("("); | 838   stream->Add("("); | 
| 839   constrained_value()->PrintNameTo(stream); | 839   constrained_value()->PrintNameTo(stream); | 
| 840   stream->Add(" %s ", relation().Mnemonic()); | 840   stream->Add(" %s ", relation().Mnemonic()); | 
| 841   related_value()->PrintNameTo(stream); | 841   related_value()->PrintNameTo(stream); | 
| 842   stream->Add(")"); | 842   stream->Add(")"); | 
| 843 } | 843 } | 
| 844 | 844 | 
| 845 | 845 | 
|  | 846 HInductionVariableAnnotation* HInductionVariableAnnotation::AddToGraph( | 
|  | 847     HPhi* phi, | 
|  | 848     NumericRelation relation, | 
|  | 849     int operand_index) { | 
|  | 850   HInductionVariableAnnotation* result = | 
|  | 851       new(phi->block()->zone()) HInductionVariableAnnotation(phi, relation, | 
|  | 852                                                              operand_index); | 
|  | 853   result->InsertAfter(phi->block()->first()); | 
|  | 854   return result; | 
|  | 855 } | 
|  | 856 | 
|  | 857 | 
|  | 858 void HInductionVariableAnnotation::PrintDataTo(StringStream* stream) { | 
|  | 859   stream->Add("("); | 
|  | 860   RedefinedOperand()->PrintNameTo(stream); | 
|  | 861   stream->Add(" %s ", relation().Mnemonic()); | 
|  | 862   induction_base()->PrintNameTo(stream); | 
|  | 863   stream->Add(")"); | 
|  | 864 } | 
|  | 865 | 
|  | 866 | 
| 846 void HDummyUse::PrintDataTo(StringStream* stream) { | 867 void HDummyUse::PrintDataTo(StringStream* stream) { | 
| 847   value()->PrintNameTo(stream); | 868   value()->PrintNameTo(stream); | 
| 848 } | 869 } | 
| 849 | 870 | 
| 850 | 871 | 
| 851 void HUnaryCall::PrintDataTo(StringStream* stream) { | 872 void HUnaryCall::PrintDataTo(StringStream* stream) { | 
| 852   value()->PrintNameTo(stream); | 873   value()->PrintNameTo(stream); | 
| 853   stream->Add(" "); | 874   stream->Add(" "); | 
| 854   stream->Add("#%d", argument_count()); | 875   stream->Add("#%d", argument_count()); | 
| 855 } | 876 } | 
| (...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1547     } | 1568     } | 
| 1548     return result; | 1569     return result; | 
| 1549   } else { | 1570   } else { | 
| 1550     return HValue::InferRange(zone); | 1571     return HValue::InferRange(zone); | 
| 1551   } | 1572   } | 
| 1552 } | 1573 } | 
| 1553 | 1574 | 
| 1554 | 1575 | 
| 1555 void HPhi::AddInformativeDefinitions() { | 1576 void HPhi::AddInformativeDefinitions() { | 
| 1556   if (OperandCount() == 2) { | 1577   if (OperandCount() == 2) { | 
|  | 1578     // If one of the operands is an OSR block give up (this cannot be an | 
|  | 1579     // induction variable). | 
|  | 1580     if (OperandAt(0)->block()->is_osr_entry() || | 
|  | 1581         OperandAt(1)->block()->is_osr_entry()) return; | 
|  | 1582 | 
| 1557     for (int operand_index = 0; operand_index < 2; operand_index++) { | 1583     for (int operand_index = 0; operand_index < 2; operand_index++) { | 
| 1558       int other_operand_index = (operand_index + 1) % 2; | 1584       int other_operand_index = (operand_index + 1) % 2; | 
| 1559 | 1585 | 
| 1560       // Add an idef that "discards" the OSR entry block branch. |  | 
| 1561       if (OperandAt(operand_index)->block()->is_osr_entry()) { |  | 
| 1562         HNumericConstraint::AddToGraph( |  | 
| 1563             this, NumericRelation::Eq(), OperandAt(other_operand_index)); |  | 
| 1564       } |  | 
| 1565 |  | 
| 1566       static NumericRelation relations[] = { | 1586       static NumericRelation relations[] = { | 
| 1567         NumericRelation::Ge(), | 1587         NumericRelation::Ge(), | 
| 1568         NumericRelation::Le() | 1588         NumericRelation::Le() | 
| 1569       }; | 1589       }; | 
| 1570 | 1590 | 
| 1571       // Check if this phi is an induction variable. If, e.g., we know that | 1591       // Check if this phi is an induction variable. If, e.g., we know that | 
| 1572       // its first input is greater than the phi itself, then that must be | 1592       // its first input is greater than the phi itself, then that must be | 
| 1573       // the back edge, and the phi is always greater than its second input. | 1593       // the back edge, and the phi is always greater than its second input. | 
| 1574       for (int relation_index = 0; relation_index < 2; relation_index++) { | 1594       for (int relation_index = 0; relation_index < 2; relation_index++) { | 
| 1575         if (OperandAt(operand_index)->IsRelationTrue(relations[relation_index], | 1595         if (OperandAt(operand_index)->IsRelationTrue(relations[relation_index], | 
| 1576                                                      this)) { | 1596                                                      this)) { | 
| 1577           HNumericConstraint::AddToGraph(this, | 1597           HInductionVariableAnnotation::AddToGraph(this, | 
| 1578                                          relations[relation_index], | 1598                                                    relations[relation_index], | 
| 1579                                          OperandAt(other_operand_index)); | 1599                                                    other_operand_index); | 
| 1580         } | 1600         } | 
| 1581       } | 1601       } | 
| 1582     } | 1602     } | 
| 1583   } | 1603   } | 
| 1584 } | 1604 } | 
| 1585 | 1605 | 
| 1586 | 1606 | 
|  | 1607 bool HPhi::IsRelationTrueInternal(NumericRelation relation, HValue* other) { | 
|  | 1608   if (CheckFlag(kNumericConstraintEvaluationInProgress)) return false; | 
|  | 1609 | 
|  | 1610   SetFlag(kNumericConstraintEvaluationInProgress); | 
|  | 1611   bool result = true; | 
|  | 1612   for (int i = 0; i < OperandCount(); i++) { | 
|  | 1613     // Skip OSR entry blocks | 
|  | 1614     if (OperandAt(i)->block()->is_osr_entry()) continue; | 
|  | 1615 | 
|  | 1616     if (!OperandAt(i)->IsRelationTrue(relation, other)) { | 
|  | 1617       result = false; | 
|  | 1618       break; | 
|  | 1619     } | 
|  | 1620   } | 
|  | 1621   ClearFlag(kNumericConstraintEvaluationInProgress); | 
|  | 1622 | 
|  | 1623   return result; | 
|  | 1624 } | 
|  | 1625 | 
|  | 1626 | 
| 1587 Range* HMathMinMax::InferRange(Zone* zone) { | 1627 Range* HMathMinMax::InferRange(Zone* zone) { | 
| 1588   if (representation().IsInteger32()) { | 1628   if (representation().IsInteger32()) { | 
| 1589     Range* a = left()->range(); | 1629     Range* a = left()->range(); | 
| 1590     Range* b = right()->range(); | 1630     Range* b = right()->range(); | 
| 1591     Range* res = a->Copy(zone); | 1631     Range* res = a->Copy(zone); | 
| 1592     if (operation_ == kMathMax) { | 1632     if (operation_ == kMathMax) { | 
| 1593       res->CombinedMax(b); | 1633       res->CombinedMax(b); | 
| 1594     } else { | 1634     } else { | 
| 1595       ASSERT(operation_ == kMathMin); | 1635       ASSERT(operation_ == kMathMin); | 
| 1596       res->CombinedMin(b); | 1636       res->CombinedMin(b); | 
| (...skipping 1463 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 3060 | 3100 | 
| 3061 | 3101 | 
| 3062 void HCheckFunction::Verify() { | 3102 void HCheckFunction::Verify() { | 
| 3063   HInstruction::Verify(); | 3103   HInstruction::Verify(); | 
| 3064   ASSERT(HasNoUses()); | 3104   ASSERT(HasNoUses()); | 
| 3065 } | 3105 } | 
| 3066 | 3106 | 
| 3067 #endif | 3107 #endif | 
| 3068 | 3108 | 
| 3069 } }  // namespace v8::internal | 3109 } }  // namespace v8::internal | 
| OLD | NEW | 
|---|