Exemple #1
0
void Node::convertToIdentityOn(Node* child)
{
    children.reset();
    child1() = child->defaultEdge();
    NodeFlags output = canonicalResultRepresentation(this->result());
    NodeFlags input = canonicalResultRepresentation(child->result());
    if (output == input) {
        setOpAndDefaultFlags(Identity);
        setResult(output);
        return;
    }
    switch (output) {
    case NodeResultDouble:
        setOpAndDefaultFlags(DoubleRep);
        switch (input) {
        case NodeResultInt52:
            child1().setUseKind(Int52RepUse);
            return;
        case NodeResultJS:
            child1().setUseKind(NumberUse);
            return;
        default:
            RELEASE_ASSERT_NOT_REACHED();
            return;
        }
    case NodeResultInt52:
        setOpAndDefaultFlags(Int52Rep);
        switch (input) {
        case NodeResultDouble:
            child1().setUseKind(DoubleRepAnyIntUse);
            return;
        case NodeResultJS:
            child1().setUseKind(AnyIntUse);
            return;
        default:
            RELEASE_ASSERT_NOT_REACHED();
            return;
        }
    case NodeResultJS:
        setOpAndDefaultFlags(ValueRep);
        switch (input) {
        case NodeResultDouble:
            child1().setUseKind(DoubleRepUse);
            return;
        case NodeResultInt52:
            child1().setUseKind(Int52RepUse);
            return;
        default:
            RELEASE_ASSERT_NOT_REACHED();
            return;
        }
    default:
        RELEASE_ASSERT_NOT_REACHED();
        return;
    }
}
Exemple #2
0
void Node::convertToIdentity()
{
    RELEASE_ASSERT(child1());
    RELEASE_ASSERT(!child2());
    NodeFlags result = canonicalResultRepresentation(this->result());
    setOpAndDefaultFlags(Identity);
    setResult(result);
}
Exemple #3
0
void Node::remove()
{
    ASSERT(!(flags() & NodeHasVarArgs));
    
    children = children.justChecks();
    
    setOpAndDefaultFlags(Check);
}
Exemple #4
0
void Node::convertToCallDOM(Graph& graph)
{
    ASSERT(op() == Call);
    ASSERT(signature());

    Edge edges[3];
    // Skip the first one. This is callee.
    RELEASE_ASSERT(numChildren() <= 4);
    for (unsigned i = 1; i < numChildren(); ++i)
        edges[i - 1] = graph.varArgChild(this, i);

    setOpAndDefaultFlags(CallDOM);
    children.setChild1(edges[0]);
    children.setChild2(edges[1]);
    children.setChild3(edges[2]);

    if (!signature()->effect.mustGenerate())
        clearFlags(NodeMustGenerate);
}