Actor NewActor( const Property::Map& map )
{
  BaseHandle handle;

  // First find type and create Actor
  Property::Value* typeValue = map.Find( "type" );
  if ( typeValue )
  {
    TypeInfo type = TypeRegistry::Get().GetTypeInfo( typeValue->Get< std::string >() );
    if ( type )
    {
      handle = type.CreateInstance();
    }
  }

  if ( !handle )
  {
    DALI_LOG_ERROR( "Actor type not provided\n" );
    return Actor();
  }

  Actor actor( Actor::DownCast( handle ) );

  if ( actor )
  {
    // Now set the properties, or create children
    for ( unsigned int i = 0, mapCount = map.Count(); i < mapCount; ++i )
    {
      const StringValuePair& pair( map.GetPair( i ) );
      const std::string& key( pair.first );
      if ( key == "type" )
      {
        continue;
      }

      const Property::Value& value( pair.second );

      if ( key == "actors" )
      {
        // Create children
        Property::Array actorArray = value.Get< Property::Array >();
        for ( Property::Array::SizeType i = 0; i < actorArray.Size(); ++i)
        {
          actor.Add( NewActor( actorArray[i].Get< Property::Map >() ) );
        }
      }
      else
      {
        Property::Index index( actor.GetPropertyIndex( key ) );

        if ( index != Property::INVALID_INDEX )
        {
          actor.SetProperty( index, value );
        }
      }
    }
  }

  return actor;
}
Example #2
0
// allocate a object given the classname by string
RTRoot* NewType(const char *typeName)
{
TypeInfo *t = FindType(typeName);
if (!t) return(NULL);
if (t->New == 0) return(NULL);		// abstract type
return t->New();
}
Example #3
0
/*Type* DeclarationNode::buildType(DeclarationSpecifiersNode::TypeInfo tInfo) const
{
	Type* type = NULL;

	bool unsignedSpecified = tInfo.unsignedSpecified;
	int  integral = tInfo.integral;
	bool longSpecified = tInfo.longLongSpecified;
	bool longLongSpecified = tInfo.longLongSpecified;

	if (unsignedSpecified) {
		if (integral==Char) 
			type = new BuiltinType<char>(Type::uChar);
		else if (integral==Short)
			type = new BuiltinType<short>(Type::uShort);
		else if (integral==Int)
			type = new BuiltinType<int>(Type::uInt);
		else if (longLongSpecified)
			type = new BuiltinType<unsigned long long>(Type::uLongLong);
		else if (longSpecified)
			type = new BuiltinType<unsigned long>(Type::uLong);
	}
	else {
		if (integral==Int) {
			if (longLongSpecified)
				type = new BuiltinType<long long>(Type::Long);
			else if (longSpecified)
				type = new BuiltinType<long>(Type::Long);
			else
				type = new BuiltinType<int>(Type::Int);
		}
		else {
			if (integral==Char)
				type = new BuiltinType<char>(Type::Char);
			else if (Short)
				type = new BuiltinType<short>(Type::Short);
			else if (integral==Float)
				type = new BuiltinType<float>(Type::Float);
			else if (integral==Double)
				type = new BuiltinType<double>(Type::Double);
		}
	}

	return type;
}
*/
std::string DeclarationNode::toString() const
{
	std::string s="DeclarationNode: \n" ;
	TypeInfo t = declSpecifier->getTypeInfo();
	s+= "\t" + t.toString() + "\n";
	return s;
}
Example #4
0
  /* Understands how to read the inside of an object and find all references
   * located within. It copies the objects pointed to, but does not follow into
   * those further (ie, not recursive) */
  void GarbageCollector::scan_object(Object* obj) {
    Object* slot;

    // If this object's refs are weak, then add it to the weak_refs
    // vector and don't look at it otherwise.
    if(obj->RefsAreWeak) {
      if(!weak_refs) {
        weak_refs = new ObjectArray(0);
      }

      weak_refs->push_back(obj);
      return;
    }

    if(obj->klass() && obj->klass()->reference_p()) {
      slot = saw_object(obj->klass());
      if(slot) object_memory->set_class(obj, slot);
    }

    if(obj->ivars() && obj->ivars()->reference_p()) {
      slot = saw_object(obj->ivars());
      if(slot) obj->ivars(object_memory->state, slot);
    }

    TypeInfo* ti = object_memory->type_info[obj->obj_type];
    assert(ti);

    ObjectMark mark(this);
    ti->mark(obj, mark);
  }
    bool TypeInfoRepository::addType(TypeInfoGenerator* t)
    {
        if (!t)
            return false;
        std::string tname = t->getTypeName();
        TypeInfo* ti = t->getTypeInfoObject();

        {
            MutexLock lock(type_lock);
            if (ti && data.count(tname) && data[tname] != ti ) {
              cout << "Refusing to add type information for '" << tname << "': the name is already in use by another type."<<endl;
                return false;
            }
        }
        // Check for first registration, or alias:
        if ( ti == 0 )
            ti = new TypeInfo(tname);
        else
            ti->addAlias(tname);

        if ( t->installTypeInfoObject( ti ) ) {
            delete t;
        }
        MutexLock lock(type_lock);
        // keep track of this type:
        data[ tname ] = ti;

        /* cout << "Registered Type '"<<tname <<"' to the Orocos Type System."<< endl;
        for(Transports::iterator it = transports.begin(); it != transports.end(); ++it)
            if ( (*it)->registerTransport( tname, ti) )
            log(Info) << "Registered new '"<< (*it)->getTransportName()<<"' transport for " << tname <<endlog();*/
        return true;
    }
