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


C++ AsmJSModule::postLinkFailureInfo方法代码示例

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


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

示例1: 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;
}
开发者ID:matyapiro31,项目名称:instantbird-1.5,代码行数:35,代码来源:AsmJSLink.cpp

示例2: fun

static bool
HandleDynamicLinkFailure(JSContext *cx, CallArgs args, AsmJSModule &module, HandlePropertyName name)
{
    if (cx->isExceptionPending())
        return false;

    const AsmJSModule::PostLinkFailureInfo &info = module.postLinkFailureInfo();

    uint32_t length = info.bufEnd - info.bufStart;
    Rooted<JSStableString*> src(cx, info.scriptSource->substring(cx, info.bufStart, info.bufEnd));
    if (!src)
        return false;

    RootedFunction fun(cx, NewFunction(cx, NullPtr(), NULL, 0, JSFunction::INTERPRETED,
                                       cx->global(), name, JSFunction::FinalizeKind,
                                       TenuredObject));
    if (!fun)
        return false;

    AutoNameVector formals(cx);
    formals.reserve(3);
    if (module.globalArgumentName())
        formals.infallibleAppend(module.globalArgumentName());
    if (module.importArgumentName())
        formals.infallibleAppend(module.importArgumentName());
    if (module.bufferArgumentName())
        formals.infallibleAppend(module.bufferArgumentName());

    CompileOptions options(cx);
    options.setPrincipals(cx->compartment()->principals)
           .setOriginPrincipals(info.scriptSource->originPrincipals())
           .setCompileAndGo(false)
           .setNoScriptRval(false);

    if (!frontend::CompileFunctionBody(cx, &fun, options, formals, src->chars().get(), length))
        return false;

    // Call the function we just recompiled.

    unsigned argc = args.length();

    InvokeArgs args2(cx);
    if (!args2.init(argc))
        return false;

    args2.setCallee(ObjectValue(*fun));
    args2.setThis(args.thisv());
    for (unsigned i = 0; i < argc; i++)
        args2[i].set(args[i]);

    if (!Invoke(cx, args2))
        return false;

    args.rval().set(args2.rval());

    return true;
}
开发者ID:matyapiro31,项目名称:instantbird-1.5,代码行数:57,代码来源:AsmJSLink.cpp

示例3: fun

static bool
HandleDynamicLinkFailure(JSContext *cx, CallArgs args, AsmJSModule &module, HandlePropertyName name)
{
    if (cx->isExceptionPending())
        return false;

    const AsmJSModule::PostLinkFailureInfo &info = module.postLinkFailureInfo();

    uint32_t length = info.bufEnd_ - info.bufStart_;
    Rooted<JSFlatString*> src(cx, info.scriptSource_->substring(cx, info.bufStart_, info.bufEnd_));
    const jschar *chars = src->chars();

    RootedFunction fun(cx, NewFunction(cx, NullPtr(), NULL, 0, JSFunction::INTERPRETED,
                                       cx->global(), name));
    if (!fun)
        return false;

    AutoNameVector formals(cx);
    formals.reserve(3);
    if (module.globalArgumentName())
        formals.infallibleAppend(module.globalArgumentName());
    if (module.importArgumentName())
        formals.infallibleAppend(module.importArgumentName());
    if (module.bufferArgumentName())
        formals.infallibleAppend(module.bufferArgumentName());

    if (!frontend::CompileFunctionBody(cx, &fun, info.options_, formals, chars, length,
                                       /* isAsmJSRecompile = */ true))
        return false;

    // Call the function we just recompiled.

    unsigned argc = args.length();
    JS_ASSERT(argc <= 3);

    InvokeArgsGuard args2;
    if (!cx->stack.pushInvokeArgs(cx, args.length(), &args2))
        return false;

    args2.setCallee(ObjectValue(*fun));
    args2.setThis(args.thisv());
    if (argc > 0)
        args2[0] = args[0];
    if (argc > 1)
        args2[1] = args[1];
    if (argc > 2)
        args2[2] = args[2];

    if (!Invoke(cx, args2))
        return false;

    args.rval().set(args2.rval());

    return true;
}
开发者ID:dardevelin,项目名称:mozilla-central,代码行数:55,代码来源:AsmJSLink.cpp


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