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


C++ FunctionDecoder类代码示例

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


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

示例1: DecodeConst

static bool
DecodeConst(FunctionDecoder& f, ExprType expected)
{
    if (!f.d().readVarU32())
        return f.fail("unable to read i32.const immediate");

    return CheckType(f, ExprType::I32, expected);
}
开发者ID:ajkerrigan,项目名称:gecko-dev,代码行数:8,代码来源:Wasm.cpp

示例2: DecodeExpr

static bool
DecodeExpr(FunctionDecoder& f, ExprType expected)
{
    Expr expr;
    if (!f.d().readExpr(&expr))
        return f.fail("unable to read expression");

    switch (expr) {
      case Expr::Nop:
        return CheckType(f, ExprType::Void, expected);
      case Expr::Call:
        return DecodeCall(f, expected);
      case Expr::CallImport:
        return DecodeCallImport(f, expected);
      case Expr::I32Const:
        return DecodeConst(f, expected);
      case Expr::GetLocal:
        return DecodeGetLocal(f, expected);
      case Expr::SetLocal:
        return DecodeSetLocal(f, expected);
      case Expr::Block:
        return DecodeBlock(f, expected);
      case Expr::I32Add:
      case Expr::I32Sub:
      case Expr::I32Mul:
      case Expr::I32DivS:
      case Expr::I32DivU:
      case Expr::I32RemS:
      case Expr::I32RemU:
      case Expr::I32And:
      case Expr::I32Or:
      case Expr::I32Xor:
      case Expr::I32Shl:
      case Expr::I32ShrS:
      case Expr::I32ShrU:
      case Expr::F32Add:
      case Expr::F32Sub:
      case Expr::F32Mul:
      case Expr::F32Div:
      case Expr::F32Min:
      case Expr::F32Max:
      case Expr::F32CopySign:
      case Expr::F64Add:
      case Expr::F64Sub:
      case Expr::F64Mul:
      case Expr::F64Div:
      case Expr::F64Min:
      case Expr::F64Max:
      case Expr::F64CopySign:
        return DecodeBinaryOperator(f, expected);
      default:
        break;
    }

    return f.fail("bad expression code");
}
开发者ID:ajkerrigan,项目名称:gecko-dev,代码行数:56,代码来源:Wasm.cpp

示例3: DecodeConstI64

static bool
DecodeConstI64(FunctionDecoder& f, ExprType* type)
{
    int64_t _;
    if (!f.d().readVarS64(&_))
        return f.fail("unable to read i64.const immediate");

    *type = ExprType::I64;
    return true;
}
开发者ID:cbradley857,项目名称:gecko-dev,代码行数:10,代码来源:Wasm.cpp

示例4: DecodeConstI32

static bool
DecodeConstI32(FunctionDecoder& f, ExprType* type)
{
    int32_t _;
    if (!f.d().readVarS32(&_))
        return f.fail("unable to read i32.const immediate");

    *type = ExprType::I32;
    return true;
}
开发者ID:cbradley857,项目名称:gecko-dev,代码行数:10,代码来源:Wasm.cpp

示例5: DecodeLoadStoreAddress

static bool
DecodeLoadStoreAddress(FunctionDecoder &f)
{
    uint32_t offset, align;
    return DecodeExpr(f, ExprType::I32) &&
           f.d().readVarU32(&offset) &&
           f.d().readVarU32(&align) &&
           mozilla::IsPowerOfTwo(align) &&
           (offset == 0 || f.fail("NYI: address offsets")) &&
           f.fail("NYI: wasm loads and stores");
}
开发者ID:kitcambridge,项目名称:gecko-dev,代码行数:11,代码来源:Wasm.cpp

示例6: DecodeCallImport

static bool
DecodeCallImport(FunctionDecoder& f, ExprType* type)
{
    uint32_t importIndex;
    if (!f.d().readVarU32(&importIndex))
        return f.fail("unable to read import index");

    if (importIndex >= f.mg().numImports())
        return f.fail("import index out of range");

    return DecodeCallWithSig(f, *f.mg().import(importIndex).sig, type);
}
开发者ID:cbradley857,项目名称:gecko-dev,代码行数:12,代码来源:Wasm.cpp

示例7: DecodeCall

static bool
DecodeCall(FunctionDecoder& f, ExprType* type)
{
    uint32_t funcIndex;
    if (!f.d().readVarU32(&funcIndex))
        return f.fail("unable to read import index");

    if (funcIndex >= f.mg().numFuncSigs())
        return f.fail("callee index out of range");

    return DecodeCallWithSig(f, f.mg().funcSig(funcIndex), type);
}
开发者ID:cbradley857,项目名称:gecko-dev,代码行数:12,代码来源:Wasm.cpp

示例8: DecodeGetLocal

