当前位置: 首页>>代码示例>>C++>>正文


C++ Rooted类代码示例

本文整理汇总了C++中Rooted的典型用法代码示例。如果您正苦于以下问题:C++ Rooted类的具体用法?C++ Rooted怎么用?C++ Rooted使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Rooted类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: scope

bool TypesystemStructHandler::startCommand(Variant::mapType &args)
{
	scope().setFlag(ParserFlag::POST_HEAD, true);

	// Fetch the arguments used for creating this type
	const std::string &structName = args["name"].asString();
	const std::string &parent = args["parent"].asString();

	// Fetch the current typesystem and create the struct node
	Rooted<Typesystem> typesystem = scope().selectOrThrow<Typesystem>();
	Rooted<StructType> structType = typesystem->createStructType(structName);
	structType->setLocation(location());

	// Try to resolve the parent type and set it as parent structure
	if (!parent.empty()) {
		scope().resolve<StructType>(
		    parent, structType, logger(),
		    [](Handle<Node> parent, Handle<Node> structType, Logger &logger) {
			    if (parent != nullptr) {
				    structType.cast<StructType>()->setParentStructure(
				        parent.cast<StructType>(), logger);
			    }
			});
	}
	scope().push(structType);

	return true;
}
开发者ID:astoeckel,项目名称:ousia,代码行数:28,代码来源:TypesystemHandler.cpp

示例2: MarkExactStackRootList

static inline void
MarkExactStackRootList(JSTracer* trc, Source* s, const char* name)
{
    Rooted<T>* rooter = s->roots.template gcRooters<T>();
    while (rooter) {
        T* addr = rooter->address();
        TraceFn(trc, addr, name);
        rooter = rooter->previous();
    }
}
开发者ID:rhelmer,项目名称:gecko-dev,代码行数:10,代码来源:RootMarking.cpp

示例3: MarkExactStackRootList

static inline void
MarkExactStackRootList(JSTracer *trc, Source *s, const char *name)
{
    Rooted<T> *rooter = s->template gcRooters<T>();
    while (rooter) {
        T *addr = rooter->address();
        if (!IgnoreExactRoot(addr))
            MarkFunc(trc, addr, name);
        rooter = rooter->previous();
    }
}
开发者ID:franzks,项目名称:gecko-dev,代码行数:11,代码来源:RootMarking.cpp

示例4: GatherRooters

static void
GatherRooters(Vector<Rooter, 0, SystemAllocPolicy> &rooters,
              Rooted<void*> **thingGCRooters,
              unsigned thingRootKind)
{
    Rooted<void*> *rooter = thingGCRooters[thingRootKind];
    while (rooter) {
        Rooter r = { rooter, ThingRootKind(thingRootKind) };
        JS_ALWAYS_TRUE(rooters.append(r));
        rooter = rooter->previous();
    }
}
开发者ID:dardevelin,项目名称:mozilla-central,代码行数:12,代码来源:Verifier.cpp

示例5: MarkExactStackRooters

static inline void
MarkExactStackRooters(JSTracer *trc, Rooted<void*> rooter, ThingRootKind kind)
{
    Rooted<void*> *rooter = cx->thingGCRooters[i];
    while (rooter) {
        MarkExactStackRoot(trc, rooter, ThingRootKind(i));
        rooter = rooter->previous();
    }
}
开发者ID:IcepOwer,项目名称:Spidermonkey,代码行数:9,代码来源:RootMarking.cpp

示例6: context

bool TypesystemHandler::startCommand(Variant::mapType &args)
{
	// Create the typesystem instance
	Rooted<Typesystem> typesystem =
	    context().getProject()->createTypesystem(args["name"].asString());
	typesystem->setLocation(location());

	// If the typesystem is defined inside a ontology, add a reference to the
	// typesystem to the ontology -- do the same with a document, if no ontology
	// is found
	Rooted<Ontology> ontology = scope().select<Ontology>();
	if (ontology != nullptr) {
		ontology->reference(typesystem);
	} else {
		Rooted<Document> document = scope().select<Document>();
		if (document != nullptr) {
			document->reference(typesystem);
		}
	}

	// Push the typesystem onto the scope, set the POST_HEAD flag to true
	scope().push(typesystem);
	scope().setFlag(ParserFlag::POST_HEAD, false);

	return true;
}
开发者ID:astoeckel,项目名称:ousia,代码行数:26,代码来源:TypesystemHandler.cpp

示例7: MarkExactStackRooter

