示例#1
0
void Arguments::copyBackingStore(JSCell* cell, CopyVisitor& visitor, CopyToken token)
{
    Arguments* thisObject = jsCast<Arguments*>(cell);
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
    

    switch (token) {
    case ArgumentsSlowArgumentDataCopyToken: {
        SlowArgumentData* slowArgumentData = thisObject->m_slowArgumentData.get();
        if (!slowArgumentData)
            return;

        if (visitor.checkIfShouldCopy(slowArgumentData)) {
            size_t bytes = SlowArgumentData::sizeForNumArguments(thisObject->m_numArguments);
            SlowArgumentData* newSlowArgumentData = static_cast<SlowArgumentData*>(visitor.allocateNewSpace(bytes));
            memcpy(newSlowArgumentData, slowArgumentData, bytes);
            thisObject->m_slowArgumentData.setWithoutWriteBarrier(newSlowArgumentData);
            visitor.didCopy(slowArgumentData, bytes);
        }
        return;
    }

    default:
        return;
    }
}
示例#2
0
void MapData::copyBackingStore(JSCell* cell, CopyVisitor& visitor, CopyToken token)
{
    MapData* thisObject = jsCast<MapData*>(cell);
    if (token == MapBackingStoreCopyToken && visitor.checkIfShouldCopy(thisObject->m_entries)) {
        Entry* oldEntries = thisObject->m_entries;
        Entry* newEntries = static_cast<Entry*>(visitor.allocateNewSpace(thisObject->capacityInBytes()));
        if (thisObject->shouldPack())
            thisObject->replaceAndPackBackingStore(newEntries, thisObject->m_capacity);
        else
            thisObject->replaceBackingStore(newEntries, thisObject->m_capacity);
        visitor.didCopy(oldEntries, thisObject->capacityInBytes());
    }
    Base::copyBackingStore(cell, visitor, token);
}
示例#3
0
void Arguments::copyBackingStore(JSCell* cell, CopyVisitor& visitor, CopyToken token)
{
    Arguments* thisObject = jsCast<Arguments*>(cell);
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
    

    switch (token) {
    case ArgumentsRegisterArrayCopyToken: {
        WriteBarrier<Unknown>* registerArray = thisObject->m_registerArray.get();
        if (!registerArray)
            return;

        if (visitor.checkIfShouldCopy(registerArray)) {
            size_t bytes = thisObject->registerArraySizeInBytes();
            WriteBarrier<Unknown>* newRegisterArray = static_cast<WriteBarrier<Unknown>*>(visitor.allocateNewSpace(bytes));
            memcpy(newRegisterArray, registerArray, bytes);
            thisObject->m_registerArray.setWithoutWriteBarrier(newRegisterArray);
            thisObject->m_registers = newRegisterArray - CallFrame::offsetFor(1) - 1;
            visitor.didCopy(registerArray, bytes);
        }
        return;
    }

    case ArgumentsSlowArgumentDataCopyToken: {
        SlowArgumentData* slowArgumentData = thisObject->m_slowArgumentData.get();
        if (!slowArgumentData)
            return;

        if (visitor.checkIfShouldCopy(slowArgumentData)) {
            size_t bytes = SlowArgumentData::sizeForNumArguments(thisObject->m_numArguments);
            SlowArgumentData* newSlowArgumentData = static_cast<SlowArgumentData*>(visitor.allocateNewSpace(bytes));
            memcpy(newSlowArgumentData, slowArgumentData, bytes);
            thisObject->m_slowArgumentData.setWithoutWriteBarrier(newSlowArgumentData);
            visitor.didCopy(slowArgumentData, bytes);
        }
        return;
    }

    default:
        return;
    }
}