本文整理汇总了C++中MutableHandleFunction::nonLazyScript方法的典型用法代码示例。如果您正苦于以下问题:C++ MutableHandleFunction::nonLazyScript方法的具体用法?C++ MutableHandleFunction::nonLazyScript怎么用?C++ MutableHandleFunction::nonLazyScript使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MutableHandleFunction
的用法示例。
在下文中一共展示了MutableHandleFunction::nonLazyScript方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: result
/*static*/ JSBool
ParallelArrayObject::constructHelper(JSContext *cx, MutableHandleFunction ctor, CallArgs &args0)
{
RootedObject result(cx, newInstance(cx));
if (!result)
return false;
if (cx->typeInferenceEnabled()) {
jsbytecode *pc;
RootedScript script(cx, cx->stack.currentScript(&pc));
if (script) {
if (ctor->nonLazyScript()->shouldCloneAtCallsite) {
ctor.set(CloneFunctionAtCallsite(cx, ctor, script, pc));
if (!ctor)
return false;
}
// Create the type object for the PA. Add in the current
// properties as definite properties if this type object is newly
// created. To tell if it is newly created, we check whether it
// has any properties yet or not, since any returned type object
// must have been created by this same C++ code and hence would
// already have properties if it had been returned before.
types::TypeObject *paTypeObject =
types::TypeScript::InitObject(cx, script, pc, JSProto_ParallelArray);
if (!paTypeObject)
return false;
if (paTypeObject->getPropertyCount() == 0 && !paTypeObject->unknownProperties()) {
if (!paTypeObject->addDefiniteProperties(cx, result))
return false;
// addDefiniteProperties() above should have added one
// property for each of the fixed slots:
JS_ASSERT(paTypeObject->getPropertyCount() == NumFixedSlots);
}
result->setType(paTypeObject);
}
}
InvokeArgsGuard args;
if (!cx->stack.pushInvokeArgs(cx, args0.length(), &args))
return false;
args.setCallee(ObjectValue(*ctor));
args.setThis(ObjectValue(*result));
for (uint32_t i = 0; i < args0.length(); i++)
args[i] = args0[i];
if (!Invoke(cx, args))
return false;
args0.rval().setObject(*result);
return true;
}
示例2: scope
bool
XDRState<mode>::codeFunction(MutableHandleFunction objp)
{
if (mode == XDR_DECODE)
objp.set(nullptr);
else
MOZ_ASSERT(objp->nonLazyScript()->enclosingScope()->is<GlobalScope>());
if (!VersionCheck(this))
return false;
RootedScope scope(cx(), &cx()->global()->emptyGlobalScope());
return XDRInterpretedFunction(this, scope, nullptr, objp);
}
示例3: scope
bool
XDRState<mode>::codeFunction(MutableHandleFunction funp)
{
if (mode == XDR_DECODE)
funp.set(nullptr);
else
MOZ_ASSERT(funp->nonLazyScript()->enclosingScope()->is<GlobalScope>());
if (!VersionCheck(this)) {
postProcessContextErrors(cx());
return false;
}
RootedScope scope(cx(), &cx()->global()->emptyGlobalScope());
if (!XDRInterpretedFunction(this, scope, nullptr, funp)) {
postProcessContextErrors(cx());
funp.set(nullptr);
return false;
}
return true;
}