int UtcDaliConfirmationPopupTypeRegistryCreation(void)
{
  ToolkitTestApplication application;
  tet_infoline( " UtcDaliConfirmationPopupTypeRegistryCreation" );

  TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo( "ConfirmationPopup" );
  DALI_TEST_CHECK( typeInfo )

  BaseHandle baseHandle = typeInfo.CreateInstance();
  DALI_TEST_CHECK( baseHandle )

  Toolkit::Popup popup = Toolkit::Popup::DownCast( baseHandle );
  popup.SetProperty( Popup::Property::ANIMATION_DURATION, 0.0f );

  Stage::GetCurrent().Add( popup );
  popup.SetDisplayState( Toolkit::Popup::SHOWN );

  application.SendNotification();
  application.Render();

  // Check the popup is shown.
  DALI_TEST_EQUALS( popup.GetDisplayState(), Popup::SHOWN, TEST_LOCATION );

  END_TEST;
}
Example #7
0
Structure::Structure(VM& vm)
    : JSCell(CreatingEarlyCell)
    , m_prototype(vm, this, jsNull())
    , m_classInfo(info())
    , m_transitionWatchpointSet(IsWatched)
    , m_offset(invalidOffset)
    , m_inlineCapacity(0)
    , m_bitField(0)
{
    setDictionaryKind(NoneDictionaryKind);
    setIsPinnedPropertyTable(false);
    setHasGetterSetterProperties(m_classInfo->hasStaticSetterOrReadonlyProperties());
    setHasCustomGetterSetterProperties(false);
    setHasReadOnlyOrGetterSetterPropertiesExcludingProto(m_classInfo->hasStaticSetterOrReadonlyProperties());
    setHasNonEnumerableProperties(false);
    setAttributesInPrevious(0);
    setPreventExtensions(false);
    setDidTransition(false);
    setStaticFunctionsReified(false);
    setHasRareData(false);
 
    TypeInfo typeInfo = TypeInfo(CellType, StructureIsImmortal);
    m_blob = StructureIDBlob(vm.heap.structureIDTable().allocateID(this), 0, typeInfo);
    m_outOfLineTypeFlags = typeInfo.outOfLineTypeFlags();

    ASSERT(hasReadOnlyOrGetterSetterPropertiesExcludingProto() || !m_classInfo->hasStaticSetterOrReadonlyProperties());
    ASSERT(hasGetterSetterProperties() || !m_classInfo->hasStaticSetterOrReadonlyProperties());
}
Example #8
0
QVector<TypeInfo> Process::getCompletions(const QString &filename, const QByteArray& ustart, const QByteArray& uend)
{
    QStringList args;
    args << "-f=csv" << "autocomplete" << filename << QString("c") + QString::number(ustart.length());

    QProcess p;
    p.start("gocode", args);

    if(!p.waitForStarted(TIMEOUT))
        return QVector<TypeInfo>();

    p.write(ustart);
    p.write(uend);
    p.closeWriteChannel();

    if(!p.waitForFinished(TIMEOUT))
        return QVector<TypeInfo>();

    QStringList lines = QString(p.readAllStandardOutput()).split("\n");
    QVector<TypeInfo> out;
    out.reserve(lines.size());

    TypeInfo info;

    for(int i = 0, e = lines.size(); i < e; ++i)
        if(info.parseString(lines[i]))
            out.push_back(info);

    return out;
}
Example #9
0
Structure::Structure(VM& vm, Structure* previous)
    : JSCell(vm, vm.structureStructure.get())
    , m_prototype(vm, this, previous->storedPrototype())
    , m_classInfo(previous->m_classInfo)
    , m_transitionWatchpointSet(IsWatched)
    , m_offset(invalidOffset)
    , m_inlineCapacity(previous->m_inlineCapacity)
    , m_bitField(0)
{
    setDictionaryKind(previous->dictionaryKind());
    setIsPinnedPropertyTable(previous->hasBeenFlattenedBefore());
    setHasGetterSetterProperties(previous->hasGetterSetterProperties());
    setHasCustomGetterSetterProperties(previous->hasCustomGetterSetterProperties());
    setHasReadOnlyOrGetterSetterPropertiesExcludingProto(previous->hasReadOnlyOrGetterSetterPropertiesExcludingProto());
    setHasNonEnumerableProperties(previous->hasNonEnumerableProperties());
    setAttributesInPrevious(0);
    setPreventExtensions(previous->preventExtensions());
    setDidTransition(true);
    setStaticFunctionsReified(previous->staticFunctionsReified());
    setHasRareData(false);
 
    TypeInfo typeInfo = previous->typeInfo();
    m_blob = StructureIDBlob(vm.heap.structureIDTable().allocateID(this), previous->indexingTypeIncludingHistory(), typeInfo);
    m_outOfLineTypeFlags = typeInfo.outOfLineTypeFlags();

    ASSERT(!previous->typeInfo().structureIsImmortal());
    setPreviousID(vm, previous);

    previous->didTransitionFromThisStructure();
    if (previous->m_globalObject)
        m_globalObject.set(vm, this, previous->m_globalObject.get());
    ASSERT(hasReadOnlyOrGetterSetterPropertiesExcludingProto() || !m_classInfo->hasStaticSetterOrReadonlyProperties());
    ASSERT(hasGetterSetterProperties() || !m_classInfo->hasStaticSetterOrReadonlyProperties());
}
Example #10
0
int UtcDaliStyleManagerGet(void)
{
  ToolkitTestApplication application;

  tet_infoline(" UtcDaliStyleManagerGet");

  // Register Type
  TypeInfo type;
  type = TypeRegistry::Get().GetTypeInfo( "StyleManager" );
  DALI_TEST_CHECK( type );
  BaseHandle handle = type.CreateInstance();
  DALI_TEST_CHECK( handle );

  StyleManager manager;

  manager = StyleManager::Get();
  DALI_TEST_CHECK(manager);

  StyleManager newManager = StyleManager::Get();
  DALI_TEST_CHECK(newManager);

  // Check that focus manager is a singleton
  DALI_TEST_CHECK(manager == newManager);
  END_TEST;
}
Example #11
0
void OutliningMetadataCollector::emitCallToOutlinedCopy(
                            Address dest, Address src,
                            SILType T, const TypeInfo &ti, 
                            IsInitialization_t isInit, IsTake_t isTake) const {
  llvm::SmallVector<llvm::Value *, 4> args;
  args.push_back(IGF.Builder.CreateElementBitCast(src, ti.getStorageType())
                            .getAddress());
  args.push_back(IGF.Builder.CreateElementBitCast(dest, ti.getStorageType())
                            .getAddress());
  addMetadataArguments(args);

  llvm::Constant *outlinedFn;
  if (isInit && isTake) {
    outlinedFn =
      IGF.IGM.getOrCreateOutlinedInitializeWithTakeFunction(T, ti, *this);
  } else if (isInit) {
    outlinedFn =
      IGF.IGM.getOrCreateOutlinedInitializeWithCopyFunction(T, ti, *this);
  } else if (isTake) {
    outlinedFn =
      IGF.IGM.getOrCreateOutlinedAssignWithTakeFunction(T, ti, *this);
  } else {
    outlinedFn =
      IGF.IGM.getOrCreateOutlinedAssignWithCopyFunction(T, ti, *this);
  }

  llvm::CallInst *call = IGF.Builder.CreateCall(outlinedFn, args);
  call->setCallingConv(IGF.IGM.DefaultCC);
}
      /*!
        Est capable de reconnaitre les templates préfixés par des 
        namespaces, ainsi que ceux déjà identifiés comme des templates par 
        opencxx.
      */
      TypeTemplate* TypeTemplate::IdentifierTypeTemplate
                    (TypeInfo informationType, 
                     Environment* environement)
      {


        rDebug("TypeTemplate::IdentifierTypeTemplate") ;
        
      
        switch(informationType.WhatIs())
        {
        case TemplateType:  
          
        { 
         
          rDebug("whatis dit que c'ets un template") ;

          
               
          TemplateClass* classeTemplate 
            =  informationType.TemplateClassMetaobject() ;


          Base::Composition<TypeTemplate>
            resultat(new TypeTemplate(classeTemplate)) ;


          // arguments
          int nombreArguments = 0 ;
          TypeInfo typeArgument ;
      
          while(informationType.NthTemplateArgument(nombreArguments++,typeArgument))
          {
            
            if (typeArgument.WhatIs() == UndefType)
            {
              rDebug("parametre n'a pas de type") ;
              
              
            }
            else
            
              resultat->_parametres.AjouterEnQueue(Type::Construire(typeArgument, environement)) ;
          }

      
          return resultat.Liberer() ;
          break ;
        }
          
        default:
        
          rDebug("whatis dit que c'ets autre chose") ;
        
          return NULL ;
        
        }
        
      }
