本文整理汇总了C++中MutableHandle::module方法的典型用法代码示例。如果您正苦于以下问题:C++ MutableHandle::module方法的具体用法?C++ MutableHandle::module怎么用?C++ MutableHandle::module使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MutableHandle
的用法示例。
在下文中一共展示了MutableHandle::module方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
static bool
CloneModule(JSContext* cx, MutableHandle<AsmJSModuleObject*> moduleObj)
{
ScopedJSDeletePtr<AsmJSModule> module;
if (!moduleObj->module().clone(cx, &module))
return false;
AsmJSModuleObject* newModuleObj = AsmJSModuleObject::create(cx, &module);
if (!newModuleObj)
return false;
moduleObj.set(newModuleObj);
return true;
}
示例2: d
static bool
DecodeModule(JSContext* cx, UniqueChars filename, const uint8_t* bytes, uint32_t length,
ImportNameVector* importNames, ExportMap* exportMap,
MutableHandle<WasmModuleObject*> moduleObj)
{
Decoder d(bytes, bytes + length);
uint32_t u32;
if (!d.readU32(&u32) || u32 != MagicNumber)
return Fail(cx, d, "failed to match magic number");
if (!d.readU32(&u32) || u32 != EncodingVersion)
return Fail(cx, d, "failed to match binary version");
UniqueModuleGeneratorData init = MakeUnique<ModuleGeneratorData>();
if (!init)
return false;
if (!DecodeSignatureSection(cx, d, init.get()))
return false;
if (!DecodeDeclarationSection(cx, d, init.get()))
return false;
if (!DecodeImportSection(cx, d, init.get(), importNames))
return false;
ModuleGenerator mg(cx);
if (!mg.init(Move(init)))
return false;
if (!DecodeExportsSection(cx, d, mg, exportMap))
return false;
HeapUsage heapUsage = HeapUsage::None;
if (!DecodeCodeSection(cx, d, mg))
return false;
CacheableCharsVector funcNames;
while (!d.readCStringIf(EndSection)) {
if (!DecodeUnknownSection(cx, d))
return false;
}
if (!d.done())
return Fail(cx, d, "failed to consume all bytes of module");
UniqueModuleData module;
UniqueStaticLinkData link;
SlowFunctionVector slowFuncs(cx);
if (!mg.finish(heapUsage, Move(filename), Move(funcNames), &module, &link, &slowFuncs))
return false;
moduleObj.set(WasmModuleObject::create(cx));
if (!moduleObj)
return false;
if (!moduleObj->init(cx->new_<Module>(Move(module))))
return false;
return moduleObj->module().staticallyLink(cx, *link);
}
示例3: d
static bool
DecodeModule(JSContext* cx, UniqueChars file, const uint8_t* bytes, uint32_t length,
ImportNameVector* importNames, UniqueExportMap* exportMap,
MutableHandle<ArrayBufferObject*> heap, MutableHandle<WasmModuleObject*> moduleObj)
{
Decoder d(bytes, bytes + length);
uint32_t u32;
if (!d.readFixedU32(&u32) || u32 != MagicNumber)
return Fail(cx, d, "failed to match magic number");
if (!d.readFixedU32(&u32) || u32 != EncodingVersion)
return Fail(cx, d, "failed to match binary version");
UniqueModuleGeneratorData init = js::MakeUnique<ModuleGeneratorData>(cx);
if (!init)
return false;
if (!DecodeSignatures(cx, d, init.get()))
return false;
if (!DecodeImportTable(cx, d, init.get(), importNames))
return false;
if (!DecodeFunctionSignatures(cx, d, init.get()))
return false;
if (!DecodeFunctionTable(cx, d, init.get()))
return false;
ModuleGenerator mg(cx);
if (!mg.init(Move(init), Move(file)))
return false;
if (!DecodeMemory(cx, d, mg, heap))
return false;
if (!DecodeExportTable(cx, d, mg))
return false;
if (!DecodeFunctionBodies(cx, d, mg))
return false;
if (!DecodeDataSegments(cx, d, heap))
return false;
CacheableCharsVector funcNames;
while (!d.done()) {
if (!d.skipSection())
return Fail(cx, d, "failed to skip unknown section at end");
}
UniqueModuleData module;
UniqueStaticLinkData staticLink;
SlowFunctionVector slowFuncs(cx);
if (!mg.finish(Move(funcNames), &module, &staticLink, exportMap, &slowFuncs))
return false;
moduleObj.set(WasmModuleObject::create(cx));
if (!moduleObj)
return false;
if (!moduleObj->init(cx->new_<Module>(Move(module))))
return false;
return moduleObj->module().staticallyLink(cx, *staticLink);
}