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


C++ ExecutableBase::isHostFunction方法代码示例

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


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

示例1: ASCIILiteral

String SamplingProfiler::StackFrame::displayNameForJSONTests()
{
    if (frameType == FrameType::Unknown)
        return ASCIILiteral("(unknown)");
    if (frameType == FrameType::Host)
        return ASCIILiteral("(host)");
    RELEASE_ASSERT(frameType != FrameType::UnverifiedCallee);

    ExecutableBase* executable = u.verifiedExecutable;
    if (executable->isHostFunction())
        return static_cast<NativeExecutable*>(executable)->name();

    if (executable->isFunctionExecutable()) {
        String result = static_cast<FunctionExecutable*>(executable)->inferredName().string();
        if (result.isEmpty())
            return ASCIILiteral("(anonymous function)");
        return result;
    }
    if (executable->isEvalExecutable())
        return ASCIILiteral("(eval)");
    if (executable->isProgramExecutable())
        return ASCIILiteral("(program)");
    if (executable->isModuleProgramExecutable())
        return ASCIILiteral("(module)");

    RELEASE_ASSERT_NOT_REACHED();
    return String();
}
开发者ID:TigerWFH,项目名称:webkit,代码行数:28,代码来源:SamplingProfiler.cpp

示例2:

int SamplingProfiler::StackFrame::startLine()
{
    if (frameType == FrameType::Unknown || frameType == FrameType::Host)
        return -1;
    RELEASE_ASSERT(frameType != FrameType::UnverifiedCallee);

    ExecutableBase* executable = u.verifiedExecutable;
    if (executable->isHostFunction())
        return -1;
    return static_cast<ScriptExecutable*>(executable)->firstLine();
}
开发者ID:TigerWFH,项目名称:webkit,代码行数:11,代码来源:SamplingProfiler.cpp

示例3: emptyString

String SamplingProfiler::StackFrame::url()
{
    if (frameType == FrameType::Unknown || frameType == FrameType::Host)
        return emptyString();
    RELEASE_ASSERT(frameType != FrameType::UnverifiedCallee);

    ExecutableBase* executable = u.verifiedExecutable;
    if (executable->isHostFunction())
        return emptyString();

    String url = static_cast<ScriptExecutable*>(executable)->sourceURL();
    if (url.isEmpty())
        return static_cast<ScriptExecutable*>(executable)->source().provider()->sourceURL(); // Fall back to sourceURL directive.
    return url;
}
开发者ID:TigerWFH,项目名称:webkit,代码行数:15,代码来源:SamplingProfiler.cpp

示例4: linkFor

inline char* linkFor(ExecState* execCallee, CodeSpecializationKind kind)
{
    ExecState* exec = execCallee->callerFrame();
    VM* vm = &exec->vm();
    NativeCallFrameTracer tracer(vm, exec);
    
    JSValue calleeAsValue = execCallee->calleeAsValue();
    JSCell* calleeAsFunctionCell = getJSFunction(calleeAsValue);
    if (!calleeAsFunctionCell)
        return reinterpret_cast<char*>(handleHostCall(execCallee, calleeAsValue, kind));

    JSFunction* callee = jsCast<JSFunction*>(calleeAsFunctionCell);
    execCallee->setScope(callee->scopeUnchecked());
    ExecutableBase* executable = callee->executable();

    MacroAssemblerCodePtr codePtr;
    CodeBlock* codeBlock = 0;
    if (executable->isHostFunction())
        codePtr = executable->generatedJITCodeFor(kind)->addressForCall();
    else {
        FunctionExecutable* functionExecutable = static_cast<FunctionExecutable*>(executable);
        JSObject* error = functionExecutable->prepareForExecution(execCallee, callee->scope(), kind);
        if (error) {
            vm->throwException(exec, createStackOverflowError(exec));
            return reinterpret_cast<char*>(vm->getCTIStub(throwExceptionFromCallSlowPathGenerator).code().executableAddress());
        }
        codeBlock = functionExecutable->codeBlockFor(kind);
        if (execCallee->argumentCountIncludingThis() < static_cast<size_t>(codeBlock->numParameters()))
            codePtr = functionExecutable->generatedJITCodeWithArityCheckFor(kind);
        else
            codePtr = functionExecutable->generatedJITCodeFor(kind)->addressForCall();
    }
    CallLinkInfo& callLinkInfo = exec->codeBlock()->getCallLinkInfo(execCallee->returnPC());
    if (!callLinkInfo.seenOnce())
        callLinkInfo.setSeen();
    else
        linkFor(execCallee, callLinkInfo, codeBlock, callee, codePtr, kind);
    return reinterpret_cast<char*>(codePtr.executableAddress());
}
开发者ID:webOS-ports,项目名称:webkit,代码行数:39,代码来源:JITOperations.cpp


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