static bool
DecodeGetLocal(FunctionDecoder& f, ExprType expected)
{
    uint32_t localIndex;
    if (!f.d().readVarU32(&localIndex))
        return f.fail("unable to read get_local index");

    if (localIndex >= f.fg().locals().length())
        return f.fail("get_local index out of range");

    return CheckType(f, ToExprType(f.fg().locals()[localIndex]), expected);
}
开发者ID:ajkerrigan,项目名称:gecko-dev,代码行数:12,代码来源:Wasm.cpp

示例9: DecodeGetLocal

static bool
DecodeGetLocal(FunctionDecoder& f, ExprType* type)
{
    uint32_t localIndex;
    if (!f.d().readVarU32(&localIndex))
        return f.fail("unable to read get_local index");

    if (localIndex >= f.locals().length())
        return f.fail("get_local index out of range");

    *type = ToExprType(f.locals()[localIndex]);
    return true;
}
开发者ID:cbradley857,项目名称:gecko-dev,代码行数:13,代码来源:Wasm.cpp

示例10: DecodeBlock

static bool
DecodeBlock(FunctionDecoder& f, bool isLoop, ExprType* type)
{
    if (!f.pushBlock())
        return f.fail("nesting overflow");

    if (isLoop) {
        if (!f.pushBlock())
            return f.fail("nesting overflow");
    }

    uint32_t numExprs;
    if (!f.d().readVarU32(&numExprs))
        return f.fail("unable to read block's number of expressions");

    ExprType exprType = ExprType::Void;

    for (uint32_t i = 0; i < numExprs; i++) {
        if (!DecodeExpr(f, &exprType))
            return false;
    }

    if (isLoop)
        f.popBlock();

    ExprType branchType = f.popBlock();
    *type = Unify(branchType, exprType);
    return true;
}
开发者ID:cbradley857,项目名称:gecko-dev,代码行数:29,代码来源:Wasm.cpp

示例11: DecodeConstF64

static bool
DecodeConstF64(FunctionDecoder& f, ExprType expected)
{
    double value;
    if (!f.d().readFixedF64(&value))
        return f.fail("unable to read f64.const immediate");
    if (IsNaN(value)) {
        const double jsNaN = JS::GenericNaN();
        if (memcmp(&value, &jsNaN, sizeof(value)) != 0)
            return f.fail("NYI: NaN literals with custom payloads");
    }

    return CheckType(f, ExprType::F64, expected);
}
开发者ID:kitcambridge,项目名称:gecko-dev,代码行数:14,代码来源:Wasm.cpp

示例12: DecodeCallIndirect

static bool
DecodeCallIndirect(FunctionDecoder& f, ExprType expected)
{
    uint32_t sigIndex;
    if (!f.d().readVarU32(&sigIndex))
        return f.fail("unable to read indirect call signature index");

    if (sigIndex >= f.mg().numSigs())
        return f.fail("signature index out of range");

    if (!DecodeExpr(f, ExprType::I32))
        return false;

    return DecodeCallWithSig(f, f.mg().sig(sigIndex), expected);
}
开发者ID:kitcambridge,项目名称:gecko-dev,代码行数:15,代码来源:Wasm.cpp

示例13: DecodeReturn

static bool
DecodeReturn(FunctionDecoder& f, ExprType* type)
{
    if (f.sig().ret() != ExprType::Void) {
        ExprType actual;
        if (!DecodeExpr(f, &actual))
            return false;

        if (!CheckType(f, actual, f.sig().ret()))
            return false;
    }

    *type = AnyType;
    return true;
}
开发者ID:cbradley857,项目名称:gecko-dev,代码行数:15,代码来源:Wasm.cpp

示例14: DecodeConstF32

static bool
DecodeConstF32(FunctionDecoder& f, ExprType* type)
{
    float value;
    if (!f.d().readFixedF32(&value))
        return f.fail("unable to read f32.const immediate");

    if (IsNaN(value)) {
        const float jsNaN = (float)JS::GenericNaN();
        if (memcmp(&value, &jsNaN, sizeof(value)) != 0)
            return f.fail("NYI: NaN literals with custom payloads");
    }

    *type = ExprType::F32;
    return true;
}
开发者ID:cbradley857,项目名称:gecko-dev,代码行数:16,代码来源:Wasm.cpp

示例15: DecodeSetLocal

static bool
DecodeSetLocal(FunctionDecoder& f, ExprType expected)
{
    uint32_t localIndex;
    if (!f.d().readVarU32(&localIndex))
        return f.fail("unable to read set_local index");

    if (localIndex >= f.fg().locals().length())
        return f.fail("set_local index out of range");

    ExprType localType = ToExprType(f.fg().locals()[localIndex]);

    if (!DecodeExpr(f, localType))
        return false;

    return CheckType(f, localType, expected);
}
开发者ID:ajkerrigan,项目名称:gecko-dev,代码行数:17,代码来源:Wasm.cpp


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