Example #13
0
TypeInfo *Interpreter::type_info( const Expr &type ) {
    auto iter = type_info_map.find( type );
    ASSERT( iter != type_info_map.end(), "not a registered type var" );

    TypeInfo *res = iter->second;
    res->parse_if_necessary();
    return res;
}
Example #14
0
Owned<void> DynamicNew(const TypeInfo& type, DynamicInitializer)
{
	if (!type.is_dynamically_constructible())
	{
		return nullptr;
	}

	// Construct object
	return AllocateDynamicNew(type, type.get_dynamic_constructor());
}
Example #15
0
Owned<void> DynamicNew(const TypeInfo& type)
{
	if (!type.is_default_constructible() || !type.is_destructible())
	{
		return nullptr;
	}

	// Construct object
	return AllocateDynamicNew(type, type.get_default_constructor());
}
Example #16
0
 // Properly working breakpoints on windows with msvc10 and cdb inside static-function-inside-class-inside-function?
 // Qt-Creator: "No, not heard."
 static void* Helper(rapidjson::Document::ValueType* document, char *nextName)
 {
     bool isObject = document->IsObject();
     TypeInfo *typeInfo = TypeInfo::GetTypeInfo(nextName);
     void *next = typeInfo->New();
     for (rapidjson::Document::ValueType::MemberIterator i = document->MemberBegin(); i != document->MemberEnd(); ++i)
     {
         std::string propertyName = i->name.GetString();
         PropertyInfo *prop = typeInfo->FindProperty(propertyName);
         if (i->value.IsObject())
         {
             prop->SetValue(next, Helper(&(i->value), prop->TypeName()));
         }
         else if( i->value.IsArray())
         {
             for (int j = 0; j < i->value.Size(); j++)
             {
                 TypeInfo *tempTypeInfo = TypeInfo::GetTypeInfo(prop->TypeName());
                 void *temp = tempTypeInfo->New();
                 tempTypeInfo->SetString(temp, i->value[j].GetString());
                 prop->PushValue(next, temp);
                 delete temp;
             }
         }
         else
         {
             TypeInfo *tempTypeInfo = TypeInfo::GetTypeInfo(prop->TypeName());
             void *temp = tempTypeInfo->New();
             tempTypeInfo->SetString(temp, i->value.GetString());
             prop->SetValue(next, temp);
             delete temp;
         }
     }
     return next;
 }
