本文整理汇总了C++中AsmJSModule::perfProfiledFunction方法的典型用法代码示例。如果您正苦于以下问题:C++ AsmJSModule::perfProfiledFunction方法的具体用法?C++ AsmJSModule::perfProfiledFunction怎么用?C++ AsmJSModule::perfProfiledFunction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AsmJSModule
的用法示例。
在下文中一共展示了AsmJSModule::perfProfiledFunction方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AtomToPrintableString
static bool
SendFunctionsToPerf(JSContext *cx, AsmJSModule &module)
{
if (!PerfFuncEnabled())
return true;
uintptr_t base = (uintptr_t) module.codeBase();
const char *filename = module.scriptSource()->filename();
for (unsigned i = 0; i < module.numPerfFunctions(); i++) {
const AsmJSModule::ProfiledFunction &func = module.perfProfiledFunction(i);
uintptr_t start = base + (unsigned long) func.startCodeOffset;
uintptr_t end = base + (unsigned long) func.endCodeOffset;
JS_ASSERT(end >= start);
size_t size = end - start;
JSAutoByteString bytes;
const char *name = AtomToPrintableString(cx, func.name, &bytes);
if (!name)
return false;
writePerfSpewerAsmJSFunctionMap(start, size, filename, func.lineno, func.columnIndex, name);
}
return true;
}
示例2: AtomToPrintableString
static bool
SendFunctionsToPerf(JSContext *cx, AsmJSModule &module)
{
if (!PerfFuncEnabled())
return true;
AsmJSPerfSpewer perfSpewer;
unsigned long base = (unsigned long) module.functionCode();
const AsmJSModule::PostLinkFailureInfo &info = module.postLinkFailureInfo();
const char *filename = const_cast<char *>(info.scriptSource->filename());
for (unsigned i = 0; i < module.numPerfFunctions(); i++) {
const AsmJSModule::ProfiledFunction &func = module.perfProfiledFunction(i);
unsigned long start = base + (unsigned long) func.startCodeOffset;
unsigned long end = base + (unsigned long) func.endCodeOffset;
JS_ASSERT(end >= start);
unsigned long size = (end - start);
JSAutoByteString bytes;
const char *method_name = AtomToPrintableString(cx, func.name, &bytes);
if (!method_name)
return false;
unsigned lineno = func.lineno;
unsigned columnIndex = func.columnIndex;
perfSpewer.writeFunctionMap(start, size, filename, lineno, columnIndex, method_name);
}
return true;
}