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

Unified Diff: src/hydrogen-instructions.cc

Issue 12301027: Fixed numeric relations on HPhi instances. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 10 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/hydrogen-instructions.cc
diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc
index 2d4b82bf16ba1efe84bbc0915111921069ad9384..2aa9dbcce73b61d9a254492938223317f7db79ec 100644
--- a/src/hydrogen-instructions.cc
+++ b/src/hydrogen-instructions.cc
@@ -843,6 +843,25 @@ void HNumericConstraint::PrintDataTo(StringStream* stream) {
}
+HInductionVariable* HInductionVariable::AddToGraph(HPhi* phi,
+ NumericRelation relation,
+ int operand_index) {
+ HInductionVariable* result = new(phi->block()->zone()) HInductionVariable(
+ phi, relation, operand_index);
+ result->InsertAfter(phi->block()->first());
+ return result;
+}
+
+
+void HInductionVariable::PrintDataTo(StringStream* stream) {
+ stream->Add("(");
+ RedefinedOperand()->PrintNameTo(stream);
+ stream->Add(" %s ", relation().Mnemonic());
+ induction_base()->PrintNameTo(stream);
+ stream->Add(")");
+}
+
+
void HDummyUse::PrintDataTo(StringStream* stream) {
value()->PrintNameTo(stream);
}
@@ -1554,15 +1573,14 @@ Range* HMod::InferRange(Zone* zone) {
void HPhi::AddInformativeDefinitions() {
if (OperandCount() == 2) {
+ // If one of the operands is an OSR block give up (this cannot be an
+ // induction variable).
+ if (OperandAt(0)->block()->is_osr_entry() ||
+ OperandAt(1)->block()->is_osr_entry()) return;
+
for (int operand_index = 0; operand_index < 2; operand_index++) {
int other_operand_index = (operand_index + 1) % 2;
- // Add an idef that "discards" the OSR entry block branch.
- if (OperandAt(operand_index)->block()->is_osr_entry()) {
- HNumericConstraint::AddToGraph(
- this, NumericRelation::Eq(), OperandAt(other_operand_index));
- }
-
static NumericRelation relations[] = {
NumericRelation::Ge(),
NumericRelation::Le()
@@ -1574,9 +1592,9 @@ void HPhi::AddInformativeDefinitions() {
for (int relation_index = 0; relation_index < 2; relation_index++) {
if (OperandAt(operand_index)->IsRelationTrue(relations[relation_index],
this)) {
- HNumericConstraint::AddToGraph(this,
+ HInductionVariable::AddToGraph(this,
relations[relation_index],
- OperandAt(other_operand_index));
+ other_operand_index);
}
}
}
@@ -1584,6 +1602,26 @@ void HPhi::AddInformativeDefinitions() {
}
+bool HPhi::IsRelationTrueInternal(NumericRelation relation, HValue* other) {
+ if (CheckFlag(kNumericConstraintEvaluationInProgress)) return false;
+
+ SetFlag(kNumericConstraintEvaluationInProgress);
+ bool result = true;
+ for (int i = 0; i < OperandCount(); i++) {
+ // Skip OSR entry blocks
+ if (OperandAt(i)->block()->is_osr_entry()) continue;
+
+ if (!OperandAt(i)->IsRelationTrue(relation, other)) {
+ result = false;
+ break;
+ }
+ }
+ ClearFlag(kNumericConstraintEvaluationInProgress);
+
+ return result;
+}
+
+
Range* HMathMinMax::InferRange(Zone* zone) {
if (representation().IsInteger32()) {
Range* a = left()->range();

Powered by Google App Engine
This is Rietveld 408576698