Example #17
0
	bool Object::inherits(const char* cls) const {
		TypeInfo* typeinfo = getTypeInfo();

		for (; typeinfo; typeinfo=typeinfo->getBaseTypeInfo()) {
			if (Strequ(cls, typeinfo->getTypeName())) {
				return true;
			}
		}

		return false;
	}
Example #18
0
// ---------------------------------------------------------------------------
TypeInfo TypeInfo::combine(const TypeInfo &__lhs, const TypeInfo &__rhs) {
    TypeInfo __result = __lhs;

    __result.setConstant(__result.isConstant() || __rhs.isConstant());
    __result.setVolatile(__result.isVolatile() || __rhs.isVolatile());
    __result.setReference(__result.isReference() || __rhs.isReference());
    __result.setIndirections(__result.indirections() + __rhs.indirections());
    __result.setArrayElements(__result.arrayElements() + __rhs.arrayElements());

    return __result;
}
Example #19
0
    void
    flatten_tree (TypeInfo const& ti, TypeInfoSet& set)
    {
      set.insert (ti);

      for (TypeInfo::BaseIterator i = ti.begin_base ();
           i != ti.end_base ();
           i++)
      {
        flatten_tree (i->type_info (), set);
      }
    }
Example #20
0
Object *ObjectTypeDB::instance(const String &p_type) {
	
	TypeInfo *ti;
	{
		OBJTYPE_LOCK;
		ti=types.getptr(p_type);
		ERR_FAIL_COND_V(!ti,NULL);
		ERR_FAIL_COND_V(ti->disabled,NULL);
		ERR_FAIL_COND_V(!ti->creation_func,NULL);
	}

	return ti->creation_func();
}
Example #21
0
DebugTypeInfo DebugTypeInfo::getFromTypeInfo(DeclContext *DC, swift::Type Ty,
                                             const TypeInfo &Info) {
  Size size;
  if (Info.isFixedSize()) {
    const FixedTypeInfo &FixTy = *cast<const FixedTypeInfo>(&Info);
    size = FixTy.getFixedSize();
  } else {
    // FIXME: Handle NonFixedTypeInfo here or assert that we won't
    // encounter one.
    size = Size(0);
  }
  return DebugTypeInfo(DC, Ty.getPointer(), Info.getStorageType(), size,
                       Info.getBestKnownAlignment());
}
Example #22
0
    /* Understands how to read the inside of an object and find all references
     * located within. It copies the objects pointed to, but does not follow into
     * those further (ie, not recursive) */
    void visit_object(Object* obj) {
      if(obj->klass() && obj->klass()->reference_p()) {
        call(obj->klass());
      }

      if(obj->ivars() && obj->ivars()->reference_p()) {
        call(obj->ivars());
      }

      TypeInfo* ti = object_memory_->type_info[obj->type_id()];
      assert(ti);

      ti->visit(obj, *this);
    }
