Пример #1
0
void PutByIdVariant::dumpInContext(PrintStream& out, DumpContext* context) const
{
    switch (kind()) {
    case NotSet:
        out.print("<empty>");
        return;
        
    case Replace:
        out.print(
            "<Replace: ", inContext(structure(), context), ", offset = ", offset(), ">");
        return;
        
    case Transition:
        out.print(
            "<Transition: ", inContext(oldStructure(), context), " -> ",
            pointerDumpInContext(newStructure(), context), ", [",
            listDumpInContext(constantChecks(), context), "], offset = ", offset(), ">");
        return;
        
    case Setter:
        out.print(
            "<Setter: ", inContext(structure(), context), ", [",
            listDumpInContext(constantChecks(), context), "]");
        if (m_alternateBase)
            out.print(", alternateBase = ", inContext(JSValue(m_alternateBase), context));
        out.print(", offset = ", m_offset);
        out.print(", call = ", *m_callLinkStatus);
        out.print(">");
        return;
    }
    
    RELEASE_ASSERT_NOT_REACHED();
}
Пример #2
0
bool PutByIdVariant::reallocatesStorage() const
{
    if (kind() != Transition)
        return false;
    
    if (oldStructureForTransition()->outOfLineCapacity() == newStructure()->outOfLineCapacity())
        return false;
    
    return true;
}
Пример #3
0
bool PutByIdVariant::reallocatesStorage() const
{
    switch (kind()) {
    case Transition:
        return oldStructureForTransition()->outOfLineCapacity() != newStructure()->outOfLineCapacity();
    case Setter:
        return true;
    default:
        return false;
    }
}
Пример #4
0
SparseBlockStructure3D reparallelize(SparseBlockStructure3D const& originalStructure,
                                     plint blockLx, plint blockLy, plint blockLz)
{
    std::vector<std::pair<plint,plint> > rangesX, rangesY, rangesZ;
    Box3D boundingBox = originalStructure.getBoundingBox();
    linearBlockRepartition(boundingBox.x0, boundingBox.x1, blockLx, rangesX);
    linearBlockRepartition(boundingBox.y0, boundingBox.y1, blockLy, rangesY);
    linearBlockRepartition(boundingBox.z0, boundingBox.z1, blockLz, rangesZ);
    SparseBlockStructure3D newStructure(boundingBox);
    std::vector<plint> ids;
    std::vector<Box3D> intersections;
    for (pluint blockX=0; blockX<rangesX.size(); ++blockX) {
        for (pluint blockY=0; blockY<rangesY.size(); ++blockY) {
            for (pluint blockZ=0; blockZ<rangesZ.size(); ++blockZ) {
                Box3D currentBlock(rangesX[blockX].first, rangesX[blockX].second,
                                   rangesY[blockY].first, rangesY[blockY].second,
                                   rangesZ[blockZ].first, rangesZ[blockZ].second);
                ids.clear();
                intersections.clear();
                originalStructure.intersect(currentBlock, ids, intersections);
                // It is possible that the current block fully covers the domain of the old
                // distribution. In this case, simply add current block, in order to avoid
                // fragmentation. Note that this explicit test is really necessary, because
                // the function mergeIntersection, which is called below, is not always able
                // to reconstruct a full block from its fragments.
                if (currentBlock.nCells() == cumNcells(intersections)) {
                    plint nextId = newStructure.nextIncrementalId();
                    newStructure.addBlock(currentBlock, nextId);
                }
                else {
                    // Construct bigger blocks if possible, in order to avoid fragmentation.
                    mergeIntersections(intersections);
                    for(pluint iInters=0; iInters<intersections.size(); ++iInters) {
                        plint nextId = newStructure.nextIncrementalId();
                        newStructure.addBlock(intersections[iInters], nextId);
                    }
                }
            }
        }
    }
    return newStructure;
}
Пример #5
0
void PutByIdVariant::dumpInContext(PrintStream& out, DumpContext* context) const
{
    switch (kind()) {
    case NotSet:
        out.print("<empty>");
        return;
        
    case Replace:
        out.print(
            "<Replace: ", inContext(structure(), context), ", ", offset(), ">");
        return;
        
    case Transition:
        out.print(
            "<Transition: ", inContext(oldStructure(), context), " -> ",
            pointerDumpInContext(newStructure(), context), ", [",
            listDumpInContext(constantChecks(), context), "], ", offset(), ">");
        return;
    }
    
    RELEASE_ASSERT_NOT_REACHED();
}