From bb886feb20c97a0b6391fe311df2740e932854b2 Mon Sep 17 00:00:00 2001 From: "mmassi@chromium.org" Date: Tue, 19 Feb 2013 16:32:02 +0000 Subject: [PATCH] Remove purely informative definitions from the graph. Review URL: https://codereview.chromium.org/12282033 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13696 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/hydrogen-instructions.h | 7 +++++++ src/hydrogen.cc | 7 ++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h index 2e7e374..829567a 100644 --- a/src/hydrogen-instructions.h +++ b/src/hydrogen-instructions.h @@ -819,6 +819,11 @@ class HValue: public ZoneObject { : NULL; } + // A purely informative definition is an idef that will not emit code and + // should therefore be removed from the graph in the RestoreActualValues + // phase (so that live ranges will be shorter). + virtual bool IsPurelyInformativeDefinition() { return false; } + // This method must always return the original HValue SSA definition // (regardless of any iDef of this value). HValue* ActualValue() { @@ -1286,6 +1291,7 @@ class HNumericConstraint : public HTemplateInstruction<2> { NumericRelation relation() { return relation_; } virtual int RedefinedOperandIndex() { return 0; } + virtual bool IsPurelyInformativeDefinition() { return true; } virtual Representation RequiredInputRepresentation(int index) { return representation(); @@ -3363,6 +3369,7 @@ class HBoundsCheck: public HTemplateInstruction<2> { HValue* length() { return OperandAt(1); } virtual int RedefinedOperandIndex() { return 0; } + virtual bool IsPurelyInformativeDefinition() { return skip_check(); } virtual void AddInformativeDefinitions(); DECLARE_CONCRETE_INSTRUCTION(BoundsCheck) diff --git a/src/hydrogen.cc b/src/hydrogen.cc index ed21567..62fa571 100644 --- a/src/hydrogen.cc +++ b/src/hydrogen.cc @@ -4384,7 +4384,12 @@ void HGraph::RestoreActualValues() { instruction != NULL; instruction = instruction->next()) { if (instruction->ActualValue() != instruction) { - instruction->ReplaceAllUsesWith(instruction->ActualValue()); + ASSERT(instruction->IsInformativeDefinition()); + if (instruction->IsPurelyInformativeDefinition()) { + instruction->DeleteAndReplaceWith(instruction->RedefinedOperand()); + } else { + instruction->ReplaceAllUsesWith(instruction->ActualValue()); + } } } } -- 2.7.4