本文整理汇总了C++中ModuleGenerator::startFuncDefs方法的典型用法代码示例。如果您正苦于以下问题:C++ ModuleGenerator::startFuncDefs方法的具体用法?C++ ModuleGenerator::startFuncDefs怎么用?C++ ModuleGenerator::startFuncDefs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModuleGenerator
的用法示例。
在下文中一共展示了ModuleGenerator::startFuncDefs方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Fail
static bool
DecodeFunctionBodies(JSContext* cx, Decoder& d, ModuleGenerator& mg)
{
if (!mg.startFuncDefs())
return false;
uint32_t sectionStart;
if (!d.startSection(FunctionBodiesId, §ionStart))
return Fail(cx, d, "failed to start section");
if (sectionStart == Decoder::NotStarted) {
if (mg.numFuncSigs() != 0)
return Fail(cx, d, "expected function bodies");
return mg.finishFuncDefs();
}
uint32_t numFuncBodies;
if (!d.readVarU32(&numFuncBodies))
return Fail(cx, d, "expected function body count");
if (numFuncBodies != mg.numFuncSigs())
return Fail(cx, d, "function body count does not match function signature count");
for (uint32_t funcIndex = 0; funcIndex < numFuncBodies; funcIndex++) {
if (!DecodeFunctionBody(cx, d, mg, funcIndex))
return false;
}
if (!d.finishSection(sectionStart))
return Fail(cx, d, "function section byte size mismatch");
return mg.finishFuncDefs();
}
示例2: Fail
static bool
DecodeCodeSection(JSContext* cx, Decoder& d, ModuleGenerator& mg)
{
if (!mg.startFuncDefs())
return false;
uint32_t funcIndex = 0;
while (d.readCStringIf(CodeSection)) {
uint32_t sectionStart;
if (!d.startSection(§ionStart))
return Fail(cx, d, "expected code section byte size");
uint32_t numFuncs;
if (!d.readVarU32(&numFuncs))
return Fail(cx, d, "expected number of functions");
if (funcIndex + numFuncs > mg.numFuncSigs())
return Fail(cx, d, "more function definitions than declarations");
for (uint32_t i = 0; i < numFuncs; i++) {
if (!DecodeFunc(cx, d, mg, funcIndex++))
return false;
}
if (!d.finishSection(sectionStart))
return Fail(cx, d, "code section byte size mismatch");
}
if (funcIndex != mg.numFuncSigs())
return Fail(cx, d, "fewer function definitions than declarations");
if (!mg.finishFuncDefs())
return false;
return true;
}
示例3: Fail
static bool
DecodeFunctionSections(JSContext* cx, Decoder& d, ModuleGenerator& mg)
{
if (!mg.startFuncDefs())
return false;
uint32_t funcIndex = 0;
for (; d.readCStringIf(FuncLabel); funcIndex++) {
if (funcIndex >= mg.numFuncSigs())
return Fail(cx, d, "more function definitions than declarations");
if (!DecodeFunctionSection(cx, d, mg, funcIndex))
return false;
}
if (funcIndex < mg.numFuncSigs())
return Fail(cx, d, "fewer function definitions than declarations");
if (!mg.finishFuncDefs())
return false;
return true;
}