static inline void
MarkExactStackRooter(JSTracer *trc, Rooted<void*> rooter, ThingRootKind kind)
{
    void **addr = (void **)rooter->address();
    if (!*addr)
        return;

    switch (kind) {
      case THING_ROOT_OBJECT:      MarkObjectRoot(trc, (JSObject **)addr, "exact-object"); break;
      case THING_ROOT_STRING:      MarkStringRoot(trc, (JSSTring **)addr, "exact-string"); break;
      case THING_ROOT_SCRIPT:      MarkScriptRoot(trc, (JSScript **)addr, "exact-script"); break;
      case THING_ROOT_SHAPE:       MarkShapeRoot(trc, (Shape **)addr, "exact-shape"); break;
      case THING_ROOT_BASE_SHAPE:  MarkBaseShapeRoot(trc, (BaseShape **)addr, "exact-baseshape"); break;
      case THING_ROOT_TYPE:        MarkTypeRoot(trc, (types::Type *)addr, "exact-type"); break;
      case THING_ROOT_TYPE_OBJECT: MarkTypeObjectRoot(trc, (types::TypeObject **)addr, "exact-typeobject"); break;
      case THING_ROOT_VALUE:       MarkValueRoot(trc, (Value *)addr, "exact-value"); break;
      case THING_ROOT_ID:          MarkIdRoot(trc, (jsid *)addr, "exact-id"); break;
      case THING_ROOT_PROPERTY_ID: MarkIdRoot(trc, &((js::PropertyId *)addr)->asId(), "exact-propertyid"); break;
      case THING_ROOT_BINDINGS:    ((Bindings *)addr)->trace(trc); break;
      default: JS_NOT_REACHED("Invalid THING_ROOT kind"); break;
    }
}
开发者ID:IcepOwer,项目名称:Spidermonkey,代码行数:22,代码来源:RootMarking.cpp

示例8:

 ~EvalScriptGuard() {
     if (script_) {
         script_->cacheForEval();
         EvalCacheEntry cacheEntry = {script_, lookup_.callerScript, lookup_.pc};
         lookup_.str = lookupStr_;
         if (lookup_.str && IsEvalCacheCandidate(script_))
             cx_->runtime()->evalCache.relookupOrAdd(p_, lookup_, cacheEntry);
     }
 }
开发者ID:martasect,项目名称:gecko,代码行数:9,代码来源:Eval.cpp

示例9: CallDestroyScriptHook

 ~EvalScriptGuard() {
     if (script_) {
         CallDestroyScriptHook(cx_->runtime()->defaultFreeOp(), script_);
         script_->cacheForEval();
         EvalCacheEntry cacheEntry = {script_, lookup_.callerScript, lookup_.pc};
         lookup_.str = lookupStr_;
         if (lookup_.str && IsEvalCacheCandidate(script_))
             cx_->runtime()->evalCache.relookupOrAdd(p_, lookup_, cacheEntry);
     }
 }
开发者ID:JuannyWang,项目名称:gecko-dev,代码行数:10,代码来源:Eval.cpp

示例10:

 ~EvalScriptGuard() {
     if (script_) {
         script_->cacheForEval();
         EvalCacheEntry cacheEntry = {lookupStr_, script_, lookup_.callerScript, lookup_.pc};
         lookup_.str = lookupStr_;
         if (lookup_.str && IsEvalCacheCandidate(script_)) {
             bool ok = cx_->runtime()->evalCache.relookupOrAdd(p_, lookup_, cacheEntry);
             (void)ok; // Ignore failure to add cache entry.
         }
     }
 }
开发者ID:emilio,项目名称:gecko-dev,代码行数:11,代码来源:Eval.cpp

示例11: lookupInEvalCache

 void lookupInEvalCache(JSLinearString *str, JSScript *callerScript, jsbytecode *pc)
 {
     lookupStr_ = str;
     lookup_.str = str;
     lookup_.callerScript = callerScript;
     lookup_.version = cx_->findVersion();
     lookup_.pc = pc;
     p_ = cx_->runtime()->evalCache.lookupForAdd(lookup_);
     if (p_) {
         script_ = p_->script;
         cx_->runtime()->evalCache.remove(p_);
         script_->uncacheForEval();
     }
 }
开发者ID:martasect,项目名称:gecko,代码行数:14,代码来源:Eval.cpp

示例12: setNewScript

 void setNewScript(JSScript *script) {
     // JSScript::initFromEmitter has already called js_CallNewScriptHook.
     JS_ASSERT(!script_ && script);
     script_ = script;
     script_->setActiveEval();
 }
开发者ID:martasect,项目名称:gecko,代码行数:6,代码来源:Eval.cpp


注:本文中的Rooted类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。