Example #23
0
File: View.cpp Project: sajty/eris
Entity* View::createEntity(const RootEntity& gent)
{
    TypeInfo* type = getConnection()->getTypeService()->getTypeForAtlas(gent);
    assert(type->isBound());
    
    FactoryStore::const_iterator F = m_factories.begin();
    for (; F != m_factories.end(); ++F) {
        if ((*F)->accept(gent, type)) {
            return (*F)->instantiate(gent, type, this);
        }
    }
    
    return new ViewEntity(gent->getId(), type, this);
}
inline js_type_class_t *js_get_type_from_native(T* native_obj) {
    js_type_class_t *typeProxy;
    long typeId = reinterpret_cast<long>(typeid(*native_obj).name());
    HASH_FIND_INT(_js_global_type_ht, &typeId, typeProxy);
    if (!typeProxy) {
        TypeInfo *typeInfo = dynamic_cast<TypeInfo *>(native_obj);
        if (typeInfo) {
            typeId = typeInfo->getClassTypeInfo();
        } else {
            typeId = reinterpret_cast<long>(typeid(T).name());
        }
        HASH_FIND_INT(_js_global_type_ht, &typeId, typeProxy);
    }
    return typeProxy;
}
    void TestRepository::registerTest(const TypeInfo& typeInfo, const std::shared_ptr< ILatencyTest >& testInstance)
    {
        LatencyTestInfo info{ typeInfo.name(), testInstance };

        m_latencyTestInfosByName.insert(std::make_pair(boost::algorithm::to_lower_copy(typeInfo.fullyQualifiedName()), info));
        m_latencyTestInfosByName.insert(std::make_pair(boost::algorithm::to_lower_copy(typeInfo.name()), info));
    }
