Structure* PrototypeMap::emptyObjectStructureForPrototype(JSObject* prototype, unsigned inlineCapacity)
{
    StructureMap::AddResult addResult = m_structures.add(std::make_pair(prototype, inlineCapacity), nullptr);
    if (!addResult.isNewEntry) {
        ASSERT(isPrototype(prototype));
        return addResult.iterator->value.get();
    }

    addPrototype(prototype);
    Structure* structure = JSFinalObject::createStructure(
        prototype->globalObject()->vm(), prototype->globalObject(), prototype, inlineCapacity);
    addResult.iterator->value = Weak<Structure>(structure);
    return structure;
}
Ejemplo n.º 2
0
Structure* PrototypeMap::emptyObjectStructureForPrototype(JSObject* prototype, unsigned inlineCapacity)
{
    auto key = std::make_pair(prototype, inlineCapacity);
    if (Structure* structure = m_structures.get(key)) {
        ASSERT(isPrototype(prototype));
        return structure;
    }

    addPrototype(prototype);
    Structure* structure = JSFinalObject::createStructure(
        prototype->globalObject()->vm(), prototype->globalObject(), prototype, inlineCapacity);
    m_structures.set(key, Weak<Structure>(structure));
    return structure;
}
Ejemplo n.º 3
0
inline Structure* PrototypeMap::createEmptyStructure(JSGlobalObject* globalObject, JSObject* prototype, const TypeInfo& typeInfo, const ClassInfo* classInfo, IndexingType indexingType, unsigned inlineCapacity)
{
    auto key = std::make_tuple(prototype, inlineCapacity, classInfo, globalObject);
    if (Structure* structure = m_structures.get(key)) {
        ASSERT(isPrototype(prototype));
        return structure;
    }

    addPrototype(prototype);
    Structure* structure = Structure::create(
        globalObject->vm(), globalObject, prototype, typeInfo, classInfo, indexingType, inlineCapacity);
    m_structures.set(key, Weak<Structure>(structure));
    return structure;
}
Ejemplo n.º 4
0
bool DoodadPrototyper::addPrototype(const Doodad::BuiltInType& type,
                          const unsigned char& width,
                          const unsigned char& height) {
  addPrototype((int)type, width, height);
}
Ejemplo n.º 5
0
/**
 * Constructs a new ValueManager. Usually this is NOT done manually.
 * Users should use the ValueManager provided by the Core with method
 * Core::getInstance()->getValueManager().
 *
 * The constructor automatically adds prototypes for all common value types.
 * Additional prototypes can be added manually with method addPrototype().
 */
ValueManager::ValueManager() : mMutex(QMutex::Recursive),
    mRepositoryChangedCounter(0)
{
    mRepositoryChangedEvent = Core::getInstance()->getEventManager()
                              ->createEvent(NerdConstants::EVENT_VALUE_REPOSITORY_CHANGED);

// 	mRepositoryChangedEvent = eventManager
// 		->createEvent(NerdConstants::EVENT_VALUE_REPOSITORY_CHANGED);

    mRepositoryChangedCounter = new IntValue(0);
    addValue(NerdConstants::VALUE_NERD_REPOSITORY_CHANGED_COUNTER,
             mRepositoryChangedCounter);

    //add default value prototypes
    addPrototype(new IntValue());
    addPrototype(new DoubleValue());
    addPrototype(new BoolValue());
    addPrototype(new StringValue());
    addPrototype(new ColorValue());
    addPrototype(new InterfaceValue("", ""));
    addPrototype(new NormalizedDoubleValue());
    addPrototype(new QuaternionValue());
    addPrototype(new Vector3DValue());
    addPrototype(new Matrix3x3Value());
    addPrototype(new ULongLongValue());

}