From 6adeaa8fb45bd32b2228510e35e00d746cfe32d9 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Wed, 14 May 2014 21:51:56 -0700 Subject: [PATCH] Bug 1004363 - IonMonkey: Add a toControlInstruction helper function. r=mjrosenb --- js/src/jit/MIR.h | 15 +++++++++++---- js/src/jit/ValueNumbering.cpp | 4 ++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/js/src/jit/MIR.h b/js/src/jit/MIR.h index 20a6b1cf1b2..86dc6360b27 100644 --- a/js/src/jit/MIR.h +++ b/js/src/jit/MIR.h @@ -105,6 +105,7 @@ class MNode; class MUse; class MIRGraph; class MResumePoint; +class MControlInstruction; // Represents a use of a node. class MUse : public TempObject, public InlineListNode @@ -619,10 +620,6 @@ class MDefinition : public MNode return !uses_.empty(); } - virtual bool isControlInstruction() const { - return false; - } - void addUse(MUse *use) { uses_.pushFront(use); } @@ -663,6 +660,11 @@ class MDefinition : public MNode return !isPhi(); } + virtual bool isControlInstruction() const { + return false; + } + inline MControlInstruction *toControlInstruction(); + void setResultType(MIRType type) { resultType_ = type; } @@ -10240,6 +10242,11 @@ const MInstruction *MDefinition::toInstruction() const return (const MInstruction *)this; } +MControlInstruction *MDefinition::toControlInstruction() { + JS_ASSERT(isControlInstruction()); + return (MControlInstruction *)this; +} + typedef Vector MDefinitionVector; // Helper functions used to decide how to build MIR. diff --git a/js/src/jit/ValueNumbering.cpp b/js/src/jit/ValueNumbering.cpp index 754a7d8c740..8cb976fc99f 100644 --- a/js/src/jit/ValueNumbering.cpp +++ b/js/src/jit/ValueNumbering.cpp @@ -101,8 +101,8 @@ ValueNumberer::simplifyControlInstruction(MControlInstruction *def) repl->setInWorklist(); block->discardLastIns(); - block->end((MControlInstruction *)repl); - return (MControlInstruction *)repl; + block->end(repl->toControlInstruction()); + return repl->toControlInstruction(); } void