Example #26
0
Structure::Structure(VM& vm, JSGlobalObject* globalObject, JSValue prototype, const TypeInfo& typeInfo, const ClassInfo* classInfo, IndexingType indexingType, unsigned inlineCapacity)
    : JSCell(vm, vm.structureStructure.get())
    , m_blob(vm.heap.structureIDTable().allocateID(this), indexingType, typeInfo)
    , m_outOfLineTypeFlags(typeInfo.outOfLineTypeFlags())
    , m_globalObject(vm, this, globalObject, WriteBarrier<JSGlobalObject>::MayBeNull)
    , m_prototype(vm, this, prototype)
    , m_classInfo(classInfo)
    , m_transitionWatchpointSet(IsWatched)
    , m_offset(invalidOffset)
    , m_inlineCapacity(inlineCapacity)
    , m_bitField(0)
{
    setDictionaryKind(NoneDictionaryKind);
    setIsPinnedPropertyTable(false);
    setHasGetterSetterProperties(classInfo->hasStaticSetterOrReadonlyProperties());
    setHasCustomGetterSetterProperties(false);
    setHasReadOnlyOrGetterSetterPropertiesExcludingProto(classInfo->hasStaticSetterOrReadonlyProperties());
    setHasNonEnumerableProperties(false);
    setAttributesInPrevious(0);
    setPreventExtensions(false);
    setDidTransition(false);
    setStaticFunctionsReified(false);
    setHasRareData(false);
 
    ASSERT(inlineCapacity <= JSFinalObject::maxInlineCapacity());
    ASSERT(static_cast<PropertyOffset>(inlineCapacity) < firstOutOfLineOffset);
    ASSERT(!hasRareData());
    ASSERT(hasReadOnlyOrGetterSetterPropertiesExcludingProto() || !m_classInfo->hasStaticSetterOrReadonlyProperties());
    ASSERT(hasGetterSetterProperties() || !m_classInfo->hasStaticSetterOrReadonlyProperties());
}
Example #27
0
Structure::Structure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue prototype, const TypeInfo& typeInfo, const ClassInfo* classInfo, IndexingType indexingType, unsigned inlineCapacity)
    : JSCell(globalData, globalData.structureStructure.get())
    , m_globalObject(globalData, this, globalObject, WriteBarrier<JSGlobalObject>::MayBeNull)
    , m_prototype(globalData, this, prototype)
    , m_classInfo(classInfo)
    , m_transitionWatchpointSet(InitializedWatching)
    , m_offset(invalidOffset)
    , m_typeInfo(typeInfo)
    , m_indexingType(indexingType)
    , m_inlineCapacity(inlineCapacity)
    , m_dictionaryKind(NoneDictionaryKind)
    , m_isPinnedPropertyTable(false)
    , m_hasGetterSetterProperties(false)
    , m_hasReadOnlyOrGetterSetterPropertiesExcludingProto(false)
    , m_hasNonEnumerableProperties(false)
    , m_attributesInPrevious(0)
    , m_specificFunctionThrashCount(0)
    , m_preventExtensions(false)
    , m_didTransition(false)
    , m_staticFunctionReified(false)
{
    ASSERT(inlineCapacity <= JSFinalObject::maxInlineCapacity());
    ASSERT(static_cast<PropertyOffset>(inlineCapacity) < firstOutOfLineOffset);
    ASSERT(!typeInfo.structureHasRareData());
}
Example #28
0
TypeInfo registerOrGetType(const char* name, const TypeInfo& rawTypeInfo, 
                           const std::vector<TypeInfo>& baseClassList)
{
    TypeInfoData& data = TypeInfoData::instance();
    {
        NameToTag::const_iterator itr = data.nameToTagMap.find(name);
        if (itr != data.nameToTagMap.end())
            return TypeInfo(itr->second);
    }

    const pair<NameToTag::iterator,bool> ret = data.nameToTagMap.insert(make_pair(name, ++data.globalIDCounter));
    if (ret.second)
    {
        g_nameList[data.globalIDCounter] = name;
        const TypeInfo::TypeId rawId = ((rawTypeInfo.getId() == 0) ? data.globalIDCounter : rawTypeInfo.getId());
        g_rawTypeList[data.globalIDCounter] = rawId;
        const int row = RTTR_MAX_INHERIT_TYPES_COUNT * rawId;
        int index = 0;
        // to do remove double entries
        for (std::vector<TypeInfo>::const_iterator itr = baseClassList.begin();
             itr != baseClassList.end();
             ++itr, ++index)
        {
            g_inheritList[row + index] = (*itr).getId();
        }
    } // else cannot happen!


    return TypeInfo(ret.first->second);
}
Example #29
0
Structure::Structure(JSValue prototype, const TypeInfo& typeInfo, unsigned anonymousSlotCount)
    : m_typeInfo(typeInfo)
    , m_prototype(prototype)
    , m_specificValueInPrevious(0)
    , m_propertyTable(0)
    , m_propertyStorageCapacity(typeInfo.isFinal() ? JSFinalObject_inlineStorageCapacity : JSNonFinalObject_inlineStorageCapacity)
    , m_offset(noOffset)
    , m_dictionaryKind(NoneDictionaryKind)
    , m_isPinnedPropertyTable(false)
    , m_hasGetterSetterProperties(false)
    , m_hasNonEnumerableProperties(false)
    , m_attributesInPrevious(0)
    , m_specificFunctionThrashCount(0)
    , m_anonymousSlotCount(anonymousSlotCount)
    , m_isUsingSingleSlot(true)
{
    m_transitions.m_singleTransition = 0;

    ASSERT(m_prototype);
    ASSERT(m_prototype->isObject() || m_prototype->isNull());

#ifndef NDEBUG
#if ENABLE(JSC_MULTIPLE_THREADS)
    MutexLocker protect(ignoreSetMutex);
#endif
    if (shouldIgnoreLeaks)
        ignoreSet.add(this);
    else
        structureCounter.increment();
#endif

#if DUMP_STRUCTURE_ID_STATISTICS
    liveStructureSet.add(this);
#endif
}
Example #30
0
    void add_ptr_convs(TypeIndex index)
    {
        TypeInfo bare = index.get_info().class_type();
        //add_conv_track<void>(bare);
        //add_conv_track<void const>(bare.as_const_value());

        auto bottom_ptr_type = create_type_mirror("BottomPtr", size_t(0), create_bottom_ptr_type_index(), type_system->global_namespace().get_class_type());
        type_system->add_class(create_bottom_ptr_type_index(), bottom_ptr_type, type_system->global_namespace());

        // allow unsafe_ptr_cast to convert to any type and nil (NULL) to any pointer type
        add_nochange_conv(create_bottom_ptr_type_info(), bare.as_ptr_to_nonconst(), "bottom ptr unsafe cast to any ptr");
        add_nochange_conv(create_bottom_ptr_type_info(), bare.as_ptr_to_const(), "bottom ptr unsafe cast to any const ptr");

        // allow any ptr to be converted to void* or void const*
        add_nochange_conv(bare.as_ptr_to_nonconst(), TypId<void*>::restricted().get_info(), "any ptr to void ptr");
        add_nochange_conv(bare.as_ptr_to_const(), TypId<void const*>::restricted().get_info(), "any ptr to const void